#Audio sinks
1 messages · Page 1 of 1 (latest)
Hi guys I am working on a personal project that involves speech to text which requires me to send a .wav or file-like object to google's speech recognition api. I am recording using the start-recording function and then storing the audio in a sink.
But then I struggle to convert it to the right format. Can you explain to me how to convert the data in the sink into a file-like object and if I need to use the audio_format function because the documentation lacks any information about it.
recorded_users = {
f"<@{user_id}>": audio
for user_id, audio in sink.audio_data.items()
}
with sr.AudioFile(list(recorded_users.values())[0]) as source:
audio_data = r.record(source)
text = r.recognize_google(audio_data, language = 'en-EN')
print(text)