-
Notifications
You must be signed in to change notification settings - Fork 71
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
Runtime error when attempting to initialize player in "exclusive_mode" #142
Comments
I suspect that the error is Windows' way of telling you that you can't open this device in exclusive mode. Perhaps because some other process is using it, or because exclusive mode is not available for every kind of sound card? |
Hm I have the same error with different devices. With the python sounddevice library and other applications I can activate the exclusive mode. |
In that case this might be a bug. I'd be grateful for any help in debugging this, as I don't currently have a lot of time to devote to open source at the moment. |
Thanks for the response @bastibe and thanks for commenting about your error @fmorillo. I had some time to take a look at this tonight and made some progress. In Moving the streamflag definition into the Some relevant documentation for the "unsupported format" error: |
Brilliant! Thank you for investigating this! So we might be restricted to a pre-set sample rate if we open a device in exclusive mode. Or perhaps we have to change the device's sample rate, as opposed to the AudioClient's. |
I pushed a relevant commit (5060713) to my fork, but I'm not sure if there's any point in making a pull request since I do not actually have exclusive mode working. |
You can create the pull request at any time if you want to ask for help, just mark is as work-in-progress. I'm afraid I can't help much at the moment, sorry. |
Hi,
I am attempting to generate real-time audio with low latency on a Windows 10 system with python 3.7. If I try to set the
exclusive_mode
argument tospeaker.player()
toTrue
, mediafoundation.py throws an error at line 92:RuntimeError: invalid argument
Here is a snippet of code that generates the error for me:
The values of
samplerate
andblocksize
(andchannels
, which I left as default) do not seem to matter here, the error always happens when I setexclusive_mode=True
.Here is the full error when I run the above snippet in an interactive session:
My PC has Realtek audio:
Thanks! Overall this library seems very helpful and a bit easier to use than pyaudio.
The text was updated successfully, but these errors were encountered: