Header Ads

Voice Recorder in Pyhton

We will use two package 'sounddevice' and 'scipy.io.wavfile'

sounddevice is used to Play and Record Sound with Python and scipy.io.wavfile is used to write a NumPy array as a WAV file.


Read about the modules :



Code :


import sounddevice
from scipy.io.wavfile import write

fr = 44100  # frame rate
sec = int(input("Enter the time duration in seconds : "))
print("Recording.....\n")
record = sounddevice.rec(int(second * fs), samplerate=fs, channels=2)
sounddevice.wait()
write("out.wav", fr, record)
print("Finished....")


Output :

 


Recorded Audio :





Post a Comment

0 Comments