snipsco / snips-issues

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

[Platform][Audio-Server] no sound through usb sound card (alsa) #194

Closed gitmirko closed 5 years ago

gitmirko commented 5 years ago

What's the issue? I'm not able to get sound from audio-server through the usb sound card. Alsa is configured properly, because I always get sound testing the speaker with this command:

pi@raspberrypi:~ $ speaker-test -c 2

speaker-test 1.1.3

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 96 to 262144
Period size range from 48 to 131072
Using max buffer size 262144
Periods = 4
was set period_size = 65536
was set buffer_size = 262144
 0 - Front Left
 1 - Front Right

How to reproduce In my case starting snips-audio-server with the following arguments will always give me the same problem:

sudo -u _snips snips-audio-server -v --alsa_playback default

Expected behavior There should be sound from the snips assistant played through the usb sound card.

Version and Environment Raspberry Pi 3B+ (slightly overclocked)

Raspbian GNU/Linux 9 \n \l
ii  snips-audio-server              0.63.3                            armhf        Snips Audio Server command line interface

Logs

[20:51:30.093645] ERROR:snips_audio_server_hermes  : could not play "7c9f71d9-4eab-4c57-a33b-e7a5efa99861"
 -> caused by: ALSA function 'snd_pcm_hw_params_set_rate' failed with error 'EINVAL: Invalid argument'

Workaround I have not found any workaround at this point.

cpoisson commented 5 years ago

Hi @gitmirko ,

Can you copy past the content of /etc/asound.conf and aplay -l? I also need the full logs of snips-audio-server and snips-watch -vvv when the issue occurs.

You can also check the workaround provided in #148 and the audio troubleshoot guide

gitmirko commented 5 years ago
pi@raspberrypi:~ $ cat /etc/asound.conf 
pcm.!default  {
  type hw
  card 2
}
ctl.!default {
  type hw
  card 2
}
pi@raspberrypi:~ $ 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 IEC958/HDMI [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: ALSA [bcm2835 ALSA], device 2: bcm2835 IEC958/HDMI1 [bcm2835 IEC958/HDMI1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Device [USB2.0 Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
pi@raspberrypi:~ $ snips-watch -vvv
[09:51:12] Watching on localhost:1883 (MQTT)
[09:52:04] [Hotword] detected on site default, for model hey_snips
[09:52:04] [Asr] was asked to stop listening on site default
[09:52:04] [Hotword] was asked to toggle itself 'off' on site default
[09:52:04] [Dialogue] session with id 'ecae0b4c-2e3a-43fa-a23e-19a017c8f2ae' was started on site default
[09:52:04] [AudioServer] was asked to play a wav of 41.1 kB with id '487a327b-9d91-485f-9a3f-e1336bb737e1' on site default
[09:52:19] [Dialogue] session with id 'ecae0b4c-2e3a-43fa-a23e-19a017c8f2ae' was ended on site default. The session was ended because one of the component didn't respond in a timely manner
[09:52:19] [Asr] was asked to stop listening on site default
[09:52:19] [Hotword] was asked to toggle itself 'on' on site default
pi@raspberrypi:~ $ sudo -u _snips snips-audio-server -v --alsa_playback default
[09:51:36.113391] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.bus -> Ok(None)
[09:51:36.113820] DEBUG:snips_common_cli::cli: conf lookup: snips-common.bus -> Ok(None)
[09:51:36.113963] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.mqtt -> Ok(None)
[09:51:36.114161] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mqtt -> Ok(None)
[09:51:36.114769] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.mqtt_username -> Ok(None)
[09:51:36.114992] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mqtt_username -> Ok(None)
[09:51:36.115317] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.mqtt_password -> Ok(None)
[09:51:36.115631] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mqtt_password -> Ok(None)
[09:51:36.115981] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.mqtt_tls_hostname -> Ok(None)
[09:51:36.116277] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mqtt_tls_hostname -> Ok(None)
[09:51:36.119541] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.alsa_playback -> Ok(None)
[09:51:36.119779] DEBUG:snips_common_cli::cli: conf lookup: snips-common.alsa_playback -> Ok(None)
[09:51:36.119927] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.frame -> Ok(None)
[09:51:36.120513] DEBUG:snips_common_cli::cli: conf lookup: snips-common.frame -> Ok(None)
[09:51:36.120808] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.nomike -> Ok(None)
[09:51:36.121126] DEBUG:snips_common_cli::cli: conf lookup: snips-common.nomike -> Ok(None)
[09:51:36.121306] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.mike -> Ok(None)
[09:51:36.121698] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mike -> Ok(None)
[09:51:36.122044] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.disable_capture -> Ok(None)
[09:51:36.122255] DEBUG:snips_common_cli::cli: conf lookup: snips-common.disable_capture -> Ok(None)
[09:51:36.122431] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.alsa_capture -> Ok(None)
[09:51:36.122802] DEBUG:snips_common_cli::cli: conf lookup: snips-common.alsa_capture -> Ok(None)
[09:51:36.122970] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.hijack -> Ok(None)
[09:51:36.123338] DEBUG:snips_common_cli::cli: conf lookup: snips-common.hijack -> Ok(None)
[09:51:36.123505] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.bind -> Ok(None)
[09:51:36.123914] DEBUG:snips_common_cli::cli: conf lookup: snips-common.bind -> Ok(None)
[09:51:36.124289] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.bind -> Ok(None)
[09:51:36.124523] DEBUG:snips_common_cli::cli: conf lookup: snips-common.bind -> Ok(None)
[09:51:36.124680] INFO :snips_audio_server_cli: Starting audio server on mqtt for site default
[09:51:36.125490] DEBUG:snips_audio_portaudio : Attempt 0
[09:51:36.125705] DEBUG:snips_audio_portaudio : Mike source capture started
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 pcm_dsnoop.c:618:(snd_pcm_dsnoop_open) unable to open slave
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 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
[09:51:36.208403] DEBUG:snips_audio_portaudio : Portaudio: Ok("PortAudio V19-devel (built Jul  9 2019 18:34:00)")
[09:51:36.208626] DEBUG:snips_audio_portaudio : Looking for default input device
[09:51:36.208734] INFO :snips_audio_portaudio : Use input device: "USB Camera-B4.09.24.1: Audio (hw:1,0)"
[09:51:36.208843] DEBUG:snips_audio_portaudio : Start capture: InputSettings { params: Parameters { device: Index(DeviceIndex(2)), channel_count: 1, suggested_latency: 0.0239375, is_interleaved: true, sample_format: PhantomData }, sample_rate: 16000.0, frames_per_buffer: 256, flags:  }
[09:51:36.223703] DEBUG:snips_audio_portaudio : start capture loop
[09:51:36.225728] DEBUG:snips_audio_portaudio : Attempt 1
[09:51:36.325866] DEBUG:snips_audio_portaudio : Attempt 2
[09:51:36.325973] DEBUG:snips_audio_portaudio : Mike initialization looking good
[09:51:36.326733] INFO :snips_broadcast_mqtt_server: Starting broadcasting audio on hermes for site "default"
[09:52:04.413102] ERROR:snips_audio_server_hermes  : could not play "487a327b-9d91-485f-9a3f-e1336bb737e1"
 -> caused by: ALSA function 'snd_pcm_hw_params_set_rate' failed with error 'EINVAL: Invalid argument'

Without --alsa_playback default

pi@raspberrypi:~ $ snips-watch -vvv
[09:55:21] Watching on localhost:1883 (MQTT)
[09:55:39] [Hotword] detected on site default, for model hey_snips
[09:55:39] [Asr] was asked to stop listening on site default
[09:55:39] [Hotword] was asked to toggle itself 'off' on site default
[09:55:39] [Dialogue] session with id 'e658e79c-44b5-48f0-89b3-934d88ab745a' was started on site default
[09:55:39] [AudioServer] was asked to play a wav of 41.1 kB with id '415d0971-9510-4662-adba-bc2bacbd2401' on site default
[09:55:54] [Dialogue] session with id 'e658e79c-44b5-48f0-89b3-934d88ab745a' was ended on site default. The session was ended because one of the component didn't respond in a timely manner
[09:55:54] [Asr] was asked to stop listening on site default
[09:55:54] [Hotword] was asked to toggle itself 'on' on site default
pi@raspberrypi:~ $ sudo -u _snips snips-audio-server -v
[09:55:24.297835] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.bus -> Ok(None)
[09:55:24.298166] DEBUG:snips_common_cli::cli: conf lookup: snips-common.bus -> Ok(None)
[09:55:24.298258] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.mqtt -> Ok(None)
[09:55:24.298337] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mqtt -> Ok(None)
[09:55:24.298688] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.mqtt_username -> Ok(None)
[09:55:24.299063] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mqtt_username -> Ok(None)
[09:55:24.299152] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.mqtt_password -> Ok(None)
[09:55:24.299268] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mqtt_password -> Ok(None)
[09:55:24.299444] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.mqtt_tls_hostname -> Ok(None)
[09:55:24.299683] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mqtt_tls_hostname -> Ok(None)
[09:55:24.302942] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.alsa_playback -> Ok(None)
[09:55:24.303103] DEBUG:snips_common_cli::cli: conf lookup: snips-common.alsa_playback -> Ok(None)
[09:55:24.303200] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.disable_playback -> Ok(None)
[09:55:24.303283] DEBUG:snips_common_cli::cli: conf lookup: snips-common.disable_playback -> Ok(None)
[09:55:24.303445] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.output -> Ok(None)
[09:55:24.303838] DEBUG:snips_common_cli::cli: conf lookup: snips-common.output -> Ok(None)
[09:55:24.303968] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.frame -> Ok(None)
[09:55:24.304292] DEBUG:snips_common_cli::cli: conf lookup: snips-common.frame -> Ok(None)
[09:55:24.304416] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.nomike -> Ok(None)
[09:55:24.304733] DEBUG:snips_common_cli::cli: conf lookup: snips-common.nomike -> Ok(None)
[09:55:24.304852] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.mike -> Ok(None)
[09:55:24.305019] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mike -> Ok(None)
[09:55:24.305376] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.disable_capture -> Ok(None)
[09:55:24.305464] DEBUG:snips_common_cli::cli: conf lookup: snips-common.disable_capture -> Ok(None)
[09:55:24.305585] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.alsa_capture -> Ok(None)
[09:55:24.305740] DEBUG:snips_common_cli::cli: conf lookup: snips-common.alsa_capture -> Ok(None)
[09:55:24.305980] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.hijack -> Ok(None)
[09:55:24.306226] DEBUG:snips_common_cli::cli: conf lookup: snips-common.hijack -> Ok(None)
[09:55:24.306347] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.bind -> Ok(None)
[09:55:24.306600] DEBUG:snips_common_cli::cli: conf lookup: snips-common.bind -> Ok(None)
[09:55:24.306776] DEBUG:snips_common_cli::cli: conf lookup: snips-audio-server.bind -> Ok(None)
[09:55:24.306856] DEBUG:snips_common_cli::cli: conf lookup: snips-common.bind -> Ok(None)
[09:55:24.307011] INFO :snips_audio_server_cli: Starting audio server on mqtt for site default
[09:55:24.307377] DEBUG:snips_audio_portaudio : Attempt 0
[09:55:24.307538] DEBUG:snips_audio_portaudio : Mike source capture started
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 pcm_dsnoop.c:618:(snd_pcm_dsnoop_open) unable to open slave
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 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
[09:55:24.360349] DEBUG:snips_audio_portaudio : Portaudio: Ok("PortAudio V19-devel (built Jul  9 2019 18:34:00)")
[09:55:24.360439] DEBUG:snips_audio_portaudio : Looking for default input device
[09:55:24.360465] INFO :snips_audio_portaudio : Use input device: "USB Camera-B4.09.24.1: Audio (hw:1,0)"
[09:55:24.360491] DEBUG:snips_audio_portaudio : Start capture: InputSettings { params: Parameters { device: Index(DeviceIndex(2)), channel_count: 1, suggested_latency: 0.0239375, is_interleaved: true, sample_format: PhantomData }, sample_rate: 16000.0, frames_per_buffer: 256, flags:  }
[09:55:24.365685] DEBUG:snips_audio_portaudio : start capture loop
[09:55:24.407520] DEBUG:snips_audio_portaudio : Attempt 1
[09:55:24.407609] DEBUG:snips_audio_portaudio : Mike initialization looking good
[09:55:24.408083] INFO :snips_broadcast_mqtt_server: Starting broadcasting audio on hermes for site "default"
[09:55:39.858004] INFO :snips_audio_portaudio      : Playing "415d0971-9510-4662-adba-bc2bacbd2401" using output "default", wav spec: WavSpec { channels: 2, sample_rate: 22050, bits_per_sample: 16, sample_format: Int }
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2043
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->playback, outParams, self->primeBuffers, hwParamsPlayback, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2717
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2838
thread 'portaudio.player' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', src/libcore/result.rs:999:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[09:55:39.859008] ERROR:snips_audio_server_hermes  : could not play "415d0971-9510-4662-adba-bc2bacbd2401"
 -> caused by: InvalidSampleRate
gitmirko commented 5 years ago

You can also check the workaround provided in #148 and the audio troubleshoot guide

Unfortunately I wasn't able to get it working with my setup.

cpoisson commented 5 years ago

Hum,

it looks like a tricky issue with the sound card not supporting the default settings provided by alsa 🤔

Did you tried with another sound card? Do you also have issues playing sound using aplay?

e.g.

sudo -u _snips aplay /usr/share/snips/assistant/custom_dialogue/sound/start_of_input.wav

You can also try to set them manually (buffer_size, period_size, channels, rate)

Can you try this asound.conf, and use --alsa_capture default and --alsa_playback default

# 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:2,0"
        period_time 0
        channels 2 # you may play with this value depending on your sound card
        period_size 1024 # you may play with this value depending on your sound card
        buffer_size 4096 # you may play with this value depending on your sound card
        rate 48000
    }
    ipc_key 555555
    ipc_perm 0666 # allow all users to use the dmix interface
}

pcm.array {
    type dsnoop
    slave {
        pcm "hw:2,0"
        channels 2
    }
    ipc_key 666666
    ipc_perm 0666 # allow all users to use the dsnoop interface
}
gitmirko commented 5 years ago

With my original config:

pi@raspberrypi:~ $ sudo -u _snips aplay /usr/share/snips/assistant/custom_dialogue/sound/start_of_input.wav
Playing WAVE '/usr/share/snips/assistant/custom_dialogue/sound/start_of_input.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo
Warning: rate is not accurate (requested = 22050Hz, got = 48000Hz)
         please, try the plug plugin (-Dplug:default)

After adding -Dplug:default to the command the file is played with sound through the usb card:

pi@raspberrypi:~ $ sudo -u _snips aplay /usr/share/snips/assistant/custom_dialogue/sound/start_of_input.wav -Dplug:default
Playing WAVE '/usr/share/snips/assistant/custom_dialogue/sound/start_of_input.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo

After applying your suggested config:

pi@raspberrypi:~ $ sudo -u _snips aplay /usr/share/snips/assistant/custom_dialogue/sound/start_of_input.wav
Playing WAVE '/usr/share/snips/assistant/custom_dialogue/sound/start_of_input.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo
ALSA lib dlmisc.c:254:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_rate_samplerate.so
ALSA lib pcm_rate.c:1362:(snd_pcm_rate_open) Cannot find rate converter
aplay: set_params:1363: Unable to install hw params:
ACCESS:  RW_INTERLEAVED
FORMAT:  S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: 22050
PERIOD_TIME: (21333 21334)
PERIOD_SIZE: (470 471)
PERIOD_BYTES: (1880 1884)
PERIODS: (3 5)
BUFFER_TIME: (85306 85307)
BUFFER_SIZE: 1881
BUFFER_BYTES: 7524
TICK_TIME: 0
cpoisson commented 5 years ago

this one interesting 🤔

ALSA lib dlmisc.c:254:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_rate_samplerate.so
ALSA lib pcm_rate.c:1362:(snd_pcm_rate_open) Cannot find rate converter

I already had strange issues when some libasound packages where missing on my pi

Is libasound2-plugins installed on your system? This package seems to bring the shared library stated as missing.

gitmirko commented 5 years ago

OK, now after installing the libasound2-plugins package and editing your suggested asound.conf (without the capture part) aplay and snips-audio-server now output sound.

There is still a difference when playing through aplay instead of the output from snips-audio-server: with snips-audio-server there is a pop noise before every file played. With aplay there is no such annoying sound.

Is there anything I can tune?

cpoisson commented 5 years ago

I noticed that as well, I did not had the time yet to figure out a solution.

It is worth to have a look on those forums I guess. It seems to be a pretty common issue.

But what you said about aplay makes me wonder why the pop noise does not happen in this case 🤔

cpoisson commented 5 years ago

Hum, after some tests,

My sound card (piHAT) seems to turn off the output after 5 seconds but the plop issue is not related to that.

The problem can easily be reproduced when trying to play a sound produced by pico tts using the audio server.

The occurrence of the issue seems to drop when switching back to portaudio backend for playback.

You can try to remove the alsa_playback = "default" from the [snips-audio-server] section of your configuration file (/etc/snips.toml)

I'll open an issue to document that to other users.

Please note that on the next release, alsa backend will be used as default for playback (due to other portaudio issue when playing sound sampled at 22050Hz), the option will then then be portaudio_playback = "default"

gitmirko commented 5 years ago

Thank you very much @cpoisson. Now everything is working as expected.

It was a pleasure working with you on this issue.

Best regards Mirko

cpoisson commented 5 years ago

Ah thanks! ;) Enjoy snips!

cpoisson commented 5 years ago

@gitmirko I think I found the reason of the pop/click

This item in the configuration may be the culprit

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

I removed the resampling, it seems ok now.

cpoisson commented 5 years ago

This doc is worth reading about this https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture#High_quality_resampling