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?
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.
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?
Problems with jack on linux.
@bocanegra said:
jack has to be set up properly for the server to run without dropouts (select the correct soundcard, buffer size etc in settings), or even start at all. For this purpose I use qjackctl, which is a GUI control panel for the jack server-
Agreed -- IMO it's highly recommended to manage the JACK server using JACK tools, and not recommended to expect the JACK client app to do it for you.
qjackctl.
Also there are PulseAudio-JACK modules which, when configured correctly, allow JACK and non-JACK apps to coexist peacefully. I've been running this way for 11 years now in Ubuntu. It's unfortunate that it isn't set up like this out of the box, but you don't have to accept the either/or situation.
hjh
Problems with jack on linux.
It's hard to tell without knowing your setup. OS? Hardware?
I run PD vanilla on xubuntu 20.?? (latest LTS) and an external sound card/mixer (cheap behringer). I can get audio both with and without jack
If I set up PD to run just with ALSA (no jack) and I have some other programs running that are using the sound card (like a browser or whatever) PD will tell me:
ALSA input error (snd_pcm_open): No such file or directory
ALSA output error (snd_pcm_open): No such file or directory
However, closing my browser and/or other programs that route sound through ALSA solves this
Using jack instead gives me the advantage of running other DAW software along side PD and route both midi and audio back and forth between them (non jack programs will be silenced), but jack has to be set up properly for the server to run without dropouts (select the correct soundcard, buffer size etc in settings), or even start at all. For this purpose I use qjackctl, which is a GUI control panel for the jack server- should be in your distro's repositories.
The errors you get with jack simply states that the jack server is not running- it has to be started manually. You can do that with a command from your terminal or get the qjackctl software for the GUI (which I reckon you will prefer as a windows convert). Run: sudo apt install qjackctl
from your terminal to install it if you are using a debian based distro (*ubuntu, mint et al)
Having lots of switches into Pd
@alexandros said:
Have you detected whether the crash happens with
else if (in == 'd')
orelse if (in == 'p')
?
It happens only in else if (in == 'p')
. When I bypass that I can update snapshot~ by 1 ms (I assume that 'c' will still be sent by 1 ms intervals).
In the Pd patch it's probably better to swap the $1 and $2 values in the messages. Have the channel set in a cold inlet and the value in a hot one and then write this message
print $2c$1v
Ok I did that.
I see in the screenshot of the patch that the PWM message is not connected to [comport]. Is this for some particular reason?
It is to make sure Pd does not crash/freeze until I want to try the code.
Maybe the 10ms interval for sending a PWM value to [comport] is a bit too fast. Did you try something slower, like 50ms?
That made it work. If I use six pwm pins the limit is 150 ms before crash.
Question 1: Could there something bad that happens around else if (in == 'p')
? In another code snippet you used this format:
while(Serial.available()){
byte inByte = Serial.read();
if((inByte >= '0') && (inByte <= '9'))
temporary = 10 * temporary + inByte - '0';
else{
if(inByte == 'p'){
pwmLEDvalue = temporary;
temporary = 0;
}
else if(inByte == 'd'){
dspLEDstate = temporary;
temporary = 0;
}
}
analogWrite(pwmLED, pwmLEDvalue);
digitalWrite(dspLED, dspLEDstate);
}
compared to this in the current sketch:
if (Serial.available()) {
static int temp;
byte in = Serial.read();
if (isDigit(in)) temp = temp * 10 + in - '0';
else if (in == 'c') {
channel = temp;
temp = 0;
}
else if (in == 'd') {
digitalWrite(outPins[channel], temp);
temp = 0;
}
else if (in == 'p') {
analogWrite(pwmPins[channel], temp);
temp = 0;
}
}
Question 2: Is this crash of Pd and the computer (macOS Mojave) expected behavior in a situation like this? If it is not, maybe it should be reported as a bug. It happens consistently.
Thoughts: Could there be a problem in [comport]? This crash behavior is identical with the problems I had when using Pdunio/Firmata.
a way to do acoustical Room Analysis in Pure Data would be awesome
@Coalman A (log) sweep is best. And quite a slow one.
You need to give the room time to resonate and reveal its imperfections..... so an impulse or white noise are really a waste of time.
Low frequencies are complex in the room due to comb filtering...... you will need to measure at many locations in the listening area.
And first you need to plot the microphone against the sweep with the speaker outdoors to know the deficiencies of both the speaker and the microphone.
Test the room with the same single source first.... multiple sources will create interference patterns at all frequencies.
Plot the sweep level and the microphone level returned into two arrays and then subtract the sweep from the microphone at each index (outdoors)...... you now have a graph of the speaker to microphone errors at all frequencies.
Do the same indoors and you have the room errors combined with the speaker and microphone errors..... so now subtract the plot of speaker and microphone errors from that and you are left with just the room.
The main complication will be the latency.
If you send an impulse from Pd before the sweep you can manually offset each plot before doing the subtractions....... by setting an offset start for the microphone plot (offset by the number of samples before the impulse) when you play them back and produce the subtracted plot .
Probably an hour to build the patch.
Probably 12 hours to get all the plots.
Probably 12 days to fix the room.
Probably 12 weeks to get all your speakers in the best places and know exactly where to sit.
Probably 12 quadrillion zillion years before you will be happy.
I spent most of my life doing the same every day by ear (its a lot easier and quicker), outdoors, in railway carriages, clubs, Olympic gyms and stadiums.... with far more speakers and subs than could possibly be coherent.
120 Meyer 650 subs in the Albert Hall on one occasion.
Often we could move just one speaker by half a centimetre and all would come right.
I bought a house with a lounge with a 7 metre pitched ceiling..... 15 metres long....... 6 metres wide.
I put a pair of Quad ESL63's (point source concentric electrostatic speakers) and Gradient SW63 dipole subs in the right places........ and I am quite happy..... if I am listening to a great recording....... which is almost never........
Mono is underrated.
David.
How to send guitar signal to Pd?
Hi, I'm a complete Pd and audio engineering beginner trying to connect an electric guitar to my Macbook and process the signal to create some effects for a school project. I'm trying to use JACK for that purpose, but I searched the entire internet including this forum, and can't seem to figure out how to do it.
What I'm working with is:
- jack -> USB Behringer cable
- Pd 0.51.1
- JACK 1.9.16 installed with an installer from jackaudio.org and running the bundled Qjackctl
- macOS Catalina 10.15.6
When I run JACK in messages I can see that it recognizes the USB guitar interface C-Media USB Device:
In the connection graph I can only see these available:
Also while having JACK running, I go to MEDIA -> JACK in Pd and in the logs I get "Can't open Jack (it seems not to be installed)" error message.
I've also tried alternatives to JACK like Soundflowe or Blackhole, but don't understand how to use it to send the guitar signal to Pd or even how to send it to the speakers (is that even possible?).
My JACK settings look like this:
Any help would be greatly appreciated!