<div dir="ltr"><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 9, 2014 at 12:41 PM, Daryl McDonald <span dir="ltr">&lt;<a href="mailto:darylangela@gmail.com" target="_blank">darylangela@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">On Fri, May 9, 2014 at 11:47 AM, Stephen Worthington<br>
<div><div class="h5">&lt;<a href="mailto:stephen_agent@jsw.gen.nz">stephen_agent@jsw.gen.nz</a>&gt; wrote:<br>
&gt; On Fri, 9 May 2014 10:48:08 -0400, you wrote:<br>
&gt;<br>
&gt;&gt;On Fri, May 9, 2014 at 3:29 AM, Stephen Worthington<br>
&gt;&gt;&lt;<a href="mailto:stephen_agent@jsw.gen.nz">stephen_agent@jsw.gen.nz</a>&gt; wrote:<br>
&gt;&gt;&gt; On Thu, 8 May 2014 23:59:10 -0400, you wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;On Thu, May 8, 2014 at 9:45 PM, Stephen Worthington<br>
&gt;&gt;&gt;&gt;&lt;<a href="mailto:stephen_agent@jsw.gen.nz">stephen_agent@jsw.gen.nz</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt;&gt; On Thu, 8 May 2014 12:44:23 -0400, you wrote:<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;Greetings Mythizens, as the subject implies I&#39;m looking into<br>
&gt;&gt;&gt;&gt;&gt;&gt;distortion from recordings on my analog card.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&quot;<a href="http://www.mythtv.org/wiki/Hauppauge_PVR-150" target="_blank">http://www.mythtv.org/wiki/Hauppauge_PVR-150</a>&quot; this wiki suggests<br>
&gt;&gt;&gt;&gt;&gt;&gt;adding a line to my change-channel.sh, like so: &quot;sleep 5; v4l2-ctl<br>
&gt;&gt;&gt;&gt;&gt;&gt;--set-audio-input 1 -d /dev/video0 &gt; /dev/null 2&gt;&amp;1&quot; . Before<br>
&gt;&gt;&gt;&gt;&gt;&gt;implementing this solution, I&#39;d like to confirm that since my UDEV<br>
&gt;&gt;&gt;&gt;&gt;&gt;rule names the card &quot;/dev/videoPVR150&quot; then the added line of script<br>
&gt;&gt;&gt;&gt;&gt;&gt;should reflect this change thusly?  &quot;sleep 5; v4l2-ctl<br>
&gt;&gt;&gt;&gt;&gt;&gt;--set-audio-input 1 -d /dev/videoPVR150 &gt; /dev/null 2&gt;&amp;1&quot; . Should<br>
&gt;&gt;&gt;&gt;&gt;&gt;anything else be changed? The digital cards sound good and the analog<br>
&gt;&gt;&gt;&gt;&gt;&gt;card has sounded good before, which is why I&#39;m going for this idea<br>
&gt;&gt;&gt;&gt;&gt;&gt;first.   TIA, Daryl<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; This problem seems to be caused by mixing of audio from other sources<br>
&gt;&gt;&gt;&gt;&gt; on the card.  I have this problem with my PVR-500 (dual PVR-150).  It<br>
&gt;&gt;&gt;&gt;&gt; happens randomly at the start of using the card for a recording, and I<br>
&gt;&gt;&gt;&gt;&gt; have never been sure what the cause was, but the drivers have never<br>
&gt;&gt;&gt;&gt;&gt; been patched to fix it.  The fix you found does work, but what you<br>
&gt;&gt;&gt;&gt;&gt; need to do depends on what you are using your PVR-150 for.  If you are<br>
&gt;&gt;&gt;&gt;&gt; using it to tune to an analogue TV channel, then that fix is the right<br>
&gt;&gt;&gt;&gt;&gt; one.  If, like me, you are using its S-Video or composite video inputs<br>
&gt;&gt;&gt;&gt;&gt; to interface to an STB, then the fix is more complex.  In the latter<br>
&gt;&gt;&gt;&gt;&gt; case, you also need a command (v4l2-ctl -f &lt;freq&gt;) to tune the TV<br>
&gt;&gt;&gt;&gt;&gt; receiver to a frequency that is currently not in use by a signal it<br>
&gt;&gt;&gt;&gt;&gt; can receive.  This is to ensure that the TV audio does not get mixed<br>
&gt;&gt;&gt;&gt;&gt; into the S-Video connection&#39;s audio.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; This is what I have in my ivtv_audio_fix.sh file that I run from my<br>
&gt;&gt;&gt;&gt;&gt; channel change script:<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; #!/bin/sh<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; # Workaround for bug which causes audio distortion on some recordings.<br>
&gt;&gt;&gt;&gt;&gt; # From <a href="http://urlgrey.net/?p=231" target="_blank">http://urlgrey.net/?p=231</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; sleep 3<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; if [ $# -eq 0 ]; then<br>
&gt;&gt;&gt;&gt;&gt;     device=/dev/video0<br>
&gt;&gt;&gt;&gt;&gt; else<br>
&gt;&gt;&gt;&gt;&gt;     device=$1<br>
&gt;&gt;&gt;&gt;&gt; fi<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; # First, set the audio input in turn to each of the unwanted audio<br>
&gt;&gt;&gt;&gt;&gt; inputs.<br>
&gt;&gt;&gt;&gt;&gt; # This only became necessary as of Mythbuntu 12.04.<br>
&gt;&gt;&gt;&gt;&gt; v4l2-ctl -d$device --set-audio-input=2<br>
&gt;&gt;&gt;&gt;&gt; v4l2-ctl -d$device --set-audio-input=0<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; # Next, also set the tuner frequency.  This also seems to be necessary<br>
&gt;&gt;&gt;&gt;&gt; # since Mythbuntu 12.04 to suppress a slightly different audio<br>
&gt;&gt;&gt;&gt;&gt; distortion.<br>
&gt;&gt;&gt;&gt;&gt; # The frequency should be for an unused part of the spectrum, as the<br>
&gt;&gt;&gt;&gt;&gt; unwanted<br>
&gt;&gt;&gt;&gt;&gt; # audio is coming from whatever the TV tuner is tuned to.<br>
&gt;&gt;&gt;&gt;&gt; v4l2-ctl -d$device -f 420<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; # Reset the audio input to source 1 (the wanted input).<br>
&gt;&gt;&gt;&gt;&gt; v4l2-ctl -d$device --set-audio-input=1<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; And this is my channel change script (change-channel-skynz.sh):<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; #!/bin/sh<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; REMOTE_NAME=Pace_RC-30<br>
&gt;&gt;&gt;&gt;&gt; cmd=&quot;$1&quot;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; # If things work OK with sleep 1, try this for faster channel changes:<br>
&gt;&gt;&gt;&gt;&gt; # sleep 0.3<br>
&gt;&gt;&gt;&gt;&gt; sleep_amt=1.0<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; # See if this helps with missing digits at the start of a channel<br>
&gt;&gt;&gt;&gt;&gt; change.<br>
&gt;&gt;&gt;&gt;&gt; sleep 1.0<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; #echo Change channel: $cmd &gt;&gt;/tmp/irsend.txt<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; case $cmd in<br>
&gt;&gt;&gt;&gt;&gt;     [0-9]*)<br>
&gt;&gt;&gt;&gt;&gt;     # make sure we unmute by hitting vol up<br>
&gt;&gt;&gt;&gt;&gt;     #/usr/bin/irsend SEND_ONCE $REMOTE_NAME Vol+<br>
&gt;&gt;&gt;&gt;&gt;     #sleep $sleep_amt<br>
&gt;&gt;&gt;&gt;&gt;     for digit in $(echo $1 | sed -e &#39;s/./&amp; /g&#39;); do<br>
&gt;&gt;&gt;&gt;&gt;             #echo irsend SEND_ONCE $REMOTE_NAME $digit<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;/tmp/irsend.txt<br>
&gt;&gt;&gt;&gt;&gt;         /usr/bin/irsend SEND_ONCE $REMOTE_NAME $digit<br>
&gt;&gt;&gt;&gt;&gt;         sleep $sleep_amt<br>
&gt;&gt;&gt;&gt;&gt;     done<br>
&gt;&gt;&gt;&gt;&gt;     ;;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;     *)<br>
&gt;&gt;&gt;&gt;&gt;         /usr/bin/irsend SEND_ONCE $REMOTE_NAME $cmd<br>
&gt;&gt;&gt;&gt;&gt;         ;;<br>
&gt;&gt;&gt;&gt;&gt; esac<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; # Workaround for bug which causes audio distortion on some recordings.<br>
&gt;&gt;&gt;&gt;&gt; /usr/local/bin/ivtv_audio_fix.sh &amp;<br>
&gt;&gt;&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt;&gt;&gt; mythtv-users mailing list<br>
&gt;&gt;&gt;&gt;&gt; <a href="mailto:mythtv-users@mythtv.org">mythtv-users@mythtv.org</a><br>
&gt;&gt;&gt;&gt;&gt; <a href="http://www.mythtv.org/mailman/listinfo/mythtv-users" target="_blank">http://www.mythtv.org/mailman/listinfo/mythtv-users</a><br>
&gt;&gt;&gt;&gt;&gt; <a href="http://wiki.mythtv.org/Mailing_List_etiquette" target="_blank">http://wiki.mythtv.org/Mailing_List_etiquette</a><br>
&gt;&gt;&gt;&gt;&gt; MythTV Forums: <a href="https://forum.mythtv.org" target="_blank">https://forum.mythtv.org</a><br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;Thanks Stephen, I use my PVR 150 to record from an analog STB<br>
&gt;&gt;&gt;&gt;connected via RCA jacks, this card has apparently has five possible<br>
&gt;&gt;&gt;&gt;input connections, one &quot;tuner&quot; via coax and two each of &quot;component&quot;<br>
&gt;&gt;&gt;&gt;and &quot;S-video&quot;. To leave my system connected as is, I would need to<br>
&gt;&gt;&gt;&gt;create a new &quot; ivtv_audio_fix.sh&quot; file like yours, but change the name<br>
&gt;&gt;&gt;&gt;of the tuner card appropriately and modify my &quot;change-channel.sh&quot; as<br>
&gt;&gt;&gt;&gt;outlined in the original post? Or, maybe more simply, change the input<br>
&gt;&gt;&gt;&gt;connection to &quot;tuner&quot; over coax and add the one line to my<br>
&gt;&gt;&gt;&gt;&quot;change-channel.sh&quot;? with the first solution, I must need one more<br>
&gt;&gt;&gt;&gt;line in the &quot;change-channel.sh&quot; to call the new &quot;ivtv_audio_fix.sh&quot;<br>
&gt;&gt;&gt;&gt;script, right? But I&#39;m not sure where to put it.<br>
&gt;&gt;&gt;&gt;Daryl<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Create the ivtv_audio_fix.sh file (I have mine in /usr/local/bin where<br>
&gt;&gt;&gt; my change-channel-skynz.sh script is).  Then if your existing channel<br>
&gt;&gt;&gt; change script works at all like mine, you can just add these two lines<br>
&gt;&gt;&gt; at the end of it:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; # Workaround for bug which causes audio distortion on some recordings.<br>
&gt;&gt;&gt; /usr/local/bin/ivtv_audio_fix.sh /dev/videoPVR150 &amp;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; What that does is to run the ivtv_audio_fix.sh script as a separate<br>
&gt;&gt;&gt; independent job (that is what &amp; does).  The channel change script can<br>
&gt;&gt;&gt; finish and that lets MythTV know that the channel change has been<br>
&gt;&gt;&gt; done.  The ivtv_audio_fix.sh script will do its sleep while MythTV<br>
&gt;&gt;&gt; records for the sleep time (you will hear the tinny sound for the<br>
&gt;&gt;&gt; first few seconds of the recording, if it happened for that<br>
&gt;&gt;&gt; recording), then the script will wake up and do its fix.  The fix has<br>
&gt;&gt;&gt; to be done after all the recording startup work that MythTV does - if<br>
&gt;&gt;&gt; it is done too early it does not work as the v4l commands sent by<br>
&gt;&gt;&gt; MythTV override it.  When the ivtv_audio_fix.sh script has done its<br>
&gt;&gt;&gt; v4l commands it will just stop without reporting back to the script<br>
&gt;&gt;&gt; that called it (which finished several seconds before).<br>
&gt;<br>
&gt;&gt;Hopefully I&#39;m not over-reading this, what I did is create the<br>
&gt;&gt;ivtv_audio_fix.sh file in /usr/local/bin, and I changed (near the top)<br>
&gt;&gt;&quot;device=/dev/video0&quot; to &quot;devive=/dev/videopvr150&quot; and then added the<br>
&gt;&gt;two lines to the end of my &quot;change-channel.sh&quot; exactly as yours is<br>
&gt;&gt;(without the /dev/videoPVR150) [my uDev rule uses lower case pvr, my<br>
&gt;&gt;bad] . This preceding issue is at the heart of my original question;<br>
&gt;&gt;am I correct or wrong in assuming that the new name created by my uDev<br>
&gt;&gt;rule should be reflected in the &quot;ivtv_audio_fix.sh&quot; script?  Thanks<br>
&gt;&gt;again  Daryl<br>
&gt;<br>
&gt; If you exactly copied the two lines I posted to the bottom of your<br>
&gt; change-channel.sh, then it will not work, due to the mis-spelling of<br>
&gt; /dev/videopvr150 as /dev/videoPVR150 in what I wrote.  My<br>
&gt; ivtv_audio_fix.sh script accepts one optional parameter on its command<br>
&gt; line, the name of the device to control.  If that parameter is absent,<br>
&gt; it will use the default device setting you changed at the top of<br>
&gt; ivtv_audio_fix.sh.  It was not necessary to change that as the two<br>
&gt; lines I posted had the device name as a parameter.  So you either need<br>
&gt; to fix the spelling of /dev/videopvr150 on the call to<br>
&gt; ivtv_audio_fix.sh in change-channel.sh, or remove the /dev/videoPVR150<br>
&gt; from there and let ivtv_audio_fix.sh use its default device name that<br>
&gt; you have already fixed.<br>
&gt; _______________________________________________<br>
&gt; mythtv-users mailing list<br>
&gt; <a href="mailto:mythtv-users@mythtv.org">mythtv-users@mythtv.org</a><br>
&gt; <a href="http://www.mythtv.org/mailman/listinfo/mythtv-users" target="_blank">http://www.mythtv.org/mailman/listinfo/mythtv-users</a><br>
&gt; <a href="http://wiki.mythtv.org/Mailing_List_etiquette" target="_blank">http://wiki.mythtv.org/Mailing_List_etiquette</a><br>
&gt; MythTV Forums: <a href="https://forum.mythtv.org" target="_blank">https://forum.mythtv.org</a><br>
<br>
</div></div>What I exactly copied into my change-channel.sh was the last two lines<br>
of your change_channel_skynz.sh, so I think I&#39;m good with the audio<br>
fix script edited to reflect the uDev name of my analog card and my<br>
channel script calling the fix script just like yours does, not the<br>
way you suggested had I not edited.<br>
<br>
The University of Toronto is offering free online computer science<br>
courses this fall, after applying myself in this direction I hope to<br>
get a much better practical understanding of all the things that I&#39;ve<br>
received excellent coaching on from this list. Thanks Stephen, thanks<br>
list, enormous thanks Devs, I love Mythtv.   (BE &amp; FE)   Daryl<br></blockquote><div><br></div><div> I&#39;ve had almost two weeks of clear audio recordings, but a recording yesterday has the Tin/Raz effect. Below are my &quot;change-channel.sh&quot; and &quot;ivtv_audio_fix.sh&quot;</div>
<div><br></div><div><div>REMOTE_NAME=DCT700</div><div>cmd=&quot;$1&quot;</div><div>lirc_socket=&quot;/var/run/lirc/lircdSerial&quot;</div><div><br></div><div>/usr/local/bin/check_stb 1&gt;/dev/null 2&gt;/dev/null || :</div>
<div>sleep 2</div><div><br></div><div>case $cmd in</div><div>    [0-9]*)</div><div>    for digit in $(echo $1 | sed -e &#39;s/./&amp; /g&#39;); do </div><div>        #irsend -d /dev/lircd SEND_ONCE $REMOTE_NAME $digit</div>
<div>        irsend -d ${lirc_socket} SEND_ONCE $REMOTE_NAME $digit</div><div>        sleep 0.2</div><div>        # If things work OK with sleep 1, try this for faster channel changes:</div><div>        # sleep 0.3</div><div>
    done</div><div>        #irsend -d /dev/lircd SEND_ONCE $REMOTE_NAME OK</div><div>        irsend -d ${lirc_socket} SEND_ONCE $REMOTE_NAME OK</div><div>sleep 1</div><div>        #irsend -d /dev/lircd SEND_ONCE $REMOTE_NAME EXIT</div>
<div>        irsend -d ${lirc_socket} SEND_ONCE $REMOTE_NAME EXIT</div><div>    ;;</div><div><br></div><div>    *)</div><div>        #irsend SEND_ONCE $REMOTE_NAME $cmd</div><div>        irsend -d ${lirc_socket} SEND_ONCE $REMOTE_NAME $cmd</div>
<div>        ;;</div><div>esac</div><div><br></div><div><br></div><div># Workaround for bug which causes audio distortion on some recordings.</div><div>/usr/local/bin/ivtv_audio_fix.sh &amp;</div></div><div><br></div><div>
---------------------------------------------------------------------------------------</div><div><br></div><div><div>#!/bin/sh</div><div><br></div><div># Workaround for bug which causes audio distortion on some recordings.</div>
<div># From <a href="http://urlgrey.net/?p=231">http://urlgrey.net/?p=231</a></div><div><br></div><div>sleep 3</div><div><br></div><div>if [ $# -eq 0 ]; then</div><div>    device=/dev/videopvr150</div><div>else</div><div>
    device=$1</div><div>fi</div><div><br></div><div># First, set the audio input in turn to each of the unwanted audio inputs.</div><div># This only became necessary as of Mythbuntu 12.04.</div><div>v4l2-ctl -d$device --set-audio-input=2</div>
<div>v4l2-ctl -d$device --set-audio-input=0</div><div><br></div><div># Next, also set the tuner frequency.  This also seems to be necessary</div><div># since Mythbuntu 12.04 to suppress a slightly different audio distortion.</div>
<div># The frequency should be for an unused part of the spectrum, as the unwanted</div><div># audio is coming from whatever the TV tuner is tuned to.</div><div>v4l2-ctl -d$device -f 420</div><div><br></div><div># Reset the audio input to source 1 (the wanted input).</div>
<div>v4l2-ctl -d$device --set-audio-input=1</div></div><div><br></div><div>--------------------------------------------------------------------------------------------</div><div><br></div><div>I thought I&#39;d followed Mr Worthington&#39;s advice to the letter, maybe not , or maybe I need to pursue a different angle. If anyone can critique this solution, or point me in a new direction, I&#39;d appreciate it.</div>
<div><br></div><div>TIA Daryl</div><div><br></div><div><br></div></div></div></div>