Audio device disappeared after movie playback

It uses portaudio, so whatever backends the installed libportaudio exposes, PsychPortAudio can use. If Psychtoolbox is still maintained by the time a future Ubuntu LTS with “Pipewire by default” was released and the base-funding by our users is much much better than what it is now (like at least 25x as much) then I can consider active work on improvements in this area. If not, then this will be the least of the problems the neuroscience community will face when it comes to demanding/high quality data collection.

One way to combine relatively good timing precision/low latency with the ability to share the soundcard with other apps (or our GStreamer support) right now, is to use the jack backend of PsychPortAudio/portaudio. Portaudio’s jack backend – according to my code review and some light testing on some setup a few years ago – does have the kind of timing/timestamping support that PsychPortAudio needs. One way is to install/setup a real jack 2 server, the other way is a pipewire emulated jack server.

Pipewire is supposed to be a reasonably compatible replacement for both pulseaudio and jack, iow. Pipewire has pulseaudio and jack frontends and can thereby pretend to be a pulseaudio or jack server.

I only touch-tested this for a few minutes quickly in my light test of Ubuntu 23.04 a few weeks ago, but iirc. there is some command-line tool pwjack or pw-jack or pipewire-jack or something similar to that, which allows to launch at least octave (a la pw-jack octave --gui or something like that) with some jack client library interposer injected. If launched this way, then PsychPortAudio GetDevices will also list some Jack audio devices. One choose those to use Pipewire via Jack with probably reasonable timing/latency etc.

Note that timing precision/reliabilty/accuracy etc. was only properly tested with PsychPortAudio when using a native sound device in exclusive mode (ALSA on Linux, WASAPI (and ASIO in the past) on Windows, Coreaudio on macOS), so all these shared modes may or may not work with correct timing. Also due to lack of funding, the last full validation test is a while ago. In the past, I revalidated this stuff against each major new OS release, but if our users don’t care enough about the quality of their tax-payer funded research to support us financially even a little bit then I can’t waste my time and money on extensive free validation work anymore.

Maybe, I don’t know, don’t care at this time. Our driver or portaudio does not have a native pipewire backend, so whatever that is is an emulation of unknown quality.

-mario