Giter Club home page Giter Club logo

audiorec's Introduction

AudioRec - A Python package

AudioRec is the most simple audio recorder for python. Record any sound from your standard recording device to WAV or MP3. Simply hit start, stop and save - done.

  • Record sound from the standard input device
  • Recording happens in another thread - stop the recording on command
  • Save the sound as a wav
  • Quickly convert it to MP3

How to get it

To download AudioRec, you simply use pip:

pip install AudioRec

Or you clone this respository and add all the files contained in the AudioRec folder into your project folder.

Usage

AudioRec is deadly simple. First, import the package and create a recorder instance.

from AudioRec import Recorder

rec = Recorder()

Start / Stopping a recording

To start a new recording, simply hit rec.start()

rec.start()

Your recording starts in another thread, so you are free to continue with your main program. In the most simple case, just wait for X seconds before you stop the recording.

time.sleep(5)   # Waits for 5 seconds

Then call the recording to stop.

rec.stop()

Save the recording and convert it to MP3

To save the recorded audio, specify a filename and call save.

rec.save("test.wav")

Now that your file is saved, convert it to MP3 and delete the old file.

Recorder.wavTomp3("test.wav")
Recorder.delete("test.wav")

Coplete example

rec = Recorder()
print("Start recording")
rec.start()
time.sleep(5)
print("Stop recording")
rec.stop()
print("Saving")
rec.save("test.wav")
print("Converting wav to mp3")
Recorder.wavTomp3("test.wav")
print("deleting wav")
Recorder.delete("test.wav")

Optinal parameters

When you initialize a recorder, you can define the chunk-size, the channels (2 for stereo) and the bitrate (44100 Hz standard).

rec = Recorder(chunk=1024, channels=2, rate=44100)

License

IMPORTANT: The file "ffmpeg.exe" is excluded from the MIT license and fall under the GNU2 License. Download the original here

MIT License

Copyright (c) 2018 Joel Barmettler

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Hire us: Software Entwickler in Zürich!

audiorec's People

Contributors

joelbarmettleruzh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.