33 comments
-
HiFiBerry team We're working on it. However, as the Pi5 requires another kernel we can't say when this might be available.
-
Jeroen Hi!
I'm on Raspberry Pi OS Bookworm 64bit running a Pi 5 with a HifiBerryDAC+ ADC Pro, but whatever I do I cannot record and playback using the DAC+ ADC Pro... This is my output for alsaloop, aplay and arecord...
alsaloop -r 48000 -C hw:1 -P hw:1 -l 256 -s 0 -U
Unable to set hw params for playback hw:1: Invalid argument
Unable to set sw parameters for playback hw:1 stream: Invalid argument
Loopback start failure.
Output for aplay:
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Device [USB Audio Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: sndrpihifiberry [snd_rpi_hifiberry_dacplusadcpro], device 0: HiFiBerry DAC+ADC Pro HiFi multicodec-0 [HiFiBerry DAC+ADC Pro HiFi multicodec-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
Output for arecord:
arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Device [USB Audio Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: sndrpihifiberry [snd_rpi_hifiberry_dacplusadcpro], device 0: HiFiBerry DAC+ADC Pro HiFi multicodec-0 [HiFiBerry DAC+ADC Pro HiFi multicodec-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
I'm getting kinda desperate here! I especially bought this card because of the input and the article on alsaloop clearly states it is possible to pipe input to output. Both LEDS light up for input as well as output but no sound... My endgoal is to develop an application that does pitch shifting on live audio in C++ which I have working as long as I set the USB Audio Device as the output... HELP!
-
HiFiBerry team 1. Remove your USB sound card
2. Check if playback alone is working correctly:
https://www.hifiberry.com/docs/software/playing-test-sounds/Also make sure, all audio middleware is stopped:
https://www.hifiberry.com/blog/techtalk-streaming-services-file-types-and-hifiberry-sound-cards/ -
Jeroen Thanx for your reply!
Playback (mp3 with mplayer and the Sine with play) is working and PulseAudio was not running. I started it and then tried a few things but the same situation and then I stopped it again and tried again. Same, same...
-
HiFiBerry team Next thing is to check if recording is working. Record audio and play it back seperately
Are you using Raspberry Pi OS Light? If you use the GUI version, there is probably some audio middleware running, either PulseAudio or PipeWire. When dealing with this kind of stuff, we recommend a plain Raspberry Pi OS Light without any GUI.
-
HiFiBerry team BTW: This has nothing to do with the Pi5, please create a separate thread for something like this in the future.
-
Jeroen I recorded something with arecord @ 192kHz stereo S32_LE to a wav file and played it back using mplayer. Works perfectly!
I’m running the full version but I’m booting to CLI. -
Jeroen Oh ok, I just thought since I was experiencing some unique situations, perhaps it had to do with the Pi 5. But ok, will do that next time!
-
HiFiBerry team We haven't tested the latest alsaloop for some time. command line options might have changed or the behavior might have changed. You should first check the manual page. Then start with simply 48kHz/2 channels instead of 192kHz. 192kHz is quite ressource intense. Get it "just working" first before starting tuning.
-
Jeroen I ran it already @ 48kHz, as you can read in my first comment, but I tried again with the most basic options and I get the same error msg. Whatever I try. When I try to do the same with the USB Audio Card it works perfectly...
-
HiFiBerry team Looking at this, you are using parameters that alsaloop can't handle:
"Unable to set hw params for playback hw:1: Invalid argument
Unable to set sw parameters for playback hw:1 stream: Invalid argument"
This can be incorrect channel count, incorrect sample rate, different settings for input and output or some audio middleware that already blocks access to the sound card.
Basic settings should be: 48kHz, 2 channels.
BTW: Why are you using alsaloop at all if you want to use your own software? -
Jeroen Sorry I had plugged the usb device back in. I removed it, rebooted and this is the output of the following command:
alsaloop -r 48000 -c 2 -C hw:0 -P hw:0
overrun for capture hw:0
I'm only trying alsaloop to see if that does work since my application halts on reading from the stream...
-
HiFiBerry team If this happen, the recording and playback are not running synchronously. As playback and recording share the same clock, the application software has to make sure that this also happens with the audio samples. If you read a specific number of samples, you also have to play back the same amount of samples.
This is different with an USB sound card that doesn't use a fixed clock for both. -
Jeroen ok, got it. I actually do exactly that in my application. I'm basically using a default PortAudio example. But what is the solution? Since alsaloop also does not work...
-
Jeroen Now I'm getting the same error as before with the same alsaloop command!:
Unable to set hw params for playback hw:0: Invalid argument
Unable to set sw parameters for playback hw:0 stream: Invalid argument
Loopback start failure.
-
Jeroen FYI I also tried a c++ ALSA application which also gives errors on reading...
-
Jeroen And...I just tried Raspberry Pi OS Bookworm 64bit Lite. Fresh install and followed instructions @ https://www.hifiberry.com/docs/software/configuring-linux-3-18-x/
But nope. Still overrun for capture hw:0
-
Jeroen I get this message when running dmesg:
[ 5.254515] snd-rpi-hifiberry-dacplusadcpro soc:sound: ASoC: driver name too long 'HifiberryDacpAdcPro' -> 'HifiberryDacpAd'
Is that a problem?
-
HiFiBerry team This shows that the device was not released correctly. This can happen if you abort a program (e.g. by killing it) that has still the sound device open. In this case, the easiest way is to reboot. You can check the state using the /proc filesystem (we haven't tested this on Bookworm):
cat /proc/asound/card?/pcm*/sub?/hw_params -
HiFiBerry team [ 5.254515] snd-rpi-hifiberry-dacplusadcpro soc:sound: ASoC: driver name too long 'HifiberryDacpAdcPro' -> 'HifiberryDacpAd'
Is that a problem?No, that's just an information
-
Jeroen I ran:
cat /proc/asound/card0/pcm0c/sub0/hw_params
it says: closed
So what's next?
-
HiFiBerry team Also check the playback device, just use the command line I posted
cat /proc/asound/card?/pcm*/sub?/hw_params -
Jeroen "closed" as well
-
Jeroen Is it broken?
-
HiFiBerry team In this case, alsaloop should just work fine without any "Unable to set hw params for playback hw:0: Invalid argument" errors. Correct.
For the buffer over/underruns: Check the resampling options of alsaloop in the man page. You need to make sure that there is no resampling and input and output run at the same clock rate. -
Jeroen Correct. Resampling is the -n option. It is not active.
-
Jeroen When I use 500ms latency with the "-t 500000" option, I'm getting a lot fewer overrun errors, but still no sound output at all!
-
HiFiBerry team Try increasing buffer size. Use at least 128 frames buffer size, but up to 1k should just work fine. You can also experiment with the "-S" sync option.
-
HiFiBerry team You can also try using an older Pi and the previous Raspberry Pi OS. Maybe there are still bugs in the latest kernel and/or bookworm release.
-
Jeroen nope...nothing, nada, tried all different kids op options with -S and -B. no sound at all...
Well, I could try that but it is no use to me. The pitch shifting for which I bought this card needs quite a powerful CPU. Besides I do not have an eligible Pi lying around. Only an ancient Pi Model B+.
Well I guess I could try it and see whether the HifiBerry is working...