snipsco / snips-issues

Feel free to share your bugs with us.
14 stars 5 forks source link

dsnoop/dmix for respeaker hardware #165

Closed Psychokiller1888 closed 5 years ago

Psychokiller1888 commented 5 years ago

Been trying, on respeaker device, that is respeaker 2, respeaker 4 and respeaker 6 mic array, all the asound possible. I have tried with their own optimized asound configuration that accomodates dsnoop and dmix but I cannot get snips to work with those configurations. I have tried and tried again to add dsnoop support, it's merely impossible as Snips always ends up with a "invalid input device" or a "invalid number of channels"

So I must be doing something wrong... Can you share a working asound conf with dsnoop configuration for respeaker devices please?

cpoisson commented 5 years ago

Hi @Psychokiller1888 ,

I'm looking at it using seeed's default conf.

pi@snips-home-base:~ $ cat /etc/asound.conf
# The IPC key of dmix or dsnoop plugin must be unique
# If 555555 or 666666 is used by other processes, use another one

pcm.!default {
    type asym
    playback.pcm "playback"
    capture.pcm "capture"
}

pcm.playback {
    type plug
    slave.pcm "dmixed"
}

pcm.capture {
    type plug
    slave.pcm "array"
}

pcm.dmixed {
    type dmix
    slave.pcm "hw:seeed2micvoicec"
    ipc_key 555555
}

pcm.array {
    type dsnoop
    slave {
        pcm "hw:seeed2micvoicec"
        channels 2
    }
    ipc_key 666666
}

Seeed Drivers Version (git commit) : da5f90473b6fe30b4857c6704bd9af3f2e346599

Here's my snips-audio-server logs (using portaudio):

pi@snips-home-base:~ $ sudo -u _snips snips-audio-server
[10:29:29.931495] INFO :snips_audio_server_cli: Starting audio server on mqtt for site living
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
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.seeed-2mic-voic.pcm.front.0:CARD=0'
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.seeed-2mic-voic.pcm.surround51.0:CARD=0'
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.seeed-2mic-voic.pcm.surround51.0:CARD=0'
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.seeed-2mic-voic.pcm.surround40.0:CARD=0'
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.seeed-2mic-voic.pcm.surround51.0:CARD=0'
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.seeed-2mic-voic.pcm.surround51.0:CARD=0'
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.seeed-2mic-voic.pcm.surround51.0:CARD=0'
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.seeed-2mic-voic.pcm.surround71.0:CARD=0'
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.seeed-2mic-voic.pcm.iec958.0:CARD=0,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.seeed-2mic-voic.pcm.iec958.0:CARD=0,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.seeed-2mic-voic.pcm.iec958.0:CARD=0,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
ALSA lib pcm_dmix.c:990:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
ALSA lib pcm_dsnoop.c:556:(snd_pcm_dsnoop_open) The dsnoop plugin supports only capture stream
ALSA lib pcm_dmix.c:990:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
ALSA lib pcm_dsnoop.c:556:(snd_pcm_dsnoop_open) The dsnoop plugin supports only capture stream
[10:29:31.939857] INFO :snips_audio_portaudio : Use input device: "default"
[10:29:32.535144] INFO :snips_broadcast_mqtt_server: Starting broadcasting audio on hermes as site "living"
[10:38:36.067462] INFO :snips_audio_portaudio      : Playing "3105fc7d-3a11-4c7d-ab81-6b3834f12a74" using output "default", wav spec: WavSpec { channels: 1, sample_rate: 16000, bits_per_sample: 16, sample_format: Int }
[10:38:37.839660] INFO :snips_audio_portaudio      : Playing of "3105fc7d-3a11-4c7d-ab81-6b3834f12a74" finished
[10:38:37.841859] INFO :snips_audio_portaudio      : Playing "3e8d4657-5129-4d23-8faf-db3634c9a4c7" using output "default", wav spec: WavSpec { channels: 1, sample_rate: 16000, bits_per_sample: 16, sample_format: Int }
[10:38:40.356164] INFO :snips_audio_portaudio      : Playing of "3e8d4657-5129-4d23-8faf-db3634c9a4c7" finished
[10:38:40.357154] INFO :snips_audio_portaudio      : Playing "3a82ea3b-927b-48d4-8ce9-715e531ba39c" using output "default", wav spec: WavSpec { channels: 1, sample_rate: 16000, bits_per_sample: 16, sample_format: Int }
[10:38:42.754763] INFO :snips_audio_portaudio      : Playing of "3a82ea3b-927b-48d4-8ce9-715e531ba39c" finished

Lots of warnings, but it seems to run correctly.

To test dsnoop, I'm trying to record something else in parallel with a record. Using the user pi I obtain a permission error:

pi@snips-home-base:~ $ arecord /tmp/tt.wav
ALSA lib pcm_dsnoop.c:583:(snd_pcm_dsnoop_open) unable to create IPC semaphore
arecord: main:788: audio open error: Permission denied

Using sudo or sudo -u _snips seems to fix the issue.

I guess it is more Alsa/Configuration/Permission problems to deal with.

Psychokiller1888 commented 5 years ago

I don't get it, I flashed raspbian yesterday evening, with nothing but snips runing on a respeaker 6 circular array, default asound.conf that supports dsnoop and dmix. I'll shoot you the logs as soon as I get back home

cpoisson commented 5 years ago

Yup,

It would help!

Here's a finding I'd like to share

I fixed the permission problems by changing the permission settings of ipc keys after reading this redhat issue

pi@snips-home-base:~ $ cat /etc/asound.conf
# The IPC key of dmix or dsnoop plugin must be unique
# If 555555 or 666666 is used by other processes, use another one

# use samplerate to resample as speexdsp resample is bad
defaults.pcm.rate_converter "samplerate"

pcm.!default {
    type asym
    playback.pcm "playback"
    capture.pcm "capture"
}

pcm.playback {
    type plug
    slave.pcm "dmixed"
}

pcm.capture {
    type plug
    slave.pcm "array"
}

pcm.dmixed {
    type dmix
    slave.pcm "hw:seeed2micvoicec"
    ipc_key 555555
    ipc_perm 0666
}

pcm.array {
    type dsnoop
    slave {
        pcm "hw:seeed2micvoicec"
        channels 2
    }
    ipc_key 666666
    ipc_perm 0666
}
Psychokiller1888 commented 5 years ago

Ok, trying your asound I get an error, guess it's a rate error?


Jul 08 16:37:09 ProjectAliceDev snips-audio-server[2318]: Expression 'alsa_snd_pcm_hw_params_set_rate_near( pcm, hwParams, &setRate, NULL )' failed in 'src/hostapi/a
Jul 08 16:37:09 ProjectAliceDev snips-audio-server[2318]: Expression 'paUnanticipatedHostError' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Jul 08 16:37:09 ProjectAliceDev snips-audio-server[2318]: Expression 'PaAlsaStreamComponent_InitialConfigure( &self->playback, outParams, self->primeBuffers, hwParam
Jul 08 16:37:09 ProjectAliceDev snips-audio-server[2318]: Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer,
Jul 08 16:37:09 ProjectAliceDev snips-audio-server[2318]: ERROR:snips_audio_server_hermes  : could not play "3f637c9c-7fce-4b4c-80ad-2a56779719ba"
Jul 08 16:37:09 ProjectAliceDev snips-audio-server[2318]:  -> caused by: UnanticipatedHostError```
cpoisson commented 5 years ago

@Psychokiller1888, Totally

Look like PortAudio tripped on the carpet trying to guess the missing parameters to configure the CODEC of the sound card.

I see two ways proceed:

e.g.:

slave {
    pcm "hw:seeed2micvoicec"
    period_time 0
    period_size 1024
    buffer_size 4096
    rate 44100
}

You may want to tinker the values according to the piHAT2 capability. An incorrect buffer configuration can make the slave not working at all or deliver a stuttering sound. (I have not tested them)

Tell me if it helps!

cpoisson commented 5 years ago

I did some tests, for various sample size and channels (16k to 48k, 1 and 2 channels)

No issue found so far with the configuration on my side (the one patched with ipc_perm)

I'm using hermes/audioServer/<site_id>/playBytes/<sound_id> to test that.

e.g.

mosquitto_pub -h snips-home-base.local -t 'hermes/audioServer/living/playBytes/8jdksjfksd9' -f test.wav

I know that those piHAT can be a bit of a pain to configure tough, keep me posted on your results!

cpoisson commented 5 years ago

Ok,

I have the same issue when the sampling rate is exactly equal to 22050 (disappears when using --alsa_playback default)

Psychokiller1888 commented 5 years ago

What sampling? The audio file? SnipsSuperTTS get amazon polly and WaveNet get their audio file at 22050 so yes, they are 22050, where my boot sound is 16k and works sometimes. It wouldn't be a problem for me to change the audio sampling for amazon and wavenet, haven't spotted that.

alsa_playback default is that also the snips.toml config that does set it?

Psychokiller1888 commented 5 years ago

Other thing is, whenever I try to implement something that runs on pyaudio, let's say this https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/speech/cloud-client/transcribe_streaming.py

It works nicely as standalone. But as soon as Snips is running, I get errors like

    managers.ASRManager.onHotword(session)
  File "/home/pi/ProjectAlice/core/voice/ASRManager.py", line 55, in onHotword
    func()
  File "/home/pi/ProjectAlice/core/voice/GoogleASR.py", line 22, in onListen
    with MicrophoneStream(16000, 1600) as stream:
  File "/home/pi/ProjectAlice/core/voice/model/MicrophoneStream.py", line 29, in __enter__
    stream_callback=self._fill_buffer,
  File "/home/pi/ProjectAlice/venv/lib/python3.7/site-packages/pyaudio.py", line 750, in open
    stream = Stream(self, *args, **kwargs)
  File "/home/pi/ProjectAlice/venv/lib/python3.7/site-packages/pyaudio.py", line 441, in __init__
    self._stream = pa.open(**arguments)
OSError: [Errno -9996] Invalid input device (no default output device)

Or invalid channel numbers, or sample rate, whatever I try to change in my asound.conf

Which, to me, sounds like the dsnoop doesn't work when Snips is running. I can be wrong, I really really have difficulties with alsa configurations

cpoisson commented 5 years ago

More tests:

Using portaudio, it seems that explicitly configuring the ring buffer seems to solve the problem.

pcm.dmixed {
    type dmix
    slave {
        pcm "hw:seeed2micvoicec"
        period_time 0
        period_size 1024
        buffer_size 4096
    }
    ipc_key 555555
    ipc_perm 0666
}
cpoisson commented 5 years ago

Hum,

on my side,

I could test also with pyaudio, let me check your script.

cpoisson commented 5 years ago

@Psychokiller1888 about alsa_capture

In snips.toml as an option of the audio server section e.g. alsa_capture = "default" or as an option int the command line interface. e.g

sudo -u _snips snips-audio-server --alsa_capture "default" -v
cpoisson commented 5 years ago

Moar tests using this google mic transcription script

Same warnings (it uses pyaudio and thus portaudio), but it transcribes correctly what I'm saying (using the audio-server in parallel of course)

(venv) pi@snips-home-base:~/python-docs-samples/speech/microphone $ python transcribe_streaming_mic.py
Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924
Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.front.0:CARD=0'
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.bcm2835_alsa.pcm.surround51.0:CARD=0'
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.bcm2835_alsa.pcm.surround51.0:CARD=0'
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.bcm2835_alsa.pcm.surround40.0:CARD=0'
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.bcm2835_alsa.pcm.surround51.0:CARD=0'
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.bcm2835_alsa.pcm.surround51.0:CARD=0'
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.bcm2835_alsa.pcm.surround51.0:CARD=0'
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.bcm2835_alsa.pcm.surround71.0:CARD=0'
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.bcm2835_alsa.pcm.iec958.0:CARD=0,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.bcm2835_alsa.pcm.iec958.0:CARD=0,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.bcm2835_alsa.pcm.iec958.0:CARD=0,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
ALSA lib pcm_dmix.c:990:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
ALSA lib pcm_dsnoop.c:556:(snd_pcm_dsnoop_open) The dsnoop plugin supports only capture stream
ALSA lib pcm_dmix.c:990:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
ALSA lib pcm_dsnoop.c:556:(snd_pcm_dsnoop_open) The dsnoop plugin supports only capture stream
can you please transcribe what I'm saying right now thank you very much
cpoisson commented 5 years ago

Just in case here's my full asound.conf (used on a rpi3 + piHAT2)

# The IPC key of dmix or dsnoop plugin must be unique
# If 555555 or 666666 is used by other processes, use another one

# use samplerate to resample as speexdsp resample is bad
defaults.pcm.rate_converter "samplerate"

pcm.!default {
    type asym
    playback.pcm "playback"
    capture.pcm "capture"
}

pcm.playback {
    type plug
    slave.pcm "dmixed"
}

pcm.capture {
    type plug
    slave.pcm "array"
}

pcm.dmixed {
    type dmix
    slave {
        pcm "hw:seeed2micvoicec"
        period_time 0
        period_size 1024
        buffer_size 4096
    }
    ipc_key 555555
    ipc_perm 0666
}

pcm.array {
    type dsnoop
    slave {
        pcm "hw:seeed2micvoicec"
        channels 2
    }
    ipc_key 666666
    ipc_perm 0666
}
Psychokiller1888 commented 5 years ago

Hum.... Things seem to be moving forward, mixing all your hard work for a solution. I get a few errors now, but it's more on my script side. Will keep you posted! Thanks for your efforts by the way! Next time in Paris I'll buy you a beer ;)

Psychokiller1888 commented 5 years ago

Well... It somehow works, but not always... I have to stop on this, I simply don't get the alsa conf, I hate it and I'm pretty sure when Alice is out someone will play with those devices knowing how to conf them and share it back. Your asound somehow works, but sometimes doesn't capture, or sometime sounds are not played, the hotword has really bad time capturing etc etc. Thank you for all your efforts thought!

cpoisson commented 5 years ago

I'm closing this one. I have added the info in the other ticket related to audio issues.

By the way, we also just found out that you can reduce the cpu consumption of the audio-server by almost 3 by forcing the sampling rate of the microphone at 16000 Hz. (otherwise it is done by the audio-server)