lost
Posts: 28
Joined: Tue Dec 05, 2017 9:38 am

Sound & latest updates...

Sat Jun 01, 2019 9:37 am

Hello,
Updated my PI3B minimalist Raspbian install (mainly running Domoticz for home automation) 2 days ago & now, espeak does not output sound on jack anymore. This output is still my default one, no change.
As well, aplay works. Even espeak with --stdout flag piped in aplay works (my current workaround).
I suspect some rate conversion problem:

Direct call (screaming about PCM cards was already there before but at least sound output worked):

Code: Select all

$ espeak "hello"
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 pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.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 pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
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
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
connect(2) call to /tmp/jack-1001/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->playback, outParams, self->primeBuffers, hwParamsPlayback, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2722
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
wave_open_sound > Pa_OpenStream : err=-9997 (Invalid sample rate)
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->playback, outParams, self->primeBuffers, hwParamsPlayback, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2722
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->playback, outParams, self->primeBuffers, hwParamsPlayback, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2722
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
wave_open_sound > Pa_OpenStream : err=-9997 (Invalid sample rate)
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->playback, outParams, self->primeBuffers, hwParamsPlayback, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2722
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->playback, outParams, self->primeBuffers, hwParamsPlayback, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2722
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
wave_open_sound > Pa_OpenStream : err=-9997 (Invalid sample rate)
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->playback, outParams, self->primeBuffers, hwParamsPlayback, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2722
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->playback, outParams, self->primeBuffers, hwParamsPlayback, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2722
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
wave_open_sound > Pa_OpenStream : err=-9997 (Invalid sample rate)
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->playback, outParams, self->primeBuffers, hwParamsPlayback, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2722
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
=> No sound with latest updates...

Using aplay:

Code: Select all

$ espeak --stdout "hello" | aplay
Lecture WAVE 'stdin' : Signed 16 bit Little Endian, Fréquence 22050 Hz, Mono
=> Sound works.

Somme 22->48kHz conversion issue when aplay does not sit in the middle? My kernel: 4.19.42-v7+ #1219 SMP Tue May 14 21:20:58 BST 2019 armv7l GNU/Linux

Regards.

SakanaSan
Posts: 1
Joined: Wed Jul 17, 2019 9:09 pm

Re: Sound & latest updates...

Wed Jul 17, 2019 9:23 pm

Hi lost,

Just some guess work here,

I'm working at Snips, we had many makers having issues with our audio-server since the kernel upgrade from 4.14 to 4.19
You can check the issue here https://github.com/snipsco/snips-issues/issues/148

We still don't understand the root cause of this problem but here's what we know.

The program your are using is using portaudio, for some reason when the play back interface of the audio device you are using is set to a rate of 16000 Hz, when a file sampled at 22050 Hz is played, portaudio crash with the logs you posted here.

The issue seems to lie between portaudio and its usage of alsa. We could reproduce this issue using portaudio test code samples alone on multiple sound cards.

Check your sound configuration , you may be able to set your audio sound card playback interface rate at another value than 16000 Hz.

lost
Posts: 28
Joined: Tue Dec 05, 2017 9:38 am

Re: Sound & latest updates...

Tue Jul 30, 2019 3:43 pm

Hi,
SakanaSan wrote:
Wed Jul 17, 2019 9:23 pm
Check your sound configuration , you may be able to set your audio sound card playback interface rate at another value than 16000 Hz.
There is no /etc/asound.conf on my system. On my side, I'm just using the PI3 jack output for speech synthesis. Testing with :
speaker-test -r 22050 or 16000 sound is output in both cases.

Regards.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23647
Joined: Sat Jul 30, 2011 7:41 pm

Re: Sound & latest updates...

Tue Jul 30, 2019 4:05 pm

Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

laloshifrin
Posts: 7
Joined: Tue Jul 30, 2019 10:41 pm

Re: Sound & latest updates...

Tue Jul 30, 2019 10:55 pm

Got great inpiration from link posted by Sakanasan.
As someone else said before the problem is not espeak but is portaudio-alsa related.
The working workaround tested (at least with my Zero W) with two 4.19 kernels is adding this environment variable:
PA_ALSA_PLUGHW=1
espeak still complains:
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
but audio works.
I also have a 3 B+ but I will leave his 4.14 alone at the moment. :)
Thanks

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23647
Joined: Sat Jul 30, 2011 7:41 pm

Re: Sound & latest updates...

Wed Jul 31, 2019 9:40 am

There's also a recently introduced issue with analogue audio - see here https://github.com/raspberrypi/firmware/issues/1214
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

hippy
Posts: 5943
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Sound & latest updates...

Wed Jul 31, 2019 12:23 pm

laloshifrin wrote:
Tue Jul 30, 2019 10:55 pm
The working workaround tested (at least with my Zero W) with two 4.19 kernels is adding this environment variable:
PA_ALSA_PLUGHW=1
That doesn't work for me on my Pi 3B (4.19.58-v7+) even after the latest (today's, 2019-07-31) update, upgrade and reboot.

In fact, with aplay /usr/share/sounds/alsa/Front_Center.wav, whether a result of this last upgrade or otherwise, as well as getting truncation, "Front Cen", I am sometimes losing the start as well, "Cen", and am now fairly regularly getting bizarre "Cen Front Cen".

It all feels to me like something has gone very wrong with buffering somewhere.

My Python code which shells out for an espeak "My IP address is x.x.x.x" --stdout | aplay is also dropping the start of that when it was previously working, though so far it seems only immediately after a reboot, and not always.

laloshifrin
Posts: 7
Joined: Tue Jul 30, 2019 10:41 pm

Re: Sound & latest updates...

Wed Jul 31, 2019 1:49 pm

My Raspberry didn't suffer from your issue. My problem was exactly the same as lost's. Try to play audio with other applications (mpg123, audaciuos). It could not be related to portaudio as in my case.

ATRedline
Posts: 6
Joined: Wed Aug 21, 2019 3:55 pm

Re: Sound & latest updates...

Wed Aug 21, 2019 6:55 pm

laloshifrin wrote:
Tue Jul 30, 2019 10:55 pm
The working workaround tested (at least with my Zero W) with two 4.19 kernels is adding this environment variable:
PA_ALSA_PLUGHW=1
Hi, i tryed it, sound appear, but with noises. I mean, when i use 'espeak "HelloWorld" --stdout |aplay' - sound is clear, but when i use 'espeak "HelloWorld" ' - sound with noises, and multiple errors in terminal.
Because of errors in terminal - i cant use Python pyttsx3 module (i'm need espeak only because of it)
Is there any other ways to fix it?

Return to “Raspbian”