-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
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
[BUG] Not recording speaker in Windows #87
Comments
Additional info: When I change the settings to HostAPI: MME and Speaker to the default speaker, I got an error in the log which looks like to have a different origin, most likely the audio stream can be captured but not processed: log
Using pyaudiowpatch to find the loopback speaker import pyaudiowpatch as pyaudio
# Find default Microphone and Speakers:
p = pyaudio.PyAudio()
wasapi_info = p.get_host_api_info_by_type(pyaudio.paWASAPI)
default_speakers = p.get_device_info_by_index(wasapi_info["defaultOutputDevice"])
default_microphone = p.get_device_info_by_index(wasapi_info["defaultInputDevice"])
if not default_speakers["isLoopbackDevice"]:
for loopback in p.get_loopback_device_info_generator():
"""
Try to find loopback device with same name(and [Loopback suffix]).
Unfortunately, this is the most adequate way at the moment.
"""
if default_speakers["name"] in loopback["name"]:
default_speakers = loopback
break
else:
print("Default loopback output device not found.\n\nRun `python -m pyaudiowpatch` to check available devices.\nExiting...\n")
exit()
print(f"""
Input Microphone : {default_microphone['name']}
Index : {default_microphone['index']}
Input Channels : {default_microphone['maxInputChannels']}
Input Latency : {default_microphone['defaultLowInputLatency']} s
Input Latency(max): {default_microphone['defaultHighInputLatency']} s
Sample Rate : {default_microphone['defaultSampleRate']} Hz
""")
print(f"""
Loopback Speakers : {default_speakers['name']}
Index : {default_speakers['index']}
Channels : {default_speakers['maxInputChannels']}
Latency : {default_speakers['defaultLowInputLatency']} s
Latency(max) : {default_speakers['defaultHighInputLatency']} s
Sample Rate : {default_speakers['defaultSampleRate']} Hz
""") resulting in:
|
Speech Translate is not recording the speaker in Windows 11
Speech Translate is properly recording, transcribing and translating when the input is set to Microphone, but when I change to Speaker, it gives an error: -9999 Unanticipated host error and does not starts the recording.
To Reproduce
Host API tried:
Speaker setting (all combinations):
Screenshots
Log
2024-09-18 12:06:42.920 | ERROR | record.py:944 [Thread-50 (record_session)] - [Errno -9999] Unanticipated host error
Traceback (most recent call last):
File "D:\Codes_Projects\Python\Speech-Translate\speech_translate\utils\audio\record.py", line 651, in record_session
File "D:\Codes_Projects\Python\Speech-Translate.venv\Lib\site-packages\pyaudiowpatch_init_.py", line 801, in open
File "D:\Codes_Projects\Python\Speech-Translate.venv\Lib\site-packages\pyaudiowpatch_init_.py", line 467, in init
OSError: [Errno -9999] Unanticipated host error
2024-09-18 12:06:42.920 | ERROR | record.py:945 [Thread-50 (record_session)] - Error in record session
Desktop
The text was updated successfully, but these errors were encountered: