[mythtv-users] Razzy/Tinny audio

Daryl McDonald darylangela at gmail.com
Fri May 9 14:48:08 UTC 2014


On Fri, May 9, 2014 at 3:29 AM, Stephen Worthington
<stephen_agent at jsw.gen.nz> wrote:
> On Thu, 8 May 2014 23:59:10 -0400, you wrote:
>
>>On Thu, May 8, 2014 at 9:45 PM, Stephen Worthington
>><stephen_agent at jsw.gen.nz> wrote:
>>> On Thu, 8 May 2014 12:44:23 -0400, you wrote:
>>>
>>>>Greetings Mythizens, as the subject implies I'm looking into
>>>>distortion from recordings on my analog card.
>>>>"http://www.mythtv.org/wiki/Hauppauge_PVR-150" this wiki suggests
>>>>adding a line to my change-channel.sh, like so: "sleep 5; v4l2-ctl
>>>>--set-audio-input 1 -d /dev/video0 > /dev/null 2>&1" . Before
>>>>implementing this solution, I'd like to confirm that since my UDEV
>>>>rule names the card "/dev/videoPVR150" then the added line of script
>>>>should reflect this change thusly?  "sleep 5; v4l2-ctl
>>>>--set-audio-input 1 -d /dev/videoPVR150 > /dev/null 2>&1" . Should
>>>>anything else be changed? The digital cards sound good and the analog
>>>>card has sounded good before, which is why I'm going for this idea
>>>>first.   TIA, Daryl
>>>
>>> This problem seems to be caused by mixing of audio from other sources
>>> on the card.  I have this problem with my PVR-500 (dual PVR-150).  It
>>> happens randomly at the start of using the card for a recording, and I
>>> have never been sure what the cause was, but the drivers have never
>>> been patched to fix it.  The fix you found does work, but what you
>>> need to do depends on what you are using your PVR-150 for.  If you are
>>> using it to tune to an analogue TV channel, then that fix is the right
>>> one.  If, like me, you are using its S-Video or composite video inputs
>>> to interface to an STB, then the fix is more complex.  In the latter
>>> case, you also need a command (v4l2-ctl -f <freq>) to tune the TV
>>> receiver to a frequency that is currently not in use by a signal it
>>> can receive.  This is to ensure that the TV audio does not get mixed
>>> into the S-Video connection's audio.
>>>
>>> This is what I have in my ivtv_audio_fix.sh file that I run from my
>>> channel change script:
>>>
>>> #!/bin/sh
>>>
>>> # Workaround for bug which causes audio distortion on some recordings.
>>> # From http://urlgrey.net/?p=231
>>>
>>> sleep 3
>>>
>>> if [ $# -eq 0 ]; then
>>>     device=/dev/video0
>>> else
>>>     device=$1
>>> fi
>>>
>>> # First, set the audio input in turn to each of the unwanted audio
>>> inputs.
>>> # This only became necessary as of Mythbuntu 12.04.
>>> v4l2-ctl -d$device --set-audio-input=2
>>> v4l2-ctl -d$device --set-audio-input=0
>>>
>>> # Next, also set the tuner frequency.  This also seems to be necessary
>>> # since Mythbuntu 12.04 to suppress a slightly different audio
>>> distortion.
>>> # The frequency should be for an unused part of the spectrum, as the
>>> unwanted
>>> # audio is coming from whatever the TV tuner is tuned to.
>>> v4l2-ctl -d$device -f 420
>>>
>>> # Reset the audio input to source 1 (the wanted input).
>>> v4l2-ctl -d$device --set-audio-input=1
>>>
>>>
>>> And this is my channel change script (change-channel-skynz.sh):
>>>
>>> #!/bin/sh
>>>
>>> REMOTE_NAME=Pace_RC-30
>>> cmd="$1"
>>>
>>> # If things work OK with sleep 1, try this for faster channel changes:
>>> # sleep 0.3
>>> sleep_amt=1.0
>>>
>>> # See if this helps with missing digits at the start of a channel
>>> change.
>>> sleep 1.0
>>>
>>> #echo Change channel: $cmd >>/tmp/irsend.txt
>>>
>>> case $cmd in
>>>     [0-9]*)
>>>     # make sure we unmute by hitting vol up
>>>     #/usr/bin/irsend SEND_ONCE $REMOTE_NAME Vol+
>>>     #sleep $sleep_amt
>>>     for digit in $(echo $1 | sed -e 's/./& /g'); do
>>>             #echo irsend SEND_ONCE $REMOTE_NAME $digit
>>>>>/tmp/irsend.txt
>>>         /usr/bin/irsend SEND_ONCE $REMOTE_NAME $digit
>>>         sleep $sleep_amt
>>>     done
>>>     ;;
>>>
>>>     *)
>>>         /usr/bin/irsend SEND_ONCE $REMOTE_NAME $cmd
>>>         ;;
>>> esac
>>>
>>>
>>> # Workaround for bug which causes audio distortion on some recordings.
>>> /usr/local/bin/ivtv_audio_fix.sh &
>>> _______________________________________________
>>> mythtv-users mailing list
>>> mythtv-users at mythtv.org
>>> http://www.mythtv.org/mailman/listinfo/mythtv-users
>>> http://wiki.mythtv.org/Mailing_List_etiquette
>>> MythTV Forums: https://forum.mythtv.org
>>
>>Thanks Stephen, I use my PVR 150 to record from an analog STB
>>connected via RCA jacks, this card has apparently has five possible
>>input connections, one "tuner" via coax and two each of "component"
>>and "S-video". To leave my system connected as is, I would need to
>>create a new " ivtv_audio_fix.sh" file like yours, but change the name
>>of the tuner card appropriately and modify my "change-channel.sh" as
>>outlined in the original post? Or, maybe more simply, change the input
>>connection to "tuner" over coax and add the one line to my
>>"change-channel.sh"? with the first solution, I must need one more
>>line in the "change-channel.sh" to call the new "ivtv_audio_fix.sh"
>>script, right? But I'm not sure where to put it.
>>Daryl
>
> Create the ivtv_audio_fix.sh file (I have mine in /usr/local/bin where
> my change-channel-skynz.sh script is).  Then if your existing channel
> change script works at all like mine, you can just add these two lines
> at the end of it:
>
> # Workaround for bug which causes audio distortion on some recordings.
> /usr/local/bin/ivtv_audio_fix.sh /dev/videoPVR150 &
>
> What that does is to run the ivtv_audio_fix.sh script as a separate
> independent job (that is what & does).  The channel change script can
> finish and that lets MythTV know that the channel change has been
> done.  The ivtv_audio_fix.sh script will do its sleep while MythTV
> records for the sleep time (you will hear the tinny sound for the
> first few seconds of the recording, if it happened for that
> recording), then the script will wake up and do its fix.  The fix has
> to be done after all the recording startup work that MythTV does - if
> it is done too early it does not work as the v4l commands sent by
> MythTV override it.  When the ivtv_audio_fix.sh script has done its
> v4l commands it will just stop without reporting back to the script
> that called it (which finished several seconds before).
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://www.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org

Hopefully I'm not over-reading this, what I did is create the
ivtv_audio_fix.sh file in /usr/local/bin, and I changed (near the top)
"device=/dev/video0" to "devive=/dev/videopvr150" and then added the
two lines to the end of my "change-channel.sh" exactly as yours is
(without the /dev/videoPVR150) [my uDev rule uses lower case pvr, my
bad] . This preceding issue is at the heart of my original question;
am I correct or wrong in assuming that the new name created by my uDev
rule should be reflected in the "ivtv_audio_fix.sh" script?  Thanks
again  Daryl


More information about the mythtv-users mailing list