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