Voice Recorder using python

 install portaudio using:

               pip install portAudio

install portaudio library:
    
               sudo apt-get install libportaudio2


import sounddevice
from scipy.io.wavfile import write 
fs=44100 #sample_rate
second=int(input("Enter the time duration in second: "))
print("Recording....\n")
record_voice=sounddevice.rec(int(second * fs),samplerate=fs,channels=2)
sounddevice.wait()
write("out.wav",fs,record_voice)
print("Finished....\nPlease check it...")

No comments: