LinHES Forums
http://forum.linhes.org/

Scratching noise on channel change? Stuck on PAL-DK?
http://forum.linhes.org/viewtopic.php?f=3&t=5965
Page 1 of 1

Author:  lel [ Thu Sep 08, 2005 3:05 pm ]
Post subject:  Scratching noise on channel change? Stuck on PAL-DK?

Hello, I made a small script that is working great so far, and I thought I'd share it with you. I really hope that I won't have any more shows ruined by static noise. Only time will tell if this works 100%. Feel free to improve.

Code:
#!/bin/sh

# v4l-changechannel.sh <ch>

# Script to change channel on a v4l-capable tv-tuner.
# Use in mythtv-setup as external channel change command.
#
# It solves two problems I had with my saa7134-based
# Pinnacle PCTV Stereo (via both line-in and over PCI):
#
# - Tuner falling back to PAL-DK, even if once set
#   to PAL-BG. This would sometimes cause a very loud
#   static noise throughout the recording.
#   
# - When changing channel in MythTv or doing v4lctl
#   operations (like setting back PAL-BG), a loud
#   scratching noise would play for about a second.
#   Every recording I had would begin with a horrible
#   scratch before settling down to normal sound.
#
# Since even setting attribute 'mute' causes a really
# loud scratch, a different method is used to silence
# the tuner while changing channel. For that to work
# a file ~mythtv/.aumixrc must be present containing
# what you get by running aumix in interactive mode:
#
#   aumix -d /dev/mixer<tunermixer_no> -I
#
# and if you got working sound, then save the settings.
# My .aumixrc looks like this.
#
#   line1:100:100:P
#   line2:100:100:P
#   video:100:100:R     <--- this is where the sound is
#
# /LeL 2005

TVMIX="/dev/mixer1"
VIDEO="/dev/video0"
MUTED="3"             # seconds muted

# change to record sound from line1, but nothing's there -- i.e. mute
aumix -d $TVMIX -1 R
aumix -1 R

# now set whatever attributes we wish without crackling noises
v4lctl -c $VIDEO setchannel $1

v4lctl -c $VIDEO setattr 'mute' off
v4lctl -c $VIDEO setattr 'volume' 4
v4lctl -c $VIDEO setattr 'bright' 128
v4lctl -c $VIDEO setattr 'contrast' 68
v4lctl -c $VIDEO setattr 'color' 64

v4lctl -c $VIDEO setnorm PAL-BG

# change to record sound from video again -- i.e. unmute
# (do that by loading .aumixrc-settings with R on video)
sleep $MUTED && aumix -d $TVMIX -L && aumix -c R &




...hope it helps someone


*EDIT*
My sound could still sometimes become echoing and tinny in the middle of a show. Instead of grabbing audio over PCI, I now use a loopcable to line in (actually it's an internal cable from the tv-card to a CD-connector on the motherboard, hence the -c last in the script... use -l if using normal line-in).
The script is updated to mute recording by switching line in for the sound card as well as for the tv-card.

I have yet not had any sound distortions after this change :-)

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/