PHAT DAC with MOC

Hey,
I have a raspberry pi with a phat dac and trying to play music with MOC (music on console).
I configured it using the bash script from pimoroni: curl -sS https://get.pimoroni.com/phatdac | bash
When I try to start MOC server, I get the error: FATAL_ERROR: No valid sound driver!
When I test it, sound works fine (I am using: speaker-test -c2 -t wav)

I went a bit further and when running MOC in debug mode (mocp -SF), it turns out, that it doesn’t find a mixer.
alsa.c:365 alsa_init_mixer_channel(): ERROR: Can’t find mixer PCM

When checking out alsamixer: I get the error: This device does not have any controls the card that is set (top left) is snd_rpi_hifiberry_dac.

Anybody know how to get the PHAT DAC working with MOC? How can you set the correct mixer?

It’s just a hunch, but it sounds like MOC either has a config file, or is hard-coded to try and open the output device named “PCM”, this is the default name for the Pi’s audio output. It’s not unusual for ports of software to the Pi to do this.

It may be possible to modify your /etc/asound.conf to rename the default device to “PCM”. Worth a try. If the file doesn’t exist, something like this might work:

pcm.!default {
        type plug
        slave.pcm "PCM"
}

ctl.!default {
        type hw
        card 0
}

pcm.PCM {
        type hw
        card 0
}

Thanks for getting back. But this does not work for me.

Is there a way to allow software volume control on the phat dac. That might help with getting it with MOC.

Try:

sudo systemctl stop pulseaudio just to make sure Pulse isn’t interfering.

Then give this a go in asound.conf:

pcm.!default {
        type plug
        slave.pcm "PCM"
}

ctl.!default {
        type hw
        card 0
}

pcm.PCM {
    type softvol
    slave.pcm "plughw:0"
    control.name "Master"
    control.card 0
}