Skip to content

Files

Latest commit

1facc7f · Nov 25, 2021

History

History

recording-and-playing-audio

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Feb 19, 2020
Feb 19, 2020
Feb 19, 2020
Feb 19, 2020
Feb 19, 2020
Feb 19, 2020
Nov 25, 2021
Feb 19, 2020

To run this:

  • pip3 install -r requirements.txt
  • To record audio:
    python audio_recorder.py --help
    
    Output:
    usage: 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)
    
    For instance, you want to record 5 seconds and save it to 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 play audio_file.mp3::
    python audio_player_playsound.py audio_file.mp3