[mythtv-users] Audio prealloc for mythfrontend

Stephen Worthington stephen_agent at jsw.gen.nz
Sat Jan 18 02:35:02 UTC 2020


I saw a message on the developers list that mentioned the audio
prealloc setting needed for mythfrontend.  You see messages like this
in your mythfrontend.log file:

Dec  7 00:37:02 mypvr mythfrontend.real: mythfrontend[3853]: W
CoreContext audio/audiooutputalsa.cpp:244 (IncPreallocBufferSize)
ALSA: Try to manually increase audio buffer with: echo 192 | sudo tee
/proc/asound/card0/pcm0p/sub0/prealloc

So I checked the setting I was using on my laptop in my rc.local file
and something had changed since I last checked and it was the wrong
value.  This is annoying as it will happen from time to time as you
use different audio devices.  And possibly if the name of the audio
device changes due to new hardware being installed or kernel updates.
So I have written myself a script that will check the settings and
adjust automatically when they change.  If anyone else would like to
try it, I have put it on my web server:

http://www.jsw.gen.nz/mythtv/audio-prealloc.sh

On Ubuntu systems, you can download and install it by running this:

sudo su
cd /usr/local/bin
wget http://www.jsw.gen.nz/mythtv/audio-prealloc.sh
chmod u=rwx,g=rx,o=rx audio-prealloc.sh
exit

Please consider this to be beta software - I have tested it on my
MythTV systems and it works there, but there may be bugs still. Please
let me know if it works for you, or if not, then please let me know
about that too.

Ideally, the script should be run just before mythfrontend runs, but
that is too difficult so I have just set it up as a line in my
rc.local file so that it will be run on every boot:

/usr/local/bin/audio-prealloc.sh &

It could also be run from systemd.

That should be sufficient in most cases, but if you do something like
plugging in an external monitor and switching the audio from the
builtin sound card output to the monitor's HDMI audio, then you should
run mythfrontend and play a recording for a second or two, then run
the script manually:

sudo audio-prealloc.sh

Then restart mythfrontend.


More information about the mythtv-users mailing list