-
Notifications
You must be signed in to change notification settings - Fork 269
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 pedalboard.io.AudioStream support for Linux #368
Conversation
Problem AudioStream is currently not supported on Linux due to macro definitions in the build script that disable AudioStream functionalities Solution Add the JUCE_MODULE_AVAILABLE_juce_audio_devices macro to ALL_CPPFLAGS, add link flag with the alsa-lib JUCE dependency for interacting with sound devices in Linux, fix audioDeviceIOCallback to support the live audio playback feature Result AudioStream is now supported on Linux as well as Windows and MacOS
@sarmentow thanks for this! My one concern (except for the compilation errors at the moment) is that this code as written will require users to have |
Sure. I'll add the JUCE_ALSA flag and set it to 0 in the compiler flags for MacOS and Windows to avoid including anything ALSA-related (should've done that before, sorry!), but I'm curious as to what should be done in the Linux build. I'm thinking of adding back the ifdefs you had for preventing compilation of the AudioStream header (and the juce_audio_devices header) and only include these files and link ALSA if some environment variable like LINUX_ENABLE_ALSA is set, similar to how debug builds work (i.e. by setting the DEBUG environment variable). Tell me if that sounds good and I'll start work on it right away! |
Thanks!
This would work if compiling from scratch (which I suppose is better than nothing) but won't enable the feature for If we did want to allow using |
D'oh, scratch that - it looks like it is possible to statically link
This should work, as long as it doesn't inflate the binary size too much. If we statically link |
Okay, I'll investigate the possibility of statically linking |
@psobot I managed to statically link Locally building Do you think that's reasonable? |
Awesome, nice work @sarmentow! 400kB sounds totally reasonable to me. I don't have a Linux box with an audio output handy, but I assume that local build does play audio as expected for you? I think the CI runners don't have audio interfaces at all, so as long as the tests still pass there, I think we can be reasonably certain that this change won't break anything for headless/server-based use cases. |
Yes, the example using |
@psobot Pre-build on linux is still failing with the error: Additionally, I've encountered an error in the Delete Existing Cache for macOS Objects step on macOS. The error message indicates that a token needs to be configured for the command using the Github CLI. Could you please advise on how to proceed with this? Should I add my own GitHub token as a secret in my fork to resolve this issue, or is there another recommended approach? |
@sarmentow Whoops, sorry about that |
It appears that now that AudioStream actually loads on Linux, the tests in I'll run the tests locally... Could've catched this earlier. |
I've removed the Linux-specific skips from the AudioStream tests, but encountered errors during local test runs when attempting to create AudioStream objects with certain output devices 🤔. To rule out any potential issues with my local environment, I've verified that the same errors occur when running the tests locally on the master branch. Given this, I'm inclined to believe that the issue is specific to my machine, and I'd like to re-run the tests in CI to confirm. |
This is looking almost ready to merge - I'm just going to add one CI step to try installing the resulting Linux wheels on a machine that's missing |
While reading the logs of failed checks and reading on the workflows themselves, we seem to be exceeding the 6 hour time limit, which is causing tests to fail on Linux. I'll look into what may be causing tests taking this long. Also, the step in which libasound is removed is getting a weird error regarding unmet dependencies of the Java Runtime? Will try looking into that as well. |
@psobot Great news! I was able to reproduce the bug that's been causing our tests to hang 😊. The issue arises when there are no audio devices available in Linux environments. In these cases, I'll add this consideration to validate constructor arguments in There's just one problem... This won't solve CI failures since throwing a It'd be great to have your inputs on what should be done in terms of CI tests to ensure |
After some reading, I found the |
@psobot pinging for CI approval 🫶 : |
Sorry for the delay @sarmentow! I've removed the failing |
Thanks for the contribution (and your patience) @sarmentow - I'm cutting a new release for Pedalboard v0.9.14 now, which will include this change. |
This is now on PyPI as Pedalboard v0.9.14! |
@psobot Thank you for all the help and support! This was my first PR in a bigger project, definitely learned a lot. 👍👍 |
Implements #366