Help with ALSA config

Hi there! I’m Antonio, first time posting here.

I’ve been playing with Snips for the past 3 weeks now, I’m enjoying it!

I run it on a Raspberry Pi 3 with Raspbian Stretch.

As an input device I’m using a cheap generic USB Microphone found on Amazon, not the best but it gets the job done.
As output I was using the speaker of the TV my Raspi was connected to via HDMI.

No problem at all configuring them with SAM setup audio.

Fast foward to last week: proto part was finished so I wanted to make my Snips-powered Assistant independent from my TV.

I bought the Speaker-pHat (https://shop.pimoroni.com/products/speaker-phat) to give my Raspi and my Snips a little speaker to talk.

It is a speaker with a little array of LEDs to use as VUmeter.

The drivers to install the pHat are here.

After the script was done, pHat worked great: speaker and leds were ok and everything cool, but… Snips was dead.

It turns out the installation script of the pHat Speaker modify /etc/asound.conf, overwriting the one produced by sam setup audio.

In this way snips-audio-server cannot start successfully and Snips became unusable.

The asound.conf made by SAM setup audio was a simple one:

   pcm.!default {
    type asym
    playback.pcm {
        type plug
        slave.pcm "hw:0,1"
    }
    capture.pcm {
        type plug
        slave.pcm "hw:1,0"
    }
}

while the one needed to use the speaker pHat is this:

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

ctl.!default {
        type hw
        card 0
}

pcm.pivumeter {
        type meter
        slave.pcm "hw:0,0"
        scopes.0 pivumeter
}

pcm.softvol_and_pivumeter {
        type softvol
        slave.pcm "pivumeter"
        control {
                name "PCM"
                card 0
        }
}

pcm_scope.pivumeter {
        type pivumeter
        decay_ms 500
        peak_ms 400
        brightness 128
        output_device speaker-phat
}

pcm_scope_type.pivumeter {
        lib /usr/local/lib/libpivumeter.so
}

pcm.dsp0 pivumeter

It configures the plugin to let the VUmeter work. As I said, I think this is necessary to let the LED array work. I thought to simply add

capture.pcm {
            type plug
            slave.pcm "hw:1,0"
        }

to pcm.!default but it not worked.

I am an absolute ALSA noob and have no clue how to do resolve the issue.
Any help is really appreciated.

As I’m looking forward to finally use Snips on my Raspi, I thank you for the great work running the forum and wish you all a great day.

Hey @Yant, welcome to the forum!

Can you try the following config?:

pcm.!default {
    type asym
    playback.pcm {
        type plug
        slave.pcm "softvol_and_pivumeter"
    }
    capture.pcm {
        type plug
        slave.pcm "hw:1,0"
    }
}

ctl.!default {
        type hw
        card 0
}

pcm.pivumeter {
        type meter
        slave.pcm "hw:0,0"
        scopes.0 pivumeter
}

pcm.softvol_and_pivumeter {
        type softvol
        slave.pcm "pivumeter"
        control {
                name "PCM"
                card 0
        }
}

pcm_scope.pivumeter {
        type pivumeter
        decay_ms 500
        peak_ms 400
        brightness 128
        output_device speaker-phat
}

pcm_scope_type.pivumeter {
        lib /usr/local/lib/libpivumeter.so
}

pcm.dsp0 pivumeter

If this doesn’t work, maybe it works without the ctl.!default:

pcm.!default {
    type asym
    playback.pcm {
        type plug
        slave.pcm "softvol_and_pivumeter"
    }
    capture.pcm {
        type plug
        slave.pcm "hw:1,0"
    }
}

pcm.pivumeter {
        type meter
        slave.pcm "hw:0,0"
        scopes.0 pivumeter
}

pcm.softvol_and_pivumeter {
        type softvol
        slave.pcm "pivumeter"
        control {
                name "PCM"
                card 0
        }
}

pcm_scope.pivumeter {
        type pivumeter
        decay_ms 500
        peak_ms 400
        brightness 128
        output_device speaker-phat
}

pcm_scope_type.pivumeter {
        lib /usr/local/lib/libpivumeter.so
}

pcm.dsp0 pivumeter