[raspberry-vi] Fw: RPI gravelly speech and pcaudiolib results

  • From: "K0LNY_Glenn" <glenn@ervin.email>
  • To: <raspberry-vi@xxxxxxxxxxxxx>
  • Date: Wed, 2 Mar 2022 14:57:07 -0600

Hi, thought some here would appreciate this:

----- Original Message ----- 
From: "Kirk Reiser" <kirk@xxxxxxxxxx>
To: <speakup@xxxxxxxxxxxxxxxxx>
Sent: Wednesday, March 02, 2022 2:45 PM
Subject: RPI gravelly speech and pcaudiolib results


Hi folks: Brandon McGinty and I have been poking around attempting to
fix the gravelly voice on Raspberry PI machines. The effect shows up
on both the 32-bit and 64-bit systems.

It took a bit of experimenting to find what I believe is the correct
fix. The problem appears to be the standard buffer size being handed
off to the audio subsystem finishes playing more quickly on the PIs
causing the speech to not sound smooth giving a gravelly speech
output. In the new espeak-ng and libespeak-ng this is handled by
pcaudiolib instead of port-audio under the older espeak package.

To fix the problem you have to hand over larger buffer of sound to
smooth out the effect. The lines in question are line 103 in
pcaudiolib/src/alsa.c and line 83 in pcaudiolib/src/pulseaudio.c. The
default lines each end with dividing by 1000. I first tried just
removing the / 1000 which smoothed out the speech very nicely but
caused the buffers to be large enough that moving between lines and
words in review mode to have an extremely sluggish response because
the buffer wouldn't flush until it finished speaking it. So I put the
/ 1000 back in and started reducing the value to find the result that
would provide smooth speech but still maintain responsiveness with the
review functions of speakup. What I found worked fairly well was a
division value of 200 which seemed to increase the buffer sizes enough
to give smooth speech and keep the quick feel of moving around.

If you are experiencing gravelly speech I'd appreciate it if you would
try the above changes to see if it resolves the problem. You want to
edit 1000 to 200 on lines 102 of alsa.c and line 83 of pulseaudio.c in
pcaudiolib/src and then recompile. Different distros seem to put their
libraries in various weird and wonderful places so be a tad careful
wheninstalling the new libpcaudio libraries and symlinks. Even the RPI
32-bit and RPI 64-bit stash their libraries in different places.

I hope this helps some folks.

  Kirk


=========================================================== 
The raspberry-vi mailing list 
Archives: //www.freelists.org/archives/raspberry-vi
Administrative contact: <mike.ray@xxxxxxxxxxxxxx>
-----------------------------------------------------------
Raspberry Pi and the Raspberry Pi logo are trademarks of the Raspberry Pi 
Foundation.

This list is not affiliated to the Raspberry Pi Foundation and the views and 
attitudes expressed by the subscribers to this list do not reflect those of the 
Foundation.

Mike Ray, list creator, January 2013

Other related posts:

  • » [raspberry-vi] Fw: RPI gravelly speech and pcaudiolib results - K0LNY_Glenn