[SOLVED] Problem with .asoundrc


#1

Dear Snips Team,

First of all, thank you very much for creating this project! :slight_smile:
I have installed snips and (among a bunch of strange ERRORs about snips_analytics and snips_query : " missing field name at line 151 column 1") it starts and is happily activated by the keyword “Hey Snips” on a Raspberry PI 3.

I do not seem to fully understand how to properly configure my .asoundrc, though. I have a record/playback USB microphone array (ClearOne Chat 170) that works if I add some command line parameters like this:
arecord -D plughw:1,0 -r 48000 -f S16_LE out.wav
Same thing, I can hear (reasonably clean and loud) audio with:
aplay -D plughw:1,0 -r 48000 -f S16_LE out.wav

So I tried to configure ~/.asoundrc like this:

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

But:

  1. This configuration does not work if I call arecord and aplay using default values : it still records with the wrong format and rate even if it uses the correct device.

  2. Snips seems to use a different sampling rate

    [10:21:16.422855] INFO :snips_dialogue::services: publish ASR(ToggleOff)
    [10:21:16.422928] INFO :snips_dialogue::services: publish Hotword(ToggleOn)
    [10:21:16.452067] INFO :snips_dialogue::dialogue: State: Idle, incoming Message: Hotword(Detected)
    [10:21:16.452211] INFO :snips_dialogue::services: publish Hotword(Wait)
    [10:21:16.452283] INFO :snips_dialogue::services: publish ASR(ToggleOn)
    [10:21:16.452348] INFO :snips_dialogue::services: publish AudioServer(PlayFile)
    [10:21:16.452408] INFO :snips_dialogue::dialogue: Current State: WaitingQuery
    [10:21:16.561970] INFO :snips_asr : Listening
    [10:21:16.569510] INFO :snips_audio_server : using output “default” for “/usr/share/snips/dialogue/sound/start_of_input.wav”, WavSpec { channels: 2, sample_rate: 22050, bits_per_sample: 16, sample_format: Int }
    LOG (snips_stt[5.2.48~1-3505]:CompileLooped():nnet-compile-looped.cc:336) Spent 0.052871 seconds in looped compilation.
    [10:21:18.901997] INFO :snips_asr::asr : Source thread stop on push: “Full(…)”
    [10:21:24.093250] INFO :snips_asr::asr : Endpoint detection.
    [10:21:24.318444] INFO :snips_asr : Cleanup
    [10:21:24.318854] INFO :snips_asr : Idle
    [10:21:24.360468] INFO :snips_dialogue::dialogue: State: WaitingQuery, incoming Message: ASR(TextCaptured)
    [10:21:24.360560] INFO :snips_dialogue::services: publish ASR(ToggleOff)
    [10:21:24.360601] INFO :snips_dialogue::services: publish AudioServer(PlayFile)
    [10:21:24.367147] INFO :snips_dialogue::services: publish NLU(Query)
    [10:21:24.367279] INFO :snips_dialogue::dialogue: Current State: WaitingIntent
    [10:21:24.470852] INFO :snips_audio_server : using output “default” for “/usr/share/snips/dialogue/sound/end_of_input.wav”, WavSpec { channels: 2, sample_rate: 22050, bits_per_sample: 16, sample_format: Int }

  3. Snips cannot play back its ‘cannot understand’ message, neither on headphone nor over the ClearOne speaker

Could you please give me any hint, test to better configure Alsa for my case ?
Thank you very much in advance,

Best regards


#2

Hello Ido,

It looks like you’re using a standard mic that should work out of the box, Also your logs don’t . I would suggest you try this asoundrc configuration :

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

ctl.!default {
  type hw
  card 1
}

It helps our platform knowing which device to use (in your case hw:1,0). Then we’ll detect mic specific configuration in our code.
Also run ‘alsamixer’ to check if you have the proper sound levels set for your mic, input & output.

Best regards,


#3

Hi Charles,

Thank you very much for looking into my problem and giving me an helpful hint!
I just solved my issue, as you said no need to tweak with my microarray, it works out of the box. The main issue was that I was not stopping snips properly and it kept the microphone busy forever, so other tests looked like they were ignoring the hardware.
Now this works like a charm :slight_smile:

Best regards,

Luca