PortAudio / portaudio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
Other
1.39k stars 291 forks source link

No simultaneous record & playback w/ same device (HifiBerry DAC+ ADC Pro) #862

Closed nodemand closed 7 months ago

nodemand commented 8 months ago

I have a HifiBerry DAC+ ADC Pro and am using ALSA through PortAudio in my application (based on the blocking example: paex_read_write_wire.c, which in itself also does not work) which works with a USB sound card but cannot record and playback at the same time through the HifiBerry. ALSA lists the device and aplay works. PortAudio only shows the HifiBerry after setting the environment variable PA_ALSA_PLUGHW=1. But when I select the HifiBerry as the device to use for recording and playback I get no sound at all! I'm on a Raspberry Pi 5 4GB running 64-bit Raspberry Pi OS Bookworm, Linux 6.1.0-rpi6-rpi-2712 aarch64.

UPDATE: Apparently I cannot read and write from and to the same HifiBerry device. PortAudio hangs on Pa_ReadStream... When I plug in a USB audio device and select the HifiBerry for input and USB for output everything works! But I'd like to only use the HifiBerry DAC+ ADC Pro for both input and output if this is possible.

Also, someone suggested somewhere that the issue had to do with low latency, but I've tried all kinds of different latencies and no good results.

UPDATE: I sort of assumed this was a PortAudio issue, but it seems ALSA also returns errors in a comparable application. When I find more answers I will update here...

RossBencina commented 8 months ago

Please do update us on the ongoing status.

nodemand commented 8 months ago

In the meantime I have also tested an IQAudio Codec Zero soundcard which like the HifiBerry DAC+ ADC Pro has both input and output lines, and it seems the issue is not limited to the HifiBerry. I cannot get full duplex audio out of both cards when using ALSA and in this case through PortAudio. I need an extra device - in my case a USB soundcard - for output if I use the line-in on any of the cards described. Will keep you updated...

nodemand commented 8 months ago

I opened this issue in the alsa-lib repo

nodemand commented 7 months ago

It's fixed!