Commit 3820451b authored by LiniEisha's avatar LiniEisha

Integrate

parent adb48fef
import sounddevice as sd import sounddevice as sd
from scipy.io.wavfile import write from scipy.io.wavfile import write
import wavio as wv import wavio as wv
import os
# Sampling frequency def AudioRecorder(audio):
freq = 44100
# Recording duration BASE_DIR = os.path.dirname(os.path.abspath(__file__))
duration = 10
# Start recorder with the given values of #for the array
# duration and sample frequency DESTINATION_DIR = os.path.join(BASE_DIR, "audioArray\\{}".format(audio))
recording = sd.rec(int(duration * freq),
samplerate=freq, channels=2)
# Record audio for the given number of seconds #for the audio
sd.wait() LECTURE_AUDIO_DIR = os.path.join(BASE_DIR, "lectures\\{}".format(audio))
# This will convert the NumPy array to an audio
# file with the given sampling frequency
write("recording0.wav", freq, recording)
# Sampling frequency
freq = 44100
#Convert the NumPy array to audio file # Recording duration
wv.write("recording1.wav", recording, freq, sampwidth=2) duration = 20
\ No newline at end of file
# Start recorder with the given values of
# duration and sample frequency
recording = sd.rec(int(duration * freq),samplerate=freq, channels=2)
# Record audio for the given number of seconds
sd.wait()
# This will convert the NumPy array to an audio
# file with the given sampling frequency
write("recording0.wav", freq, recording)
#Convert the NumPy array to audio file
wv.write("recording1.wav", recording, freq, sampwidth=2)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment