Hi all,
I've made a quick addition to the tzapfilter.py script that is proposed on
http://www.linuxtv.org/wiki/index.php/Testing_reception_quality
I was fed up with having to dash back and forth between the signal strength
display on the monitor and the antenna while trying to adjust its position for
decent reception.
So I added quick&dirty sound support.
Now I get beeps whose frequency varies with UNC, which I find very useful
(though perhaps maddening after a while :) )
Since this is my first try at python ever (and it does still have a bug - I
have to kill it with several Ctrl-Cs before I get returned to the shell), I
present it to your collective wisdom first. If you decide it is good enough and
useful, consider adding it to the wiki.
If you decide to comment, please CC me as I'm not on the list.
Have fun
Luca
--8<--------8<--------8<--------8<--------8<--------8<--
#!/usr/bin/env python
import sys
import math
import os
f = sys.stdin
while True:
l = f.readline().strip()
fields = l.split(" | ")
if len(fields) < 2:
print l
else:
# Sig Strength
sigStr = fields[1].split(" ")[1]
sig = int(sigStr, 16) / float(int('ffff', 16))
fields[1] = "signal %.1f%%" % (sig * 100.0)
# BER
berStr = fields[3].split(" ")[1]
ber = int(berStr, 16)
fields[3] = "ber %08d" % (ber)
print " | ".join(fields)
# UNC
uncStr = fields[4].split(" ")[1]
unc = int(uncStr, 16)
uncTone = math.log((unc+1.0)/10)
cmdString = "play -q -n -c1 synth sin %" + `uncTone` + " fade q
0.01 0.3 0.01 &"
os.system(cmdString)
print " | ".join(fields)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html