We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import webrtcvad import pyaudio import os CHUNK = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 1 RATE = 16000 WAVE_OUTPUT_DIR = "temp"
if not os.path.exists(WAVE_OUTPUT_DIR): os.makedirs(WAVE_OUTPUT_DIR) WAVE_OUTPUT_FILENAME = os.path.join(WAVE_OUTPUT_DIR, "output.wav")
p = pyaudio.PyAudio() vad = webrtcvad.Vad(1)
stream = p.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, frames_per_buffer=CHUNK)
frames = [] print("start...") while True: data = stream.read(CHUNK) is_speech = vad.is_speech(data, sample_rate = RATE) if is_speech: frames.append(data) else: break print("end...") stream.stop_stream() stream.close() p.terminate()
Prompt:Error while processing frame
is_speech = vad.is_speech(data, sample_rate = RATE) How to handle this data
The text was updated successfully, but these errors were encountered:
Instead of "data = stream.read(CHUNK)", do "data = stream.read(int(RATE/100))".
Sorry, something went wrong.
No branches or pull requests
import webrtcvad
import pyaudio
import os
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 16000
WAVE_OUTPUT_DIR = "temp"
if not os.path.exists(WAVE_OUTPUT_DIR):
os.makedirs(WAVE_OUTPUT_DIR)
WAVE_OUTPUT_FILENAME = os.path.join(WAVE_OUTPUT_DIR, "output.wav")
p = pyaudio.PyAudio()
vad = webrtcvad.Vad(1)
stream = p.open(format=FORMAT,
channels=CHANNELS,
rate=RATE,
input=True,
frames_per_buffer=CHUNK)
frames = []
print("start...")
while True:
data = stream.read(CHUNK)
is_speech = vad.is_speech(data, sample_rate = RATE)
if is_speech:
frames.append(data)
else:
break
print("end...")
stream.stop_stream()
stream.close()
p.terminate()
Prompt:Error while processing frame
is_speech = vad.is_speech(data, sample_rate = RATE) How to handle this data
The text was updated successfully, but these errors were encountered: