This is the starter of the shell script audio scope...
The shebang is definitive this time and not a comment...
It is just a simple scan of a graticule using a random number...
Those prepared to test give it a whirl and pass preliminary comments...
Ignore the cursor being shown I have a way of removing if necessary...
The next stage will be using /dev/dsp to grab from the mic input or internal mic...
Watch for wordwrapping, etc...
- Code: Select all
#!/bin/bash
#
# AudioScopeDisplay.sh
#
# This method can also be used for a simple kids level Analogue Data_logger/Transient_Recorder.
# Cannot use "setterm -cursor off" as Mac OSX 10.7.5 has not got "setterm", thought of another way for the Macbook Pro. ;o)
#
# $VER: AudioScopeDisplay.sh_Version_0.00.01_Public_Domain_B.Walker_G0LCU.
display()
{
clear
graticule="+-------+-------+-------+-------+-------+-------+-------+--------+\n"
graticule=$graticule"| | | | + | | | |\n"
graticule=$graticule"| | | | + | | | |\n"
graticule=$graticule"| | | | + | | | |\n"
graticule=$graticule"+-------+-------+-------+-------+-------+-------+-------+--------+\n"
graticule=$graticule"| | | | + | | | |\n"
graticule=$graticule"| | | | + | | | |\n"
graticule=$graticule"| | | | + | | | |\n"
graticule=$graticule"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+--+\n"
graticule=$graticule"| | | | + | | | |\n"
graticule=$graticule"| | | | + | | | |\n"
graticule=$graticule"| | | | + | | | |\n"
graticule=$graticule"+-------+-------+-------+-------+-------+-------+-------+--------+\n"
graticule=$graticule"| | | | + | | | |\n"
graticule=$graticule"| | | | + | | | |\n"
graticule=$graticule"| | | | + | | | |\n"
graticule=$graticule"| | | | + | | | |\n"
graticule=$graticule"+-------+-------+-------+-------+-------+-------+-------+--------+\n"
printf "$graticule"
}
while true
do
display
for horiz in {2..65}
do
# Simulate an 8 bit grab and divide by 16 to give 4 bit depth. Add offset of 2 to allow
# for mssing the top graticule line...
vert=$[ ( $RANDOM % ( 256 / 16 ) + 2 ) ]
# IMPORTANT! The display must be inverted because of the way a terminal plots its characters...
vert=$[ ( 19 - $vert ) ]
printf "\x1B["$vert";"$horiz"fo"
# Slow it down so you can see it working...
sleep 0.05
done
printf "\x1B[20;1f"
sleep 1
done