spatialaudio / python-sounddevice

:sound: Play and Record Sound with Python :snake:
https://python-sounddevice.readthedocs.io/
MIT License
980 stars 145 forks source link

Load user-provided PortAudio name/path from environ's SD_PORTAUDIO #499

Open arkrow opened 8 months ago

arkrow commented 8 months ago

Implements the necessary functionality suggested in one of the discussions in #130.

Loads a user-specified PortAudio binary during runtime, by either providing its filename as usual or providing its absolute path. Providing a PortAudio binary's filename (if the directory it resides in exists in PATH), as well as its absolute path works on Windows, though needs confirmation on other platforms.

pep8speaks commented 8 months ago

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

Line 63:80: E501 line too long (81 > 79 characters) Line 73:80: E501 line too long (85 > 79 characters)

Comment last updated at 2024-01-21 18:15:02 UTC
mgeier commented 5 months ago

I have documented how to load a custom PortAudio library: #518

@arkrow Do you think your PR is still needed, since users can already use custom DLLs etc.?

arkrow commented 1 month ago

I have documented how to load a custom PortAudio library: #518

@arkrow Do you think your PR is still needed, since users can already use custom DLLs etc.?

One advantage this implementation has is that it solves potential PATH shadowing issues (e.g. another directory with portaudio is in PATH and has higher precedence/order, so it is loaded instead of the custom portaudio binary that a developer shipped with their package/software and intended to use).

I think it'd be good to continue the discussion in #130. I can pick up this PR again in the future if you are open to this implementation and other members of the community find it useful for their use case.