#!/bin/bash## AudioScope.sh## At this point I will include and say thank you to "Corona688", a member of http://www.unix.com for his input...# Many thanks also go to the guys who have helped with this on http://www.linuxformat.com for all your input too...## Tested in SOX mode on this Macbook Pro 13 inch, OSX 10.7.5 with the SOX sinewave generator enabled.# Tested in /dev/dsp mode on an aging HP notebook running Debian 6.0.x with the /dev/dsp sinewave generator enabled.# Tested on both in DEMO mode.## Added the first simple circuit at the end of this script.## NOTE TO SELF:- Remove "/tmp" and replace with "~" when ready, AND, "/tmp" is automatically cleared on this machine per reboot.

# ########################################################## FOR SOund eXchance USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments and then EDIT the line pointing to the correct </full/path/to/sox/> to use it.# It assumes that you have SoX installed. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges. #> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' /full/path/to/sox/play -b 8 -r 8000 -e unsigned-integer /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## FOR /dev/dsp USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments to use it.# It assumes that you have /dev/dsp _installed_. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges. #> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' cat /tmp/sinewave.raw > /dev/dsp\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## Variables in use.version=" \$VER: AudioScope.sh_Version_0.00.33_PD_B.Walker_G0LCU. "setup=$versiondemo=0# "hold" and "status" will always be reset to "1" on program exit.hold=1status=1# "count", "number" and "char" are reusable variables.count=0number=0char="?"vert=12vert_shift=2vshift="?"horiz=9kbinput="?"graticule="Public Domain, 2013, B.Walker, G0LCU."kbinput="RUN"tbinput=1strlen=1# "grab" is for future usage and reserved.grab=0# "zero_offset" can only be manually changed in the AudioScope.config file, OR, here...zero_offset=1# Scan retraces...scan=1scanloops=1# Timebase variables...subscript=0# scan_start is from 0 to ( length of file - 64 )...scan_start=0# scan_jump is from 1 to ( ( ( scan_end - scan_start ) / 64) + 1 )...scan_jump=1# scan_finish is not used yet...scan_end=1935

#!/bin/bash## AudioScope.sh## At this point I will include and say thank you to "Corona688", a member of http://www.unix.com for his input...# Many thanks also go to the guys who have helped with this on http://www.linuxformat.com for all your input too...## Tested in SOX mode on this Macbook Pro 13 inch, OSX 10.7.5 with the SOX sinewave generator enabled.# Tested in /dev/dsp mode on an aging HP notebook running Debian 6.0.x with the /dev/dsp sinewave generator enabled.# Tested on both in DEMO mode.## Added the first simple circuit at the end of this script.## NOTE TO SELF:- Remove "/tmp" and replace with "~" when ready, AND, "/tmp" is automatically cleared on this machine per reboot.

# ########################################################## FOR SOund eXchance USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments and then EDIT the line pointing to the correct </full/path/to/sox/> to use it.# It assumes that you have SoX installed. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges. #> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' /full/path/to/sox/play -b 8 -r 8000 -e unsigned-integer /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## FOR /dev/dsp USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments to use it.# It assumes that you have /dev/dsp _installed_. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges. #> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' cat /tmp/sinewave.raw > /dev/dsp\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## Variables in use.ifs_str=$IFSversion=" \$VER: AudioScope.sh_Version_0.00.36_PD_B.Walker_G0LCU. "setup=$versiondemo=0# "hold" and "status" will always be reset to "1" on program exit.hold=1status=1# "count", "number" and "char" are reusable variables.count=0number=0char="?"# vert_one and vert_two are the vertical plotting points for the draw() function...vert_one=2vert_two=2vert=12vert_shift=2vshift="?"vert_array=""vert_draw=9horiz=9graticule="Public Domain, 2013, B.Walker, G0LCU."kbinput="?"tbinput=1str_len=1# "grab" is for future usage and reserved.grab=0# "zero_offset" can only be manually changed in the AudioScope.config file, OR, here...zero_offset=1# Scan retraces...scan=1scanloops=1# Timebase variables...subscript=0# scan_start is from 0 to ( length of file - 64 )...scan_start=0# scan_jump is from 1 to ( ( ( scan_end - scan_start ) / 64) + 1 )...scan_jump=1# scan_finish is not used yet...scan_end=1935

# ########################################################## Add the program tilte to the Terminal title bar...# This may NOT work in every Terminal so just comment it out if it doesn't.printf "\x1B]0;Shell AudioScope.\x07"

More seriously, could it divide usefully into separate I/O, Control and Display scripts? I'm thinking that might make it easier to add new input sources and display/output modes - and control functions too. For example your SOX and dsp inputs seem to share a lot of code; you could define an "abstracted" input interface between scripts, then have individual device driver scripts for each input type. No pressure.

"Klinger, do you know how many zoots were killed to make that one suit?" — BJ Hunnicutt, 4077 M*A*S*H

> More seriously, could it divide usefully into separate I/O, Control and Display scripts?

Quite possibly, but remember EVERTHING including basic test circuits HAVE to be included inside the one script and these separate callable scripts would have to generated like the 1KHz signal generator(s).

This could make the script hundreds of KB in size. I have no idea if there is a maximum limit of a script size in a bash terminal.

> I'm thinking that might make it easier to add new input sources and display/output modes - and control functions too. For example your SOX and dsp inputs seem to share a lot of code; you could define an "abstracted" input interface between scripts, then have individual device driver scripts for each input type. No pressure.

Gimme chance... ;oD Nice idea(s), my biggest problem is detecting, getting and determining the DC component into a Macbook Pro which only has ONE audio input... I have worked out how the switch the input through the script from AC to DC but have yet to prove it. Remember ICs are NOT allowed, only FETs and Bipolars, and stripboard for PCBs - simple enough that each stage can be built by kids...

Still working out how to get DC in on ONE input only...

I have a simple method of relay switching AC to DC and back using the 1KHz generator but even with a chopper I have no means, AFAIK, whether the DC is +ve or -ve.

This is the idea I have gotten, use a chopper to get the relative DC level, and on exactly the same multivib use a VFO section to detect whether the signal is +ve or -ve, a low freq being -ve and a high freq being +ve... FM and AM in 1 swoop... ;oD

The two images are the SOX sinewave generator auto-running from
the script with the earphone output connected to the mic input using the home
built hardware previously shown and the levels set using the output volume
and mic input controls.

The TBVAR set at 3 in and 3 jump for easy viewing, equvalent to 500uS/DIV,
proving the horizontal calibration is correct, 2 divisions per cycle...

Set to 1mS/DIV and you will see the calibrtaion is correct.

EDIT: Just removed a copy and paste error by me. It does not affect the
program at all...

#!/bin/bash## AudioScope.sh## At this point I will include and say thank you to "Corona688", a member of http://www.unix.com for his input...# Many thanks also go to the guys who have helped with this on http://www.linuxformat.com for all your input too...## Tested in SOX mode on this Macbook Pro 13 inch, OSX 10.7.5 with the SOX sinewave generator enabled.# Tested in /dev/dsp mode on an aging HP notebook running Debian 6.0.x with the /dev/dsp sinewave generator enabled.# Tested on both in DEMO mode.## Added the first simple circuit at the end of this script.## NOTE TO SELF:- Remove "/tmp" and replace with "~" when ready, AND, "/tmp" is automatically cleared on this machine per reboot.

# ########################################################## FOR SOund eXchance USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments and then EDIT the line pointing to the correct </full/path/to/sox/> to use it.# It assumes that you have SoX installed. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges. #> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' /full/path/to/sox/play -b 8 -r 8000 -e unsigned-integer /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## FOR /dev/dsp USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments to use it.# It assumes that you have /dev/dsp _installed_. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges. #> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' cat /tmp/sinewave.raw > /dev/dsp\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## Variables in use.ifs_str=$IFSversion=" \$VER: AudioScope.sh_Version_0.00.38_PD_B.Walker_G0LCU. "setup=$versiondemo=0drawline=0# "hold" and "status" will always be reset to "1" on program exit.hold=1status=1# "count", "number" and "char" are reusable variables.count=0number=0char="?"# vert_one and vert_two are the vertical plotting points for the draw() function...vert_one=2vert_two=2vert=12vert_shift=2vshift="?"vert_array=""vert_draw=9horiz=9graticule="Public Domain, 2013, B.Walker, G0LCU."kbinput="?"tbinput=1str_len=1# "grab" is for future usage and reserved.grab=0# "zero_offset" can only be manually changed in the AudioScope.config file, OR, here...zero_offset=1# Scan retraces...scan=1scanloops=1# Timebase variables...subscript=0# scan_start is from 0 to ( length of file - 64 )...scan_start=0# scan_jump is from 1 to ( ( ( scan_end - scan_start ) / 64) + 1 )...scan_jump=1# scan_finish is not used yet...scan_end=1935

# ########################################################## Add the program tilte to the Terminal title bar...# This may NOT work in every Terminal so just comment it out if it doesn't.printf "\x1B]0;Shell AudioScope.\x07"

The start of the internal synchronisation code is started and an auto-save facility added.

This auto-save is _volatile_ so use with caution. By volatile I mean, when enabled it WILL save a copy of EVERY scan whether it is a capture or a replay.

It is easy to code for capture only but I decided to do every scan because it is easier to delete files than try to get them back again. The filemanes are _numeric_ using EPOCH values and saved to /tmp ATM...

The new commands are SAVEON, SAVEOFF, TIRG with unfinished subcommands of SYNCEQ, SYNCGT and SYNCLT. I am working on these in the evenings, UK local time and should be ready by the weekend.

#!/bin/bash## AudioScope.sh## At this point I will include and say thank you to "Corona688", a member of http://www.unix.com for his input...# Many thanks also go to the guys who have helped with this on http://www.linuxformat.com for all your input too...## Tested in SOX mode on this Macbook Pro 13 inch, OSX 10.7.5 with the SOX sinewave generator enabled.# Tested in /dev/dsp mode on an aging HP notebook running Debian 6.0.x with the /dev/dsp sinewave generator enabled.# Tested on both in DEMO mode.## Added the first simple circuit at the end of this script.## NOTE TO SELF:- Remove "/tmp" and replace with "~" when ready, AND, "/tmp" is automatically cleared on this machine per reboot.

# ########################################################## FOR SOund eXchance USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments and then EDIT the line pointing to the correct </full/path/to/sox/> to use it.# It assumes that you have SoX installed. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges. #> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' /full/path/to/sox/play -b 8 -r 8000 -e unsigned-integer /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## FOR /dev/dsp USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments to use it.# It assumes that you have /dev/dsp _installed_. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges. #> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' cat /tmp/sinewave.raw > /dev/dsp\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## Variables in use.ifs_str=$IFSversion=" \$VER: AudioScope.sh_Version_0.00.50_PD_B.Walker_G0LCU. "setup=" Please wait while the very first scan and configuration file is generated. "demo=0drawline=0savefile="0000000000"save_string="OFF"# "hold" and "status" will always be reset to "1" on program exit.hold=1status=1# "count", "number" and "char" are reusable variables.count=0number=0char="?"# vert_one and vert_two are the vertical plotting points for the draw() function...vert_one=2vert_two=2vert=12vert_shift=2vshift="?"vert_array=""vert_draw=9horiz=9graticule="Public Domain, 2013, B.Walker, G0LCU."kbinput="?"tbinput=1str_len=1# "grab" is for future usage and reserved.grab=0# "zero_offset" can only be manually changed in the AudioScope.config file, OR, here...zero_offset=1# Scan retraces...scan=1scanloops=1# Timebase variables...subscript=0# scan_start is from 0 to ( length of file - 64 )...scan_start=0# scan_jump is from 1 to ( ( ( scan_end - scan_start ) / 64) + 1 )...scan_jump=1# scan_finish is not used yet...scan_end=1935# Synchronisation variavles...# synchronise switches the syncchroisation ON or OFF...synchronise="OFF"# sync_point is any value between 0 and 255 of the REAL grab(s)...sync_point=128

# ########################################################## Add the program tilte to the Terminal title bar...# This may NOT work in every Terminal so just comment it out if it doesn't.printf "\x1B]0;Shell AudioScope.\x07"

#!/bin/bash## AudioScope.sh## At this point I will include and say thank you to "Corona688", a member of http://www.unix.com for his input...# Many thanks also go to the guys who have helped with this on http://www.linuxformat.com for all your input too...## Tested in SOX mode on this Macbook Pro 13 inch, OSX 10.7.5 with the SOX sinewave generator enabled.# Tested in /dev/dsp mode on an aging HP notebook running Debian 6.0.x with the /dev/dsp sinewave generator enabled.# Tested on both in DEMO mode.## Added the first simple circuit at the end of this script.## NOTE TO SELF:- Remove "/tmp" and replace with "~" when ready, AND, "/tmp" is automatically cleared on this machine per reboot.

# ########################################################## FOR SOund eXchance USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments and then EDIT the line pointing to the correct </full/path/to/sox/> to use it.# It assumes that you have SoX installed. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges. #> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' /full/path/to/sox/play -b 8 -r 8000 -e unsigned-integer /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## FOR /dev/dsp USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments to use it.# It assumes that you have /dev/dsp _installed_. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges. #> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' cat /tmp/sinewave.raw > /dev/dsp\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## Variables in use.ifs_str=$IFSversion=" \$VER: AudioScope.sh_Version_0.00.55_PD_B.Walker_G0LCU. "setup=" Please wait while the very first scan and configuration file is generated. "demo=0drawline=0savefile="0000000000"save_string="OFF"# "hold" and "status" will always be reset to "1" on program exit.hold=1status=1# "count", "number" and "char" are reusable variables.count=0number=0char="?"# vert_one and vert_two are the vertical plotting points for the draw() function...vert_one=2vert_two=2vert=12vert_shift=2vshift="?"vert_array=""vert_draw=9horiz=9graticule="Public Domain, 2013, B.Walker, G0LCU."kbinput="?"tbinput=1str_len=1# "grab" is for future usage and reserved.grab=0# "zero_offset" can only be manually changed in the AudioScope.config file, OR, here...zero_offset=1# Scan retraces...scan=1scanloops=1# Timebase variables...subscript=0# scan_start is from 0 to ( length of file - 64 )...scan_start=0# scan_jump is from 1 to ( ( ( scan_end - scan_start ) / 64) + 1 )...scan_jump=1# scan_finish is not used yet...scan_end=1935# Synchronisation variavles...# synchronise switches the syncchroisation ON or OFF...synchronise="OFF"# sync_point is any value between 0 and 255 of the REAL grab(s)...sync_point=128

# ########################################################## Add the program tilte to the Terminal title bar...# This may NOT work in every Terminal so just comment it out if it doesn't.printf "\x1B]0;Shell AudioScope.\x07"

Found 2 bugs and 1 programming error, yup there are bugs... ;oO
The bugs are esoteric but the error is stupidity on my part... ;oD

I suspect none have been found by yourselves who are trying this out however...

Removed the bash RANDOM call and used /dev/urandom instead. It is _infinitely_ quicker for the DEMO capture mode...

The first of the _internal_sync_ routines done.
Help file updated, etc, etc...

From Command mode:-

TRIG<CR>
SYNCEQ<CR>
Caps shift u or caps shift d to decide a sync point from 15 to 240. Then <CR>...
This starts the display from the value set.
Do all this again and the trace will start from another point with the value chosen...
If the value is not found then the trace runs from the start of the waveform.raw file at the FASTEST timebase speed...

Working on negative going SYNCLT and positive going SYNCGT ATM...

The code has now had extensive testing on an ACER Aspire One netbook using PCLinuxOS 2009 in DEMO and DSP modes also...

Before running delete your existing /default/full/path/to/AudioScope.config file so that the
changes can take place correctly... Also manually change the zero_offset value to give a centre straight line with 0 input voltage. It is now -2 on my Macbook Pro machine...

#!/bin/bash## AudioScope.sh## At this point I will include and say thank you to "Corona688", a member of http://www.unix.com for his input...# Many thanks also go to the guys who have helped with this on http://www.linuxformat.com for all your input too...## Tested in SOX mode on this Macbook Pro 13 inch, OSX 10.7.5 with the SOX sinewave generator enabled.# Tested in /dev/dsp mode on an aging HP notebook running Debian 6.0.x with the /dev/dsp sinewave generator enabled.# Tested on both in DEMO mode.## Added the first simple circuit at the end of this script.## NOTE TO SELF:- Remove "/tmp" and replace with "~" when ready, AND, "/tmp" is automatically cleared on this machine per reboot.

# ########################################################## FOR SOund eXchance USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments and then EDIT the line pointing to the correct </full/path/to/sox/> to use it.# It assumes that you have SoX installed. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges. #> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' /full/path/to/sox/play -b 8 -r 8000 -e unsigned-integer /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## FOR /dev/dsp USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments to use it.# It assumes that you have /dev/dsp _installed_. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges. #> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' cat /tmp/sinewave.raw > /dev/dsp\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## Variables in use.ifs_str=$IFSversion=" \$VER: AudioScope.sh_Version_0.00.68_PD_B.Walker_G0LCU. "setup=" Please wait while the very first scan and configuration file is generated. "# Default first time run capture mode, 0 = DEMO.demo=0# Draw proceedure mode, 0 = OFFdrawline=0# Pseudo-continuous data file saving.savefile="0000000000"save_string="OFF"# "hold" and "status" will always be reset to "1" on program exit.hold=1status=1# "count", "number" and "char" are reusable variables...count=0number=0char="?"# Vertical components...# vert_one and vert_two are the vertical plotting points for the draw() function...vert_one=2vert_two=2vert=12vert_shift=2vshift="?"vert_array=""vert_draw=9# Display setup...graticule="Public Domain, 2013, B.Walker, G0LCU."# Keyboard components...kbinput="?"tbinput=1# "str_len" is a reusable variable IF required...str_len=1# "grab" is used for internal pseudo-synchronisation...grab=0# "zero_offset" can only be manually changed in the AudioScope.config file, OR, here...zero_offset=-2# Horizontal components...horiz=9# Scan retraces...scan=1scanloops=1# Timebase variable components...subscript=0# "scan_start" is from 0 to ( length of file - 64 )...scan_start=0# "scan_jump" is from 1 to ( ( ( scan_end - scan_start ) / 64) + 1 )...scan_jump=1# "scan_end" is at least 64 bytes in from the absolute file end...scan_end=47935# Synchronisation variavles...# synchronise switches the syncchroisation ON or OFF...synchronise="OFF"# sync_point is any value between 15 and 240 of the REAL grab(s)...sync_point=128sync_input="?"

# ########################################################## Add the program tilte to the Terminal title bar...# This may NOT work in every Terminal so just comment it out if it doesn't.printf "\x1B]0;Shell AudioScope.\x07"

#!/bin/bash## AudioScope.sh## At this point I will include and say thank you to "Corona688", a member of http://www.unix.com for his input...# Also to others on the same site for their input too.# Many thanks also go to the guys who have helped with this on http://www.linuxformat.com for all your input too...## Tested in SOX mode on this Macbook Pro 13 inch, OSX 10.7.5 with the SOX sinewave generator enabled.# Tested in /dev/dsp mode on an aging HP notebook running Debian 6.0.x with the /dev/dsp sinewave generator enabled.# Tested in /dev/dsp mode on an Acer Aspire One netbook booting from a USB stick running PCLinuxOS 2009; also with# the /dev/dsp sinewave generator enabled.# Tested on all three in DEMO mode.## Added the first simple circuit at the end of this script.## Relevant pointers to help:-# http://wisecracker.host22.com/public/AudioScope_Manual.readme# http://wisecracker.host22.com/public/cal_draw.jpg# http://wisecracker.host22.com/public/cal_plot.jpg# http://wisecracker.host22.com/public/mic_ear1.jpg# http://wisecracker.host22.com/public/mic_ear2.jpg# http://wisecracker.host22.com/public/mic_ear3.jpg# http://wisecracker.host22.com/public/mic_ear4.jpg## The latest vesrion will always be here:-# http://www.unix.com/shell-programming-scripting/212939-start-simple-audio-scope-shell-script.html## NOTE TO SELF:- Remove "/tmp" and replace with "~" when ready, AND, "/tmp" is automatically cleared on this machine per reboot.

# ########################################################## FOR SOund eXchance USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments and then EDIT the line pointing to the correct </full/path/to/sox/> to use it.# It assumes that you have SoX installed. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges. #> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' /full/path/to/sox/play -b 8 -r 8000 -e unsigned-integer /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## FOR /dev/dsp USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments to use it.# It assumes that you have /dev/dsp _installed_. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges. #> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' cat /tmp/sinewave.raw > /dev/dsp\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## Variables in use.ifs_str=$IFSversion=" \$VER: AudioScope.sh_Version_0.00.80_PD_B.Walker_G0LCU. "setup=" Please wait while the very first scan and configuration file is generated. "# Default first time run capture mode, 0 = DEMO.demo=0# Draw proceedure mode, 0 = OFFdrawline=0# Pseudo-continuous data file saving.savefile="0000000000"save_string="OFF"# "hold" and "status" will always be reset to "1" on program exit.hold=1status=1# "count", "number" and "char" are reusable variables...count=0number=0char="?"# Vertical components...# vert_one and vert_two are the vertical plotting points for the draw() function...vert_one=2vert_two=2vert=12vert_shift=2vshift="?"vert_array=""vert_draw=9# Display setup...graticule="Public Domain, 2013, B.Walker, G0LCU."# Keyboard components...kbinput="?"tbinput=1# "str_len" is a reusable variable IF required...str_len=1# "grab" is used for internal pseudo-synchronisation...grab=0# "zero_offset" can only be manually changed in the AudioScope.config file, OR, here...zero_offset=-2# Horizontal components...horiz=9# Scan retraces...scan=1scanloops=1# Timebase variable components...subscript=0# "scan_start" is from 0 to ( length of file - 64 )...scan_start=0# "scan_jump" is from 1 to ( ( ( scan_end - scan_start ) / 64) + 1 )...scan_jump=1# "scan_end" is at least 64 bytes in from the absolute file end...scan_end=47935# Synchronisation variables...# synchronise switches the syncchroisation ON or OFF...synchronise="OFF"# sync_point is any value between 15 and 240 of the REAL grab(s)...sync_point=128sync_input="?"

# ########################################################## Add the program tilte to the Terminal title bar...# This may NOT work in every Terminal so just comment it out if it doesn't.printf "\x1B]0;Shell AudioScope.\x07"

How it works:-
Decimal 128 is considered to be the centre point of the sound card.
Therefore a balanced signal will be centred on this number.
The minimum most point at any zoom level is shifted to give a 0(ish)
value then anything above that is the remainder of the waveform.

To keep it within the 16 vertical characters the values are divided
by an order of 2^x depending upon the range.

None of the user coomands are available in this mode as it purely
to give an FSD for low and very low AC signal levels...

At the highest sensitivity, (4), centre point bit error will be
noticeable; this could be considered noise so be aware.

#!/bin/bash## AudioScope.sh## At this point I will include and say thank you to "Corona688", a member of http://www.unix.com for his input...# Also to others on the same site for their input too.# Many thanks also go to the guys who have helped with this on http://www.linuxformat.com for all your input too...## Tested in SOX mode on this Macbook Pro 13 inch, OSX 10.7.5 with the SOX sinewave generator enabled.# Tested in /dev/dsp mode on an aging HP notebook running Debian 6.0.x with the /dev/dsp sinewave generator enabled.# Tested in /dev/dsp mode on an Acer Aspire One netbook booting from a USB stick running PCLinuxOS 2009; also with# the /dev/dsp sinewave generator enabled.# Tested on all three in DEMO mode.## Added the first simple circuit at the end of this script.## Relevant pointers to help:-# http://wisecracker.host22.com/public/AudioScope_Manual.readme# http://wisecracker.host22.com/public/cal_draw.jpg# http://wisecracker.host22.com/public/cal_plot.jpg# http://wisecracker.host22.com/public/mic_ear1.jpg# http://wisecracker.host22.com/public/mic_ear2.jpg# http://wisecracker.host22.com/public/mic_ear3.jpg# http://wisecracker.host22.com/public/mic_ear4.jpg## The latest vesrion will always be here:-# http://www.unix.com/shell-programming-scripting/212939-start-simple-audio-scope-shell-script.html## NOTE TO SELF:- Remove "/tmp" and replace with "~" when ready, AND, "/tmp" is automatically cleared on this machine per reboot.

# ########################################################## FOR SOund eXchance USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments and then EDIT the line pointing to the correct </full/path/to/sox/> to use it.# It assumes that you have SoX installed. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges.#> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' /full/path/to/sox/play -b 8 -r 8000 -e unsigned-integer /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## FOR /dev/dsp USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments to use it.# It assumes that you have /dev/dsp _installed_. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges.#> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' cat /tmp/sinewave.raw > /dev/dsp\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## Add the program tilte to the Terminal title bar...# This may NOT work in every Terminal so just comment it out if it doesn't.printf "\x1B]0;Shell AudioScope.\x07"

From now on the distance between uploads could be high as HW will be needed.
This has to be ludicrously simple so as to be built by a 10 year old.

The next upload will be the frequency counter needed for two parts of this
project. However this is a while away yet so now to desribe the X shift control.
(I WILL post a fully working Python version of a frequency counter I wrote ages
ago that uses /dev/dsp.)

Horizontal shift, from the cammand line window type:-

HSHIFT<CR>

Using the keys r, R, l, L, and Q or q change the position of the scan like this:-

r shifts scan to the right by one scan size, (64 bytes).
R shifts scan to the right by one byte at a time.
l shifts scan to the left by one scan size, (64 bytes).
R shifts scan to the left by one byte at a time.
Q or q exits this mode.

The keys respond like INKEY$ in BASIC...
No user values are changed except switching from real grab to rescan mode.
The TB speed will always be the fastest available although it could be made
variable if so desired. I decided against it as this is useful for searching
for odd wavefronts. The status line will let you know where in the file the
start of the current scan is...

Enjoy...

P.S. In the process of building a simple, starter, Y amplifier input ATM...

#!/bin/bash## AudioScope.sh## At this point I will include and say thank you to "Corona688", a member of http://www.unix.com for his input...# Also to others on the same site for their input too.# Many thanks also go to the guys who have helped with this on http://www.linuxformat.com for all your input too...## Tested in SOX mode on this Macbook Pro 13 inch, OSX 10.7.5 with the SOX sinewave generator enabled.# Tested in /dev/dsp mode on an aging HP notebook running Debian 6.0.x with the /dev/dsp sinewave generator enabled.# Tested in /dev/dsp mode on an Acer Aspire One netbook booting from a USB stick running PCLinuxOS 2009; also with# the /dev/dsp sinewave generator enabled.# Tested on all three in DEMO mode.## Added the first simple circuit at the end of this script.## Relevant pointers to help:-# http://wisecracker.host22.com/public/AudioScope_Manual.readme# http://wisecracker.host22.com/public/cal_draw.jpg# http://wisecracker.host22.com/public/cal_plot.jpg# http://wisecracker.host22.com/public/mic_ear1.jpg# http://wisecracker.host22.com/public/mic_ear2.jpg# http://wisecracker.host22.com/public/mic_ear3.jpg# http://wisecracker.host22.com/public/mic_ear4.jpg## The latest vesrion will always be here:-# http://www.unix.com/shell-programming-scripting/212939-start-simple-audio-scope-shell-script.html## NOTE TO SELF:- Remove "/tmp" and replace with "~" when ready, AND, "/tmp" is automatically cleared on this machine per reboot.

# ########################################################## FOR SOund eXchance USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments and then EDIT the line pointing to the correct </full/path/to/sox/> to use it.# It assumes that you have SoX installed. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges.#> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' /full/path/to/sox/play -b 8 -r 8000 -e unsigned-integer /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## FOR /dev/dsp USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments to use it.# It assumes that you have /dev/dsp _installed_. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges.#> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' cat /tmp/sinewave.raw > /dev/dsp\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## Add the program tilte to the Terminal title bar...# This may NOT work in every Terminal so just comment it out if it doesn't.printf "\x1B]0;Shell AudioScope.\x07"

#!/bin/bash## AudioScope.sh## At this point I will include and say thank you to "Corona688", a member of http://www.unix.com for his input...# Also to "Don Cragun" and others on the same site for their input too.# Many thanks also go to the guys who have helped with this on http://www.linuxformat.com for all your input too...## Tested in SOX mode on this Macbook Pro 13 inch, OSX 10.7.5 with the SOX sinewave generator enabled.# Tested in /dev/dsp mode on an aging HP notebook running Debian 6.0.x with the /dev/dsp sinewave generator enabled.# Tested in /dev/dsp mode on an Acer Aspire One netbook booting from a USB stick running PCLinuxOS 2009; also with# the /dev/dsp sinewave generator enabled.# Tested on all three in DEMO mode.## Added the first simple circuit at the end of this script.## Relevant pointers to help:-# http://wisecracker.host22.com/public/AudioScope_Manual.readme# http://wisecracker.host22.com/public/cal_draw.jpg# http://wisecracker.host22.com/public/cal_plot.jpg# http://wisecracker.host22.com/public/mic_ear1.jpg# http://wisecracker.host22.com/public/mic_ear2.jpg# http://wisecracker.host22.com/public/mic_ear3.jpg# http://wisecracker.host22.com/public/mic_ear4.jpg## The latest vesrion will always be here:-# http://www.unix.com/shell-programming-scripting/212939-start-simple-audio-scope-shell-script.html## NOTE TO SELF:- Remove "/tmp" and replace with "~" when ready, AND, "/tmp" is automatically cleared on this machine per reboot.

# ########################################################## FOR SOund eXchance USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments and then EDIT the line pointing to the correct </full/path/to/sox/> to use it.# It assumes that you have SoX installed. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges.#> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' /full/path/to/sox/play -b 8 -r 8000 -e unsigned-integer /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## FOR /dev/dsp USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments to use it.# It assumes that you have /dev/dsp _installed_. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again. To quit this script# and close the window just press Ctrl-C. This generator will be needed for the calibration of some timebase ranges.#> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'data="\\\\x80\\\\x26\\\\x00\\\\x26\\\\x7F\\\\xD9\\\\xFF\\\\xD9"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' cat /tmp/sinewave.raw > /dev/dsp\n' >> /tmp/1KHz-Test.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## Add the program tilte to the Terminal title bar...# This may NOT work in every Terminal so just comment it out if it doesn't.printf "\x1B]0;Shell AudioScope.\x07"

Frequency Counter added for the symmetrical waveforms sine, square, triangle, (and maybe sawtooth).
This is for the future addition of the DC component and measures from 50Hz to 3500Hz to within 0.1% accuracy.
In DEMO mode this will always read 500Hz as that is the file manually generated for the task.

Code now added for the creation of running files ready for the vertical calibration.

Note, that the vertical amplifier and calbrator are built and the circuit for the calibrator is adeed to the
end of the script.

The Windows version of the vertical calibrator SW works as a genuine file under Windows but as this is generated
on the fly it has NOT been transfered and tested yet. Feedback would be most welcome on this one. It should give
a 1KHz tone for around 8 seconds ONLY and has to be rerun ATM...

#!/bin/bash## AudioScope.sh## IMPORTANT!!! This code assumes that it is saved as AudioScope.sh inside your _home_ drawer...# Set the permissions to YOUR requirements and launch the code using the following:-## Your Prompt> ./AudioScope.sh<CR>## At this point I will include and say thank you to "Corona688", a member of http://www.unix.com for his input...# Also to "Don Cragun" and others on the same site for their input too.# Many thanks also go to the guys who have helped with this on http://www.linuxformat.com for all your input too...## Tested in SOX mode on this Macbook Pro 13 inch, OSX 10.7.5 with the SOX sinewave generator enabled.# Tested in /dev/dsp mode on an aging HP notebook running Debian 6.0.x with the /dev/dsp sinewave generator enabled.# Tested in /dev/dsp mode on an Acer Aspire One netbook booting from a USB stick running PCLinuxOS 2009; also with# the /dev/dsp sinewave generator enabled.# Tested on all three in DEMO mode.## Added the first simple circuit at the end of this script.# Added the second simple circuit at the end of this script.## Relevant pointers to help:-# http://wisecracker.host22.com/public/AudioScope_Manual.readme# http://wisecracker.host22.com/public/cal_draw.jpg# http://wisecracker.host22.com/public/cal_plot.jpg# http://wisecracker.host22.com/public/mic_ear1.jpg# http://wisecracker.host22.com/public/mic_ear2.jpg# http://wisecracker.host22.com/public/mic_ear3.jpg# http://wisecracker.host22.com/public/mic_ear4.jpg# More photos to follow.## The latest version will always be here:-# http://www.unix.com/shell-programming-scripting/212939-start-simple-audio-scope-shell-script.html## NOTE TO SELF:- Remove "/tmp" and replace with "~" when ready, AND, "/tmp" is automatically cleared on this machine per reboot.

# ########################################################## FOR SOund eXchance USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments and then EDIT the line pointing to the correct </Users/barrywalker/Downloads/sox-14.4.0/> to use it.# It assumes that you have SoX installed. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds and then re-runs. To quit this script and close the window just press and hold Ctrl-C until the# program exits. This generator will be needed for the calibration of some timebase ranges.##> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf 'printf "\x1B]0;1KHz Sinewave Generator.\x07"\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' clear\n' >> /tmp/1KHz-Test.sh#printf ' printf "\nPRESS AND HOLD Ctrl-C UNTIL EXITED...\n"\n' >> /tmp/1KHz-Test.sh#printf ' /Users/barrywalker/Downloads/sox-14.4.0/play -b 8 -r 8000 -e unsigned-integer /tmp/sinewave.raw\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## FOR /dev/dsp USERS ONLY!!! TESTED!!!# The lines below, from ">" to "xterm", will generate a new shell script and execute it in a new xterm terminal...# Just EDIT out the comments to use it.# It assumes that you have /dev/dsp _installed_. When this script is run it generates a 1KHz sinewave in a separate window# that lasts for 8 seconds and then re-runs. To quit this script and close the window just press and hold Ctrl-C until the# program exits. This generator will be needed for the calibration of some timebase ranges.##> /tmp/1KHz-Test.sh#chmod 744 /tmp/1KHz-Test.sh#printf '#!/bin/bash\n' >> /tmp/1KHz-Test.sh#printf 'printf "\x1B]0;1KHz Sinewave Generator.\x07"\n' >> /tmp/1KHz-Test.sh#printf 'while true\n' >> /tmp/1KHz-Test.sh#printf 'do\n' >> /tmp/1KHz-Test.sh#printf ' clear\n' >> /tmp/1KHz-Test.sh#printf ' printf "\nPRESS AND HOLD Ctrl-C UNTIL EXITED...\n"\n' >> /tmp/1KHz-Test.sh#printf ' cat /tmp/sinewave.raw > /dev/dsp\n' >> /tmp/1KHz-Test.sh#printf 'done\n' >> /tmp/1KHz-Test.sh#sleep 1#xterm -e /tmp/1KHz-Test.sh &

# ########################################################## FOR SOund eXchance USERS ONLY!!! TESTED!!!# The lines below, from ">" to the last "printf", will generate a new shell script...# Just EDIT out the comments and then EDIT the line pointing to the correct </full/path/to/sox/> to use it.# TRANSFER this file to another remote machine that has SOund eXchange, SOX, installed.# It assumes that you have SoX installed. When this script is run it generates a 1KHz squarewave on a remote computer# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again.# To quit this script just press Ctrl-C. This generator will be needed for the vertical calibration.# Don't forget to chmod "VERT_SOX.sh" when copied onto the remote machine.#> /tmp/VERT_SOX.sh#printf '#!/bin/bash\n' >> /tmp/VERT_SOX.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/VERT_SOX.sh#printf 'data="\\\\xFF\\\\xFF\\\\xFF\\\\xFF\\\\x00\\\\x00\\\\x00\\\\x00"\n' >> /tmp/VERT_SOX.sh#printf 'for waveform in {0..8191}\n' >> /tmp/VERT_SOX.sh#printf 'do\n' >> /tmp/VERT_SOX.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/VERT_SOX.sh#printf 'done\n' >> /tmp/VERT_SOX.sh#printf 'while true\n' >> /tmp/VERT_SOX.sh#printf 'do\n' >> /tmp/VERT_SOX.sh#printf ' /full/path/to/sox/play -b 8 -r 8000 -e unsigned-integer /tmp/sinewave.raw\n' >> /tmp/VERT_SOX.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/VERT_SOX.sh#printf 'done\n' >> /tmp/VERT_SOX.sh

# ########################################################## FOR /dev/dsp USERS ONLY!!! TESTED!!!# The lines below, from ">" to the last "printf", will generate a new shell script...# Just EDIT out the comments to use it. TRANSFER this file to another machine that has the /dev/dsp device.# It assumes that you have /dev/dsp _installed_. When this script is run it generates a 1KHz squarewave on a remote computer# that lasts for 8 seconds. Just press ENTER when this window is active and it will repeat again.# To quit this script just press Ctrl-C. This generator will be needed for the vertical calibration.# Don't forget to chmod "VERT_DSP.sh" when copied onto the remote machine.#> /tmp/VERT_DSP.sh#printf '#!/bin/bash\n' >> /tmp/VERT_DSP.sh#printf '> /tmp/sinewave.raw\n' >> /tmp/VERT_DSP.sh#printf 'data="\\\\xFF\\\\xFF\\\\xFF\\\\xFF\\\\x00\\\\x00\\\\x00\\\\x00"\n' >> /tmp/1KHz-Test.sh#printf 'for waveform in {0..8191}\n' >> /tmp/VERT_DSP.sh#printf 'do\n' >> /tmp/VERT_DSP.sh#printf ' printf "$data" >> /tmp/sinewave.raw\n' >> /tmp/VERT_DSP.sh#printf 'done\n' >> /tmp/VERT_DSP.sh#printf 'while true\n' >> /tmp/VERT_DSP.sh#printf 'do\n' >> /tmp/VERT_DSP.sh#printf ' cat /tmp/sinewave.raw > /dev/dsp\n' >> /tmp/VERT_DSP.sh#printf ' read -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput\n' >> /tmp/VERT_DSP.sh#printf 'done\n' >> /tmp/VERT_DSP.sh

# ########################################################## Add the program tilte and version to the Terminal title bar...# This may NOT work in every Terminal so just comment it out if it doesn't.printf "\x1B]0;Shell AudioScope, version "$ver".\x07"