ipatix/agbplay

PortAudio usage fails under PipeWire 1.0.3

Opened this issue · 5 comments

I just get the following in the error window:

Pa_OpenStream(): unable to open stream with host API JACK Audio Connection Kit: Invalid number of channels

Nothing will play, it used to work just fine several years back.

I'm not even sure why it's trying to use JACK either. I can't find any options or environment variables to make PortAudio cooperate.

Interesting. I can run agbplay just fine with Pipewire 1.0.4. Does your sound card happen to have more than 2 output channels?

The reason it's trying to use JACK is because agbplay explicitly asks for JACK. I implemented this a while a go to reduce latency while being under the impression that any system that does have JACK shouldn't have a problem with it.

Interesting. I can run agbplay just fine with Pipewire 1.0.4. Does your sound card happen to have more than 2 output channels?

The reason it's trying to use JACK is because agbplay explicitly asks for JACK. I implemented this a while a go to reduce latency while being under the impression that any system that does have JACK shouldn't have a problem with it.

It... shouldn't. Everything is setup as "Analog Stereo".

Audio
 ├─ Devices:
 │      43. Blue Snowball                       [alsa]
 │      44. Built-in Audio                      [alsa]
 │  
 ├─ Sinks:
 │  *   50. Built-in Audio Analog Stereo        [vol: 1.00]
 │  
 ├─ Sink endpoints:
 │  
 ├─ Sources:
 │  *   49. Blue Snowball Mono                  [vol: 0.69]
 │      56. Voice Modulation Source             [vol: 1.00]
 │  
 ├─ Source endpoints:
 │  
 └─ Streams:
        55. effect_input.filter-chain-voicemod                          
             58. input_MONO      < Blue Snowball:capture_MONO	[paused]
             59. monitor_MONO   
        74. PipeWire ALSA [mpv]                                         
             63. output_FL       > ALC233 Analog:playback_FL	[active]
             75. output_FR       > ALC233 Analog:playback_FR	[active]

Screenshot_2024-04-07_14-52-47
Screenshot_2024-04-07_14-52-58

I can get it to work by exporting a PIPEWIRE_NOJACK=1 but then it requests a ridiculous low latency anyways (below the minimum QUANT of 64) and while the audio works, nothing displays properly.

I'm not quite sure. Even if the sound card would have had more channels I would've expected portaudio would handle this just by using only the first two channels. If your sound card is mono only, I would not be surprised that this happens when using JACK. Can you check in the qjackctl Graph View that your sound card do indeed have two channels? Is it possible that agbplay tries to output to a different sound card than intended?

In regards to the usage of ALSA: I can imagine what's causing it as agbplay uses a suggested minimum latency setting from portaudio, which I've seen is sometimes reported as 0.0 ms.

Unfortunately I currently do not have much time to get into this, but in about a month that will change.

It's weird that Audacity still manages to somehow work via JACK, and that's also using PortAudio. I wouldn't be entirely fully sure why either.

This is what things look like in qjackctl:
Screenshot_2024-04-08_11-16-25

The problem likely is that agbplay tries to connect to 'Voice Modulation Source'. If you use branch 'agbplay_v2' it will now output which device failed to open.

a1d61f0