[SOLVED] Matrix Voice capture can not be started although test & asound worka and snips.toml mike is set

Hi,

I cannot get my matrix voice mic array to work as snip-audio-server is restarting constaly and shows not running with ‘sam status’. I first installed matrix voice as described on their webpage including kernel modules and it also shows up fine on aplay -l and arecord -l as card 3 (card 2 is USB speaker) and I also can select it without any problems in “sam setup audio” and test it with “sam test speaker” and “sam test microphone” it records and plays back fine.

I’ve also read some threads here in the forum that you have to set the mike in /etc/snip.toml correctly which I did as well, here are my config files:

root@snipscontroller:~# cat /etc/asound.conf
pcm.!default {
    type asym
    playback.pcm {
        type plug
        slave.pcm "hw:2,0"
    }
    capture.pcm {
        type plug
        slave.pcm "hw:3,0"
    }
}

here’s just the audio-server part of /etc/snips.toml

[snips-audio-server]
# frame = 256
# bind = "default@mqtt"
# mike = "Built-in Microphone"
mike = “MATRIXIO-SOUND: - (hw:3,0)”
# disable_playback = false
# disable_capture = false

and both asound and snips.toml should be fine as can see by the output or aplay -l and arecord -l

root@snipscontroller:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 7/7
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Dummy [Dummy], device 0: Dummy PCM [Dummy PCM]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 2: Device [USB2.0 Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 3: MATRIXIOSOUND [MATRIXIO-SOUND], device 1: matrixio.pcm-out.0 snd-soc-dummy-dai-1 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

and here’s arecord

root@snipscontroller:~# arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Dummy [Dummy], device 0: Dummy PCM [Dummy PCM]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 3: MATRIXIOSOUND [MATRIXIO-SOUND], device 0: matrixio.mic.0 snd-soc-dummy-dai-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

And here’s the output when I stop the service and start snips-audio-server manually with verbose option:

root@snipscontroller:~# snips-audio-server -v
[08:12:44.348449] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.bus -> Ok(None)
[08:12:44.348785] DEBUG:snips_common_cli::cli: conf lookup: snips-common.bus -> Ok(None)
[08:12:44.348871] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.mqtt -> Ok(None)
[08:12:44.348939] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mqtt -> Ok(None)
[08:12:44.349110] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.mqtt_username -> Ok(None)
[08:12:44.349188] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mqtt_username -> Ok(None)
[08:12:44.349267] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.mqtt_password -> Ok(None)
[08:12:44.349341] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mqtt_password -> Ok(None)
[08:12:44.349421] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.mqtt_tls_hostname -> Ok(None)
[08:12:44.349497] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mqtt_tls_hostname -> Ok(None)
[08:12:44.357355] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.alsa_playback -> Ok(None)
[08:12:44.357511] DEBUG:snips_common_cli::cli: conf lookup: snips-common.alsa_playback -> Ok(None)
[08:12:44.357600] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.disable_playback -> Ok(None)
[08:12:44.357676] DEBUG:snips_common_cli::cli: conf lookup: snips-common.disable_playback -> Ok(None)
[08:12:44.357756] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.output -> Ok(None)
[08:12:44.357825] DEBUG:snips_common_cli::cli: conf lookup: snips-common.output -> Ok(None)
[08:12:44.357903] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.frame -> Ok(None)
[08:12:44.357974] DEBUG:snips_common_cli::cli: conf lookup: snips-common.frame -> Ok(None)
[08:12:44.358052] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.nomike -> Ok(None)
[08:12:44.358119] DEBUG:snips_common_cli::cli: conf lookup: snips-common.nomike -> Ok(None)
[08:12:44.358192] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.mike -> Ok(None)
[08:12:44.358261] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mike -> Ok(None)
[08:12:44.358340] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.disable_capture -> Ok(None)
[08:12:44.358417] DEBUG:snips_common_cli::cli: conf lookup: snips-common.disable_capture -> Ok(None)
[08:12:44.358497] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.alsa_capture -> Ok(None)
[08:12:44.358572] DEBUG:snips_common_cli::cli: conf lookup: snips-common.alsa_capture -> Ok(None)
[08:12:44.358649] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.hijack -> Ok(None)
[08:12:44.358720] DEBUG:snips_common_cli::cli: conf lookup: snips-common.hijack -> Ok(None)
[08:12:44.358800] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.bind -> Ok(None)
[08:12:44.358869] DEBUG:snips_common_cli::cli: conf lookup: snips-common.bind -> Ok(None)
[08:12:44.358953] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.bind -> Ok(None)
[08:12:44.359022] DEBUG:snips_common_cli::cli: conf lookup: snips-common.bind -> Ok(None)
[08:12:44.359127] INFO :snips_audio_server_cli: Starting audio server on mqtt for site default
[08:12:44.359369] DEBUG:snips_audio_portaudio : Attempt 0
[08:12:44.359707] DEBUG:snips_audio_portaudio : Mike source capture started
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.Dummy.pcm.front.0:CARD=1'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM front
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.Dummy.pcm.surround51.0:CARD=1'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.Dummy.pcm.surround51.0:CARD=1'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.Dummy.pcm.surround40.0:CARD=1'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.Dummy.pcm.surround51.0:CARD=1'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.Dummy.pcm.surround51.0:CARD=1'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.Dummy.pcm.surround51.0:CARD=1'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.Dummy.pcm.surround71.0:CARD=1'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.Dummy.pcm.iec958.0:CARD=1,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM iec958
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.Dummy.pcm.iec958.0:CARD=1,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.Dummy.pcm.iec958.0:CARD=1,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
[08:12:44.459521] DEBUG:snips_audio_portaudio : Attempt 1
[08:12:44.465022] DEBUG:snips_audio_portaudio : Portaudio: Ok("PortAudio V19-devel (built May  9 2019 13:17:19)")
[08:12:44.465131] DEBUG:snips_audio_portaudio : Looking for default input device
[08:12:44.465173] INFO :snips_audio_portaudio : Use input device: "default"
[08:12:44.465216] DEBUG:snips_audio_portaudio : Start capture: InputSettings { params: Parameters { device: Index(DeviceIndex(8)), channel_count: 1, suggested_latency: 0.017414965986394557, is_interleaved: true, sample_format: PhantomData }, sample_rate: 16000.0, frames_per_buffer: 256, flags:  }
[08:12:44.473419] DEBUG:snips_audio_portaudio : start capture loop
[08:12:44.559723] DEBUG:snips_audio_portaudio : Attempt 2
[08:12:44.659875] DEBUG:snips_audio_portaudio : Attempt 3
[08:12:44.760006] DEBUG:snips_audio_portaudio : Attempt 4
[08:12:44.860134] DEBUG:snips_audio_portaudio : Attempt 5
[08:12:44.960250] DEBUG:snips_audio_portaudio : Attempt 6
[08:12:45.060372] DEBUG:snips_audio_portaudio : Attempt 7
[08:12:45.160501] DEBUG:snips_audio_portaudio : Attempt 8
[08:12:45.260632] DEBUG:snips_audio_portaudio : Attempt 9
[08:12:45.360759] DEBUG:snips_audio_portaudio : Attempt 10
[08:12:45.460890] DEBUG:snips_audio_portaudio : Attempt 11
[08:12:45.561026] DEBUG:snips_audio_portaudio : Attempt 12
[08:12:45.661160] DEBUG:snips_audio_portaudio : Attempt 13
[08:12:45.761300] DEBUG:snips_audio_portaudio : Attempt 14
[08:12:45.861431] DEBUG:snips_audio_portaudio : Attempt 15
[08:12:45.961557] DEBUG:snips_audio_portaudio : Attempt 16
[08:12:46.061696] DEBUG:snips_audio_portaudio : Attempt 17
[08:12:46.161827] DEBUG:snips_audio_portaudio : Attempt 18
[08:12:46.261952] DEBUG:snips_audio_portaudio : Attempt 19
[08:12:46.362076] DEBUG:snips_audio_portaudio : Attempt 20
[08:12:46.462202] DEBUG:snips_audio_portaudio : Attempt 21
[08:12:46.562337] DEBUG:snips_audio_portaudio : Attempt 22
[08:12:46.662470] DEBUG:snips_audio_portaudio : Attempt 23
[08:12:46.762600] DEBUG:snips_audio_portaudio : Attempt 24
[08:12:46.862722] DEBUG:snips_audio_portaudio : Attempt 25
[08:12:46.962842] DEBUG:snips_audio_portaudio : Attempt 26
[08:12:47.062964] DEBUG:snips_audio_portaudio : Attempt 27
[08:12:47.163090] DEBUG:snips_audio_portaudio : Attempt 28
[08:12:47.263210] DEBUG:snips_audio_portaudio : Attempt 29
[08:12:47.363329] DEBUG:snips_audio_portaudio : Attempt 30
[08:12:47.463456] DEBUG:snips_audio_portaudio : Attempt 31
[08:12:47.563600] DEBUG:snips_audio_portaudio : Attempt 32
[08:12:47.663749] DEBUG:snips_audio_portaudio : Attempt 33
[08:12:47.763920] DEBUG:snips_audio_portaudio : Attempt 34
[08:12:47.864052] DEBUG:snips_audio_portaudio : Attempt 35
[08:12:47.964175] DEBUG:snips_audio_portaudio : Attempt 36
[08:12:48.064294] DEBUG:snips_audio_portaudio : Attempt 37
[08:12:48.164418] DEBUG:snips_audio_portaudio : Attempt 38
[08:12:48.264541] DEBUG:snips_audio_portaudio : Attempt 39
[08:12:48.364661] DEBUG:snips_audio_portaudio : Attempt 40
[08:12:48.464787] DEBUG:snips_audio_portaudio : Attempt 41
[08:12:48.564915] DEBUG:snips_audio_portaudio : Attempt 42
[08:12:48.665045] DEBUG:snips_audio_portaudio : Attempt 43
[08:12:48.765172] DEBUG:snips_audio_portaudio : Attempt 44
[08:12:48.865301] DEBUG:snips_audio_portaudio : Attempt 45
[08:12:48.965426] DEBUG:snips_audio_portaudio : Attempt 46
[08:12:49.065545] DEBUG:snips_audio_portaudio : Attempt 47
[08:12:49.165669] DEBUG:snips_audio_portaudio : Attempt 48
[08:12:49.265794] DEBUG:snips_audio_portaudio : Attempt 49
[08:12:49.366107] INFO :snips_broadcast_mqtt_server: Starting broadcasting audio on hermes as site "default"
[08:12:49.366779] ERROR:snips_audio_server         : an error occured: Can not read a stopped source
 -> caused by: Can not read a stopped source

Does anybody any idea? I did everything from the book from a fresh install on a brand new RPI B3+ with a fresh install of raspbian. Then installed voice kernel driver (which requires kernel downgrade) and then installed snips through sam as outlined also in posts of matrix voice.

I’m out of ideas completely. Thanks for any help on this.

Solved it myselves. Actually I also had to disable the “snd-dummy” module and fix entries in /usr/share/alsa.conf to pick up the mike specified in /etc/snips.toml.

The complete set of changes for matrix voice to make it work is here in the matrix forum:

Hi @marcelser,

do you remember what you did in alsa.conf? I have pretty much the same problem, snips-audio-server is trying to use “default” input device rather than the configured Matrix device.

sam test microphone works perfectly. But syslog says:

Jun 17 11:23:55 raspberrypi systemd[1]: Started Snips Audio Server.
Jun 17 11:23:55 raspberrypi snips-audio-server[1477]: INFO:snips_audio_server_cli: Starting audio server on mqtt for site default
Jun 17 11:23:55 raspberrypi snips-audio-server[1477]: Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 923
Jun 17 11:23:55 raspberrypi snips-audio-server[1477]: Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 923
Jun 17 11:23:55 raspberrypi snips-audio-server[1477]: ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.front.0:CARD=0'
Jun 17 11:23:55 raspberrypi snips-audio-server[1477]: ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
Jun 17 11:23:55 raspberrypi snips-audio-server[1477]: ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
Jun 17 11:23:55 raspberrypi snips-audio-server[1477]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM front
Jun 17 11:23:55 raspberrypi snips-audio-server[1477]: INFO:snips_audio_portaudio : Use input device: "default"
Jun 17 11:24:00 raspberrypi snips-audio-server[1477]: INFO:snips_broadcast_mqtt_server: Starting broadcasting audio on hermes as site "default"
Jun 17 11:24:00 raspberrypi snips-audio-server[1477]: ERROR:snips_audio_server         : an error occured: Can not read a stopped source
Jun 17 11:24:00 raspberrypi snips-audio-server[1477]:  -> caused by: Can not read a stopped source
Jun 17 11:24:00 raspberrypi systemd[1]: snips-audio-server.service: Main process exited, code=exited, status=1/FAILURE
Jun 17 11:24:00 raspberrypi systemd[1]: snips-audio-server.service: Unit entered failed state.
Jun 17 11:24:00 raspberrypi systemd[1]: snips-audio-server.service: Failed with result 'exit-code'.

I also removed the dummy sound device and asound.conf looks good:

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

$ arecord -l
**** Liste der Hardware-Geräte (CAPTURE) ****
Karte 1: MATRIXIOSOUND [MATRIXIO-SOUND], Gerät 0: matrixio.mic.0 snd-soc-dummy-dai-0 []
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0
Karte 2: Device [USB PnP Sound Device], Gerät 0: USB Audio [USB Audio]
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0

snips.toml has:

[snips-audio-server]
# frame = 256
# bind = "default@mqtt"
# mike = "Built-in Microphone"
# disable_playback = false
# disable_capture = false
mike = "MATRIXIO-SOUND: - (hw:1,0)"
Environment=“PA_ALSA_PLUGHW=1”

Any idea?

Edit: Solved! Have a look at my snips.toml where it says:

Environment=“PA_ALSA_PLUGHW=1”

Problem was I just copy&paste this line from https://community.matrix.one/t/workaround-for-snips-issue-with-latest-raspbian/2460

The quotation signs are not standard " but ”. This cannot be parsed and the whole config is broken. Replace them with “normal” ones and everything is fine.