Skip to content

Latest commit

 

History

History
 
 

recording-and-playing-audio

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