DAC HifiBerry issue (edit: or Pi Zero sound issue)

The of soundplayerExample is crashing when trying to play a sound on Pi Zero with a HifiBerry DAC. The DAC seems to be configured correctly, it is showing the device in aplay -l and in alsamixer. I’ve also installed mplayer and that plays mp3’s fine, but nothing in oF.

It’s a clean install of 0.10.0 on the latest stretch, all updated, codec and dependencies installed. Everything compiles OK, and the other non sound examples that I’ve compiled work fine. It’s just this audio issue.

I thought it was related to this error message :
connect(2) call to /tmp/jack-1000/default/jack_0 failed (err=No such file or directory)
But I did a clean install on a Pi3 without a DAC at the same time, and that also get’s this error, but the sound works.

I noticed when I was playing mplayer at the same time, that soundPlayerExample didn’t crash, but gave error messages that the device was in use. However if mplayer is not running is crashes.

Any help much appreciated.

OK, maybe this has nothing to do with the DAC, maybe this is an mp3 library issue. I have mpg123 though.

I found this post which looks to be the same issue I’m having. :

I’ll try to re-enable the onboard audio and see if that works.

I switched back to onboard audio and that didn’t work either. So this looks likes it’s more to do with the type of Pi than the DAC. I’ve double checked libmpg123-dev is at the latest version and I cleaned oF and I’m rebuilding to see if that helps.

Bump. I’ve still not found a fix for this.

I am not sure what you need to do, but take a look at ofxPdsp, it has an example of an audio file player that I have been using on Raspberry pi with OF 10 and it works great.

Thanks for the tip fresla, ofxPDSP looks great, but it’s not suited for what I need at the moment. I’m playing mp3’s and maybe other format music files as well.

As the mp3’s play OK at a system level, I could use oF to call external programs to play them. That approach has it’s downsides though and I’d rather use ofSoundPlayer if possible.

It’s up to you. OfxPdsp uses ofxAudiofile to decode files. It has great format support, and I gave up trying to get MP3s working with OF otherwise. More convenient as you can have more local control and data, like position feedback.

OK thanks. I thought it was only for synthesis but if it supports mp3, flac and vorbis then it’s perfect. I was trying to stick with ofSoundPlayer as I have working code on pi3 and wanted to keep it simple. ofxPDSP and ofxAudioFile look like the add enough to make a quick rewrite more than worth it. Thanks again for the tip.