Skip to content
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

Add an environ flag to load an ASIO PortAudio binary #556

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

arkrow
Copy link
Contributor

@arkrow arkrow commented Sep 4, 2024

This PR adds the option to load an alternative PortAudio binary with ASIO support, enabled using an environ flag.

Additional PortAudio binaries compiled with ASIO will need to be maintained in the _sounddevice_data repository (e.g. named libportaudio64bit-asio.dll). They will then be bundled like default binary in the built package and can then be used by using the os.environ["SD_ENABLE_ASIO"] flag.

This PR is based on, and is the inverse of #498, since the default is now ASIO-disabled.

Minimal example:

import os

# Set environ key anywhere before importing sounddevice. Value is not important.
os.environ["SD_ENABLE_ASIO"] = "1"

# Since "SD_ENABLE_ASIO" is set, sounddevice will load the ASIO-enabled binary
import sounddevice as sd

print(sd.query_hostapis())

@arkrow arkrow mentioned this pull request Sep 4, 2024
@arkrow arkrow force-pushed the win_optional_asio_patch branch from 0099659 to 2748f70 Compare September 4, 2024 21:35
@pep8speaks
Copy link

Hello @arkrow! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 78:80: E501 line too long (81 > 79 characters)

@rob-broadley
Copy link

I have given this a test and it works as expected (ASIO support enabled with the SD_ENABLE_ASIO environment variable, no ASIO support without it).

@mgeier
Copy link
Member

mgeier commented Sep 5, 2024

Thanks @arkrow for this PR and thanks @rob-broadley for testing!

This will not work in the conda package, which is no problem (at least not ours), but we should probably still mention that in the docs? (The docs already mention that the conda-forge package doesn't have ASIO support, but maybe it doesn't hurt to also mention it in the context of the environment variable)

It will also not work if a custom portaudio.dll is present in the %PATH%. I think this is also fine, but should maybe also be mentioned in the docs.

@arkrow Would you like to add some documentation?

@mgeier mgeier merged commit 2748f70 into spatialaudio:master Oct 1, 2024
12 checks passed
@mgeier
Copy link
Member

mgeier commented Oct 1, 2024

Thanks again! I will add the docs in a separate PR.

@mgeier
Copy link
Member

mgeier commented Oct 1, 2024

I have added some documentation in #558.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants