bastibe / SoundCard

A Pure-Python Real-Time Audio Library
https://soundcard.readthedocs.io
BSD 3-Clause "New" or "Revised" License
680 stars 69 forks source link

Approach for recording using jack soundcard #178

Open jreus opened 5 months ago

jreus commented 5 months ago

Hey there. I love the direction this library is going.

I am running on linux. But I have a soundcard that is only supported using jack - if used with pulseaudio I lose access to the individual channels.

Is there any future plans for enabling jack support with this library? Or is the only way forward to set up Pulseaudio/Jack bridging?

Many thanks!

bastibe commented 5 months ago

The aim of this library is to implement the "native" audio interface of each operating system. Critically, I want to be able to select the system's default sound card, and get the same thing every other app is using. At this time, this means pulse, not jack.

That said, each implementation (Windows WASAPI, MacOS CoreAudio, Linux Pulseaudio) is technically entirely separate. They just happen to implement the same API. I wouldn't mind adding additional implementations for e.g. Jack, if you were to program one.

However, Jack has a very specific use case, of low latency and flexible routing, and Python is not a very good fit for these sorts of applications. The garbage collector and the need to use Numpy and the lack of free threading limits our low-latency capabilities. If you're going to do any processing whatsoever, you're typically looking at an internal latency of at least 10ms, at which point Jack doesn't provide much benefit over pulse any more. So it's not a great fit for soundcard in general, I'm afraid.