To run this:
pip3 install -r requirements.txt
- To record audio:
Output:
python audio_recorder.py --help
For instance, you want to record 5 seconds and save it tousage: audio_recorder.py [-h] [-o OUTPUT] [-d DURATION] an Audio Recorder using Python optional arguments: -h, --help show this help message and exit -o OUTPUT, --output OUTPUT Output file (with .wav) -d DURATION, --duration DURATION Duration to record in seconds (can be float)
recorded.wav
file:python audio_recorder.py -d 5 -o recorded.wav
- To play audio, there are 3 options (
audio_player_playsound.py
using playsound,audio_player_pydub.py
using pydub,audio_player_pyaudio.py
using pyaudio), if you want to playaudio_file.mp3
::python audio_player_playsound.py audio_file.mp3