#python record audio code
import IPython.display as ipd
import sounddevice as sd
import soundfile as sf
import librosa
samplerate = 48000
duration = 4 # seconds
filename = 'quran.wav'
print("start")
mydata = sd.rec(int(samplerate * duration), samplerate=samplerate,
channels=1, blocking=True)
print("end")
sd.wait()
sf.write(filename, mydata, samplerate)
#reading the voice commands
samples, sample_rate = librosa.load(filename , sr = 16000)
samples = librosa.resample(samples, sample_rate, 8000)
ipd.Audio(samples,rate=8000)
On this page of the site you can watch the video online python record audio with a duration of hours minute second in good quality, which was uploaded by the user Alien AI 01 January 1970, share the link with friends and acquaintances, this video has already been watched 1,535 times on youtube and it was liked by 14 viewers. Enjoy your viewing!