Puredata, Jack and multi channel audio (only 2 channels showing, not 4)
@bobfred said:
How can I view a bluetooth output in jack so I can send these outputs independently to seperate devices?
JACK cannot do this. Period. JACK's timing requirements are far too strict for BT. Period.
(For sake of completeness: Some years ago, I tried to hack it using bluez-alsa and I did actually get JACK piping into Bluetooth earpieces for a short time, with a ridiculous buffer size of 8192 samples x 2 periods, like a quarter-second latency But then JACK would always hang within 15 minutes, and it was impossible to restart the JACK server without rebooting the whole system. So I found that this was not an especially joyful way to work and I gave it up.)
Pipewire might be able to do this.
hjh
Puredata, Jack and multi channel audio (only 2 channels showing, not 4)
I think this idea about the "system" only have 2 output channels is a good intuitive guess, only because it resonates with something I was supposing. Still not sure why or how thats the case it would impact it, nor how to change it.
However, ass FFWs post below displays, they are successful getting it to work on Debian.
@FFW said:
It works out of the box on Debian sid but with jack checked not portaudio
I was able to achieve this also, but the issue with jack is that it is not displaying bluetooth output devices.
Jack cannot support Bluetooth and it seems bluetooth headphone support is handled exclusively by PulseAudio (not even ALSA). How can I view a bluetooth output in jack so I can send these outputs independently to seperate devices?
thanks for confirming that jack supports the multiple inputs. I must have missed something... any idea why it wont work with pipewire? I am happy to use jack so long as I can get access to the bluetooth output.
readsf~, play speed, sample rate, and [timer] base time
@rph-r The only way Pulse could be the culprit is if you are running jack/portaudio through Pulse, but that is generally not done since Pulse has too much latency for realtime audio. I can't speak of portaudio (never used it) but with jack the general setup is to either have Pulse as a client of jack or have jack kill Pulse when it starts and restart Pulse when it shuts down. I would guess that the later is your setup, Pulse configures your audio card and jack is not great at doing that so just accepts what Pulse set it at. You might be able to get jack to set it properly or configure Pulse to use 44.1. Some soundcards jack just can not configure as far as I can tell so if you are using Pulse and having jack kill Pulse you need to either configure the soundcard manually or do it in Pulse before starting jack, I have to do this with my laptop, jack can not select between headphone and speaker outs and will use which ever is enabled when it starts.
Edit: I suppose it could also be the case that your soundcard is 48k only?
solution for midi-style patchbay (MS20 usb controller)
@cfry The catch with your [list store] solution is jack 0 would always have jack inserted in it, but you can fix that by just making no connection be -1 instead of zero. I would use text since we can store more information this way, jack per line with s or r or the audio counterparts and the unique symbol. Now a simple abstraction can do it all for you.
So a jack is inserted we get the appropriate line from the text, other side is inserted and we get that line, pack the four symbols in the appropriate order and dynamically create the abstraction with [obj 10 10 abs $1 $2 $3 $4(, and it creates the appropriate send and receive or what ever. When disconnect happens just grab the symbol and send a bang to <that-symbol>-kill and it deletes the abstraction. This also makes the prepatched modular style of the ms-20 easy, just send the default connections to be made at startup. And we can simply check if it is a valid connection as well, not connecting two outputs or mixing data and audio, etc or treat such things as jack inserted but no connection.
The one catch is that you need to have logic to avoid duplicate connections since if 2 is connected to 4 that also means 4 is connected to 2 and using sends and receives this way means you can created duplicate connections and each duplicate doubles the data sent, if you have two of the same connections that means you get 4 copies of the data sent.
Edit: Previous edit about issues with the abstraction idea was an error in my thinking, abstraction will work fine for this.
Pd on a Mac with Jack
@jameslo ALSA and OSS are low level/tied into the kernel. PipeWire, Jack and PulseAudio are more user level and communicate with ALSA or OSS. All of these have overlap but they are not quite the same thing. Essentially linux used OSS back in the day than OSS changed its licence so linux had to find something new in a hurry, enter ALSA which was not at all ready but pretty good, not as mature as OSS or as featureful but it did a good job within its limits, which is where Jack and Pulse come in. Jack and Pulse flesh out the features of ALSA but Pulse got adopted before it was ready and that first year or two was not fun and few seem to really like it, Jack is great when it works but can be a nightmare when it does not. Enter PipeWire which brings video into the mix and seems to solve many of the user/administration issues of the rest. Just fired up PipeWire for the first time ever and it seems to work quite well without issues but I have yet to give it a good test.
An application needs to be built with support for Jack, Pulse, ALSA and OSS if it wants to use them, PipeWire understands the languages of all of those and an app built with Jack or Pulse support will* work with PipeWire and unlike Pulse and Jack can also expose ALSA/OSS ports so applications can access them directly without the middle man which is one of the huge issues with Jack and Pulse, they both take over all available ports so no one else can get in. So now I am recompiling PD to see if it speaks to PipeWire through its Jack interface.
I know little to nothing about PortAudio, I believe it is a crossplatform library capable of talking to many different audio services.
*apparently you need to build the apps off of the PipeWire Jack libs and not the regular Jack libs which kind of sucks but nothing major, we don't have to wait for the devs to get around to fixing anything at least.
Pd on a Mac with Jack
Dummy check please. Is it true that:
- Jack can serve as audio loopback software between MacOS audio apps such as Pd
- Jack can run on an M2 processor
- The Qjackctl.app that is bundled with the Jack MacOS download runs on Monterrey without any additional runtime frameworks installed
- For Pd to send/receive from a Jack channel, Jack has to be running and you have to select Jack in the audio settings before you can select which particular Jack channel you want for input or output
- Soundflower is obsolete; Jack is current
?
Edit: I can confirm the 2nd through 4th bullet point but not the first and last. I've seen 2 tutorial videos on Mac audio loopback where you can see that the presenter has Soundflower installed in addition to whatever loopback software they were demonstrating, so that makes me scratch my head. RE that first point, I'm tentatively concluding that an audio app has to be Jack-aware (like Pd) in order for it to be routed by Jack, which isn't a requirement of other loopback drivers like Soundflower or Blackhole. Finally, it's worth noting that Jack doesn't come with an uninstaller, so to get rid of it you have to manually remove files from /usr/local and below, and the list of files can be found on one of the windows of the installation package if you scroll down. If that's not your cup of tea, don't install it!
TLDR: I'm not sure why anyone would want to use Jack on a Mac. Still happy to be schooled though.
No sound. Failed install?
@mario60 PulseAudio is hogging alsa. Supposedly you can use pd with pulse audio through the portaudio backend but it has never worked for me. You have a few other options as well, you can install jack recompile pd with jack support, this requires you to run pulse into jack, or jack into pulse, or suspend pulse when you start jack. Or you can suspend pulse and use alsa direct. Portaudio->PulseAudio can be troublesome with audio, Pulse has a fair amount of latency so if you want to process live sound it generally is not a viable option, but if you just want to patch together synths in pd than it should be fine.
Jack is the most reliable and the frontends for jack have provisions to handle the pulse stuff for you, but you will probably need to do some setup the first time around on a system like Fedora which does not seem all that popular in the audio community. Initial setup can be a pain but once it is going you just start jack and that is it. Suspending pulse manually and using alsa works well but there can be surprises when restarting pulse, and they can be a trick to sort out.
PD <-> DAW interactions tutorials please?
@jameslo said:
for completeness I suppose one should mention using MIDI and audio loopback software,
@parisgraphics said:
I have access to PD on Linux
In that case Jack server is your friend. Get QjackCtl for easy setup and patching. I do such things as control pd patches from my DAW via midi through jack to PD, translate midi messages from my keyboard in PD and route them to my DAW through jack, route audio from my DAW to PD for processing and back again through jack, the possibilities are endless...
DAW's that work for these kinds of setups on linux (that I have worked with): Ardour, Qtractor, Reaper. Rosegarden - there are probably more. For the time being I prefer reaper
@jameslo said:
the flexible MIDI and audio routing capabilities in Reaper seem to make them unnecessary.
I haven't been using reaper for a more than a couple of months, but at least on linux all external routing has to be patched through jack server
Problems with jack on linux.
Have you tried replacing both JACK & Pulseaudio with Pipewire? I have high-hopes for that, down the road. The artix Wiki has page specific to this: https://wiki.artixlinux.org/Site/PipewireInsteadPulseaudio
On Ubuntu & Debian now, Pulse and JACK can co-exist fairly well. I migrated to the KXstudio way of handling the two, vs Qjackctl, with the bridging controls in Cadence. Three, really, since there's also an ALSA bridge.
Even with JACK & Pulse bridged, my system automatically resets to the onboard sound device for Pulse, vs my default JACK interface (USB). Usually not an issue, but if I'm using Firefox or a video editor, it needs to be explicitly set.
I also use a pair of scripts to kill or restart Pulseaudio, since I'm using JACK 99% of the time. It's not really necessary, but it can reduce CPU load 3-4% :
#!/bin/bash
systemctl --user stop pulseaudio.socket
systemctl --user stop pulseaudio.service
If JACK can't start because some other service has grabbed the interface, try that script before re-configuring (I don't recall if that script alone stops Pulse from respawning, tho).
Problems with jack on linux.
@bocanegra Thank you, i do hve librewolf (firefox) open, so i want that to work. i installed qjackctl and pulseaudio-jack on my artix (arch based) openrc system. it worked, purr data works, but librewolf audio clips and sounds like crap, i disconnected my usb headphones and reconnected them, but now librewolf outpts no audio, the same with purr data, except it shows up in the graph in qjackctl unlike librewolf which disappeared from there.
i restarted my system just now and jack won't start for some reason, but librewolf audio works fine.
error message in qjackctl:
13:31:47.206 JACK is starting...
13:31:47.208 /usr/bin/jackd -dalsa -dhw:0 -r48000 -p64
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
13:31:47.226 JACK was started with PID=3085.
Could not open component .so '/usr/lib/jack/jack_firewire.so': libffado.so.2: cannot open shared object file: No such file or directory
Could not open component .so '/usr/lib/jack/jack_firewire.so': libffado.so.2: cannot open shared object file: No such file or directory
jack_get_descriptor : dll
jack_get_descriptor returns null for 'jack_firewire.so'
Could not open component .so '/usr/lib/jack/jack_firewire.so': libffado.so.2: cannot open shared object file: No such file or directory
jackdmp 1.9.19
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2021 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
Cannot lock down 107341340 byte memory area (Cannot allocate memory)
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|64|2|48000|0|0|nomon|swmeter|-|32bit
ATTENTION: The playback device "hw:0" is already in use. Please stop the application using it and run JACK again
Released audio card Audio0
audio_reservation_finish
Cannot initialize driver
JackServer::Open failed with -1
Failed to open server
13:31:47.348 JACK was stopped
13:31:49.270 Could not connect to JACK server as client. - Overall operation failed. - Unable to connect to server. Please check the messages window for more info.
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Any help?