The Start Of A Simple Audio Scope Shell Script...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting The Start Of A Simple Audio Scope Shell Script...
# 78  
Old 05-13-2016
More circuits and text added to Manual along with minor updated code changes.

Stats:-

# Total Lines=3873.
# Blank Lines=29.
# Code Lines=1921.
# Comments=1923, (including the builtin Manual).
# Filesize=159396 bytes.

The image is dsiplaying speech at low level...

Enjoy...
EDIT:
Forgot to add the photo of the scope probe.

Last edited by wisecracker; 05-13-2016 at 05:28 PM.. Reason: See above.
This User Gave Thanks to wisecracker For This Post:
# 79  
Old 06-05-2016
AudioScope.sh version 0.50.00.

Well a major hurdle is now overcome, and with this major hurdle a major version increase too.

It is extremely difficult to do automatic external range switching from a MONO mic input and STEREO earphone outputs, (it is possible however).
I have instead decided upon a simpler way, manually alter the amplifier hardware to the required volts per division and then enter the range from the 'COMMAND:-' window.
(Although nothing will happen this will _work_ in DEMO mode too.)

This setting is NOT saved in the AudioScope.config file and will always re-start in 'Uncalibrated' vertical axis mode.

AudioScope.sh can now be calibrated in the vertical axis but only in the AC condition.
It can now be considered finshed for the AC mode from around 100Hz to 10KHz or within the limits of the microphone audio input passband.

The full details are now in the manual, coding is already catered for and the AudioScope.manual is now AC complete - hopefully... ;o)

AudioScope.sh, AudioScope.config and AudioScope.manual are now saved inside the '$HOME' directory. The remaining files, all 21 of them are saved in the '/tmp/' directory.

The image is in DEMO mode with a pseudo-Voltage range of 100mV per division...

Stats so far...

# Total Lines=4204.
# Blank Lines=29.
# Code Lines=1986.
# Comments=2189, (including the builtin Manual).
# Filesize=175684 bytes.

Enjoy...
# 80  
Old 06-06-2016
Your script still has the printf bug, you should do printf "%s" "stuff" whenever the input is a variable. You also use unquoted strings in a number of places.

As you consider your script a teaching script, it is really doing people a disservice to teach them these bad habits, and the longer you put off fixing it, the harder it will be to do.
# 81  
Old 06-06-2016
For example
Code:
printf "%s" "$data"

In addition you can do the following (double-)optimization
Code:
printf '#!/bin/bash
data="\\\\xFF\\\\xFF\\\\xFF\\\\xFF\\\\x00\\\\x00\\\\x00\\\\x00"
for waveform in {0..8191}
do
        printf "$data"
done > /tmp/squarewave.raw
while true
do
        /full/path/to/sox/play -b 8 -r 8000 -e unsigned-integer /tmp/squarewave.raw
        read -r -p "Press ENTER to rerun OR Ctrl-C to quit:- " -e kbinput
done
' > /tmp/VERT_SOX.sh

# 82  
Old 08-08-2016
OK, AudioScope.sh is now at Version 0.50.20...

There are things that are now broken due to OS changes over the years.
I am NOT going to chase these as the code IS licenced as CC0 and you can do it for yourselves.
These are the ones I know about.

1) As of Windows 10, 'SoundRecorder.exe' no longer exists and is now called 'Voice Recorder'. I have
no idea if it can run in the background as I do NOT intend to take CygWin(64) any further. So consider
WINSOUND capture unavailable beyond Windows 8.1. CygWin(64) still has /dev/dsp so that is the ONLY real
capture mode available. SOX in CygWin(64) is not, and has never been, catered for.

2) 'xterm' is now deeply hidden inside OSX 10.11.x and is not in the path when called, this also
applies to some current Linux flavours and requires an xterm install for correct running of the code.
I do not intend to check for availablity as usually a second computer is required for calibration due
to crosstalk using the same computer for both Input and Output down the same socket.

3) QuickTime Player is broken as of OSX 10.10.x and above so OSX107MBP background capture mode is no
longer available. I have tried to solve it but cannot get it to work. ;o(

There are still changes to do to the script to remove old legacy stuff and use current techniques and
they will be changed in due course.

There are 24 files including AudioScope.sh itself created during program run. Most are not used in normal
running but are needed for calibration and test purposes, these are the files and their sizes, extracted
from the AudioScope.Manual...

Code:
# Files saved to the "/tmp/" directory.
#
# -rw-r--r--  1 barrywalker  wheel  48000  4 Aug 21:06 0000000000.BIN
# -rwxr--r--  1 barrywalker  wheel    508  4 Aug 21:06 1KHz-Test.sh
# -rwxr-xr-x  1 barrywalker  wheel    293  4 Aug 21:08 Arduino_9600.pde
# -rw-r--r--  1 barrywalker  wheel    253  4 Aug 21:06 VERT_BAT.BAT
# -rw-r--r--  1 barrywalker  wheel    303  4 Aug 21:06 VERT_DSP.sh
# -rw-r--r--  1 barrywalker  wheel    344  4 Aug 21:06 VERT_SOX.sh
# -rw-r--r--  1 barrywalker  wheel      1  4 Aug 21:06 dcdata.raw
# -rw-r--r--  1 barrywalker  wheel  65580  4 Aug 21:06 pulse.wav
# -rw-r--r--  1 barrywalker  wheel  65580  4 Aug 21:06 pulse1.wav
# -rwxr-xr-x  1 barrywalker  wheel    107  4 Aug 21:07 pulsetest.sh
# -rw-r--r--  1 barrywalker  wheel  48000  4 Aug 21:06 sample.raw
# -rw-r--r--  1 barrywalker  wheel 680000  4 Aug 21:06 signed16bit.txt
# -rw-r--r--  1 barrywalker  wheel  65536  4 Aug 21:06 sinewave.raw
# -rw-r--r--  1 barrywalker  wheel  65580  4 Aug 21:06 sinewave.wav
# -rw-r--r--  1 barrywalker  wheel   8000  4 Aug 21:06 squarewave.raw
# -rw-r--r--  1 barrywalker  wheel  65096  4 Aug 21:07 sweep.raw
# -rw-r--r--  1 barrywalker  wheel  65140  4 Aug 21:07 sweep.wav
# -rw-r--r--  1 barrywalker  wheel  32548  4 Aug 21:07 sweeper.raw
# -rw-r--r--  1 barrywalker  wheel   8000  4 Aug 21:06 symmetricalwave.raw
# -rw-r--r--  1 barrywalker  wheel  48000  4 Aug 21:07 waveform.raw
# -rw-r--r--  1 barrywalker  wheel  65580  4 Aug 21:06 waveform.wav
#
# Files saved in the "$HOME" directory.
#
# -rw-r--r--  1 barrywalker  staff  xxxxxx  4 Aug 20:54 AudioScope.Manual
# -rw-r--r--  1 barrywalker  staff     294  4 Aug 20:54 AudioScope.config
# -rwxr-xr-x  1 barrywalker  staff  xxxxxx  4 Aug 20:54 AudioScope.sh
# File size "xxxxxx" means it will get bigger as the project progresses.
#
# "dcdata.raw" will always be one byte in size.
#
# "Arduino_9600.pde" will only be FULLY generated when the Arduino Diecimila
# Board is detected. Otherwise one byte in size.
#
# "pulsetest.sh" will only be FULLY generated in "DEMO" and "/dev/dsp" modes,
# from the "POLARITY" command for CygWin(64) and some Linux flavours. Otherwise
# one byte in size.
#
# "signed16bit.txt" will only be FULLY generated in "CygWin" mode using Windows
# "SoundRecorder.exe" in quiet mode, otherwise one byte in size.
# (See Preface:- for more information.)
#
# These are all of the current files generated for the AudioScope.sh project.
# They are needed in conjunction with home built calibration hardware to
# calibrate this project. AudioScope.sh itself MUST always be in your
# "$HOME" drawer\directory\folder.

The stats for the script so far:-

# Total Lines=4253.
# Blank Lines=29.
# Code Lines=1989.
# Comments=2235, (including the builtin Manual).
# Filesize=180552 bytes.

Enjoy thinking and doing things for yourselves instead of adapting existing technology.

As usual if you download the file, place it in your $HOME darwer and rename to AudioScope.sh, and change your permissions.

Bazza...

Last edited by wisecracker; 08-08-2016 at 07:52 AM..
These 2 Users Gave Thanks to wisecracker For This Post:
# 83  
Old 09-28-2016
OK, this release now has lots of updates to suit current programming requirements.
$[ ( expression ) ] is now superceded by $(( expression )) .

printf "String with variables" is now superceded by printf "%[?]" "some variables and strings[etc]"

Backticks ` command ` now superceded by $( command )

Some parts that can be made literally 'sh' compatible, made so.

Some minor code cleanup...

I have done as much bug checking as possible but these changes may still have something hidden that I have not caught yet so beware.

Stats so far making this version slightly smaller:-

# Total Lines=4253.
# Blank Lines=29.
# Code Lines=1989.
# Comments=2235, (including the builtin Manual).
# Filesize=180397 bytes.

Bazza...
This User Gave Thanks to wisecracker For This Post:
# 84  
Old 12-04-2016
AudioScope.sh is now MUCH more OSX centric and at Version 0.60.00.

It now uses a _silent_ QuickTime Player capture mode that works FROM OSX 10.12.x Sierra as a minimum. It will have no more testing on CygWin and only limited Linux testing.

It is being continued inside the OSX forum, as a follow on, here:-

AudioScope Project.

Consider this thread now closed.

Enjoy all.

(Admin/Moderators please close this thread, thank you.)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. OS X (Apple)

A simple variable frequency sinewave audio generator.

Hi all... Well I have not been inactive but working out how to make OSX 10.14.x command line audio player have a variable sample rate. This is a back door as afplay does not have a sample rate flag unlike aplay for ALSA, in Linux flavours. This is a DEMO only but a derivative of it will... (2 Replies)
Discussion started by: wisecracker
2 Replies

2. Shell Programming and Scripting

Generate 10000 unique audio file of 2MB each using shell script.

Hi, I want 10000+ unique Audio file of approx 2MB each. How can i generate numerous audio files using shell script. Any tool, command or suggestions are welcome. If i give one audio seed file then can we create numerous unique files with same seed file? Any help is highly appreciable.... (11 Replies)
Discussion started by: sushil.kumar
11 Replies

3. OS X (Apple)

Python script to do simple audio capture...

This site is the first to get this snippet. It will capture an audio recording of any time length within the limits of OSX's QuickTime Player's capablility... A shell script derivative of this will be used as a further capture for CygWin's AudioScope.sh. Thoroughly read ALL the comments in... (0 Replies)
Discussion started by: wisecracker
0 Replies

4. UNIX for Dummies Questions & Answers

unable to start shell script

Hi, Pleasse could someone advise why i'm getting this error below - No such file or directory dev6:$ ls -ltr ReleaseManagement.sh -rwxr-xr-x 1 dev fix 4830 Aug 22 11:13 ReleaseManagement.sh dev6:$ ./ReleaseManagement.sh : No such file or directory dev6:$ thank you (2 Replies)
Discussion started by: venhart
2 Replies

5. Shell Programming and Scripting

The scope of the shell/perl script is to read the input text file. Validate the expiry date of each

The scope of the shell/perl script is to read the input text file. Validate the expiry date of each certificate and send the mail to the user. The user takes action to add the new certificate to the storage file and user owns the responsibility to update the input text file with the new certificate... (5 Replies)
Discussion started by: casmo
5 Replies

6. What is on Your Mind?

Scope of Shell Programming and scripting

Hi all, I want to know what is the scope and job status of shell Programming and scripting. Does it have any attractive jobs? (2 Replies)
Discussion started by: malikshahid85
2 Replies

7. Shell Programming and Scripting

Help with stop/start Shell Script.

Hi All, I would like to develop a shell script for stop & start an application server (1-4) on Solaris box. Here are the user requirements for this task. 1. User will input the option which server they wish to stop. 2. Will clear cache files from specific location. 3. ... (1 Reply)
Discussion started by: venga
1 Replies

8. Shell Programming and Scripting

scope of a Variable inside shell script

hi all, i'm using the following script, Status=1 Function_do () { while read line; do if ; then #echo $line if ; then Status=0 echo " LINKINK ERROR " fi fi done < ldd.log } Function_do (4 Replies)
Discussion started by: vij_krr
4 Replies

9. Shell Programming and Scripting

simple shell - how to get a parameter typed in a shell script

Hi, I am new to unix and using linux 7.2. I would like to create a script that would make it easyer for me to run my java programms. At the moment I have to type java myJavaprogram I am trying to write a script that will allow me to type something like this "myscript myJavaprogram" or maybe... (4 Replies)
Discussion started by: cmitulescu
4 Replies

10. Shell Programming and Scripting

problem with shell variable's scope

Hi, I am stuck while developing a shell sub-routine which checks the log file for "success" or "failure". The subroutine reads the log file and checks for key word "success", if found it set the variable (found=1). It returns success or failure based on this variable. My problem is, I can... (2 Replies)
Discussion started by: cjjoy
2 Replies
Login or Register to Ask a Question