I want to transcribe audio in real-time concurrently with recording using PyAudio's stream #929
Unanswered
houkagoplay
asked this question in
Q&A
Replies: 2 comments 2 replies
-
You can pass a |
Beta Was this translation helpful? Give feedback.
1 reply
-
You can try using the 'sounddevice' lib: import numpy as np
import sounddevice as sd
from faster_whisper import WhisperModel
print("Recording started")
duration = 10
sample_rate = 16000
audio_data = sd.rec(
int(sample_rate * duration), samplerate=sample_rate, channels=1, dtype=np.float32
)
sd.wait()
audio_data = audio_data.squeeze()
print(audio_data)
print("Recording stopped")
model = WhisperModel("tiny", device="cpu")
segments, info = model.transcribe(audio_data, word_timestamps=True)
for segment in segments:
print("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text)) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
"I'm currently developing a program using PyAudio to record microphone audio and perform real-time speech-to-text transcription. I've successfully saved the audio data as a file using stream.read, but I'm struggling to perform the transcription. Instead of transcribing the saved file immediately after recording, I want to transcribe it concurrently with the recording process. However, I'm unsure how to pass the audio data from the streaming process to the transcription process.
In the example provided by the library:
Is it possible to use the audio data captured during recording in place of "audio.mp3"? If so, what processing steps are needed to pass the streaming data for transcription?
I would appreciate any guidance or suggestions on how to achieve this.
This document was created using Google Translate and chatgpt.
Beta Was this translation helpful? Give feedback.
All reactions