Closed Ushi-Oni closed 5 months ago
Are you sure device index 1 is an output device? It might be an input. The code just tries to play a 1 channel file (mono) which should be supported by basically anything.
You can do
import sounddevice
sounddevice.query_devices()
To see all the various device IDs.
Yep! Exactly what it was. Wrote this quick little blurb to prompt the user so they can setup what device they'd like to use:
print("Next, let's select the proper audio device.")
p = pyaudio.PyAudio()
for i in range(p.get_device_count()):
device_info = p.get_device_info_by_index(i)
if device_info['defaultSampleRate'] >= 44100.0 and device_info['maxOutputChannels'] > 0:
print(f'#{device_info["index"]}: {device_info["name"]} \n')
print(f'@{device_info["defaultSampleRate"]}Hz with default low/high output latency of '
f'[{device_info["defaultLowOutputLatency"]},{device_info["defaultHighOutputLatency"]}] \n')
print('-'*100)
while audio_device_index == -1:
try:
audio_device_index = int(input("Please enter the index id you'd like to select. Choose wisely."))
except ValueError:
print('Invalid selection, your input to the previous question was not a number. Try again.')
👍, glad to hear that fixed it.
Actually, I tried switching to sounddevice, used that to get a good index, and set that for the playback device, but now I'm getting a Failed to Load ASIO driver (ASIO error 0)
Specifically:
sounddevice.PortAudioError: Error opening RawOutputStream: Unanticipated host error [PaErrorCode -9999]: 'Failed to load ASIO driver' [ASIO error 0]
It appears the support for ASIO can have some problems: https://github.com/spatialaudio/python-sounddevice/issues/442
I would recommend trying one of the other audio backends. I usually use MME if on windows.
Hey all!
Getting this new error when utilizing generate_stream_audio_v2. I have the following setup for the call:
Error:
Any ideas?