blog · git · desktop · images · contact


rtspeccy to become more generic and versatile

2023-04-09

When I started writing rtspeccy in 2011 – phew, time flies –, PulseAudio was beginning to become the thing in the Linux world (or maybe it already was, I hardly remember – but it was still a bit new). I wasn’t a fan of it at the time (my opinion on this has changed, as my requirements have changed, too), so I started rtspeccy as a plain ALSA client. This worked quite well and, even after I switched to PulseAudio (or PipeWire these days on some machines), I could still use rtspeccy.

In the last few years, though, I started using JACK more and more. I couldn’t find a way to trick ALSA clients like rtspeccy into being a JACK client. Yes, with PipeWire, these problems go away, because PipeWire can speak to all kinds of clients, but PipeWire is not quite ready to be a full replacement for JACK, I think. I still get crackling and stuttering from time to time.

So, what now? Add code to rtspeccy to also support JACK? Nah, do the opposite: rtspeccy is sound-server-agnostic now. It just reads raw audio data from stdin. This means you can pipe audio from any sound source into it and have rtspeccy visualize it.

For example, to record from ALSA, emulating what rtspeccy previously did:

$ arecord -f S16_LE -r 44100 -B 2 | rtspeccy

To record from JACK:

$ jack-stdout -b 16 -e signed -L -n rtspeccy existing_port | rtspeccy

Or PulseAudio:

$ parec -n rtspeccy --format=s16le --channels=1 --latency-msec=2 | rtspeccy

The only thing to take care of is to have the recording program use a small buffer (hence -B 2 or --latency-msec=2 in these examples). Data should arrive in a uniform and timely fashion at rtspeccy if you want “near realtime” graphs. Also, rtspeccy has no clock of its own, it relies entirely on the timing of the data as it arrives.

I now have several instances of rtspeccy running (left channel, right channel, mix) and Ardour connects to them (it even maintains these connections after restarts, yay), together with an instance of Meterbridge’s goniometer. All this is far from professional audio, but it’s an improvement over my previous situation.

Comments?