(Apologies for any typos.)
For the few following......
AudioScope.sh...
Now at Version 0.60.00.
Well this baby has come a long way since its inception in January 2013. It is now at Version 0.60.00. It is MUCH more Apple centric now with a new OSX Sierra minimum _silent_ capture mode. The original OSX 10.7.x capture mode is now defunct although the code is commented out for older OSX versions - pre-Yosemite. It is left to the individual to workout and swap the two sections of code.
The capture is voice into the internal mic which is vertically uncalibrated but horizontally calibrated.
This is the original at day one of the development and this thread is now closed:- The Start Of A Simple Audio Scope Shell Script...
The code for this was only about 3KB in size...
Here are the stats for this latest version:-
# Total Lines=4325.
# Blank Lines=29.
# Code Lines=2022.
# Comments=2274, (including the builtin Manual).
# Filesize=183864 bytes.
Internal commands for subtle operation are as follows:-
Enjoy.
Barry...
This User Gave Thanks to wisecracker For This Post:
Well a lot has been going on behind the scenes here.
The latest Quicktime Player access for Sierra is now broken as of OSX 10.12.2. It works in 10.12.0 and 10.12.1 but is now broken again. <SIGH>
I am now abandoning Quicktime Player as a hidden capture mode. The code will be left in just in case a newer version of OSX works again, but I suspect Quicktime _Whatever_ will be phased out completely so I am chasing it no more.
I have done some major changes to allow for a seriously slow CygWin(64) running in the latest Windows 10. As quoted before Windows 10 no longer has SoundRecorder.exe so I am abandoning WINSOUND capture mode but leaving the code in for CygWin on Windows 8.1 and lower.
There is now a small, cyan, sub-window inside the main scanning window to display any DC component when enabled. In AC mode it will always show 0.000 Volts.
Although AC mode is now long since finished there is lots to do for DC mode.
As CygWin does NOT have the 'bc' or 'dc' commands on a standard install then 'awk' will have to do my floating point calculations for any average DC values on any random signal sent up the mic socket.
Stats so far for this Version 06060...
# Total Lines=4509.
# Blank Lines=30.
# Code Lines=2122.
# Comments=2357, (including the builtin Manual).
# Filesize=193247 bytes.
Because CygWin is so slow on Windows 10 I have to modify '/dev/dsp' capture timings due to OS time lags.
Boy oh boy the things I have learnt about OSes and their limitations is unreal.
A certain Linux flavour does not like the ZOOM facility, but hopefully this is now cured.
All needed files for the whole project are now saved to a new "$HOME"/Temp/ drawer. /tmp/ is no longer used.
These are saved to "$HOME" only:-
AudioScope.sh
AudioScope.config
AudioScope.Manual
Hopefully there are no critical bugs in 'DEMO', '/dev/dsp' and SOX modes.
The most important file other than the script itself is 'waveform.raw' and it sits in a directory generated by the script of "$HOME"/Temp.
On the very first ever run the files below are created inside the "$HOME"/Temp also generated at the same time. Every rerun of the script tests for this file and if it exists these are not regenerated.
This means the script runs almost instantly from a restart. However if the script command "RESET" is used then this is the same as a very first start and these files are regenerated.
More information added to the Manual.
Quicktime Player capture mode is once again working in OSX 10.12.2 and 10.12.3, Sierra.
The only single byte file that is genuine is the 'dcdata.raw' file. All other single byte files are place-marker files only for extras that the script might need for all facilities.
'Arduino_9600.pde' for The Arduino Diecimila Board if used. To be used to program the board for use on this project.
'Untitled.m4a' for QUicktime Player cpature mode ONLY.
'pulsetest.sh' for use on a second machine with the '/dev/dsp' audio device to calibrate the correct polarity of a waveform displayed, the 'POLARITY' command.
'signed16bit.txt' for CygWin AND Windows SoundRecorder.exe capture mode ONLY.
'sweep.wav' and 'sweep.raw' for a swept andio frequency generator, from 4KHz to around 85Hz and back twice, the 'SWEEP' command.
'symmetricalwave.wav' for Quicktime Player capture for the frequency counter.
Code:
Last login: Fri Feb 17 14:52:09 on ttys000
AMIGA:amiga~> ls -l Temp
total 1360
-rw-r--r-- 1 amiga staff 48000 17 Feb 14:50 0000000000.BIN
-rwxr-xr-x 1 amiga staff 609 17 Feb 14:50 1KHz-Test.sh
-rw-rw-rw- 1 amiga staff 1 17 Feb 14:50 Arduino_9600.pde
-rw-rw-rw-@ 1 amiga staff 1 17 Feb 14:51 Untitled.m4a
-rw-r--r-- 1 amiga staff 253 17 Feb 14:50 VERT_BAT.BAT
-rwxr-xr-x 1 amiga staff 329 17 Feb 14:50 VERT_DSP.sh
-rwxr-xr-x 1 amiga staff 370 17 Feb 14:50 VERT_SOX.sh
-rw-r--r-- 1 amiga staff 1 17 Feb 14:50 dcdata.raw
-rw-r--r-- 1 amiga staff 65580 17 Feb 14:50 pulse1.wav
-rw-r--r-- 1 amiga staff 65580 17 Feb 14:50 pulse2.wav
-rwxr-xr-x 1 amiga staff 1 17 Feb 14:50 pulsetest.sh
-rw-r--r-- 1 amiga staff 48000 17 Feb 14:50 sample.raw
-rw-r--r-- 1 amiga staff 1 17 Feb 14:50 signed16bit.txt
-rw-r--r-- 1 amiga staff 65536 17 Feb 14:50 sinewave.raw
-rw-r--r-- 1 amiga staff 65580 17 Feb 14:50 sinewave.wav
-rw-r--r-- 1 amiga staff 8000 17 Feb 14:50 squarewave.raw
-rw-r--r-- 1 amiga staff 1 17 Feb 14:50 sweep.raw
-rw-r--r-- 1 amiga staff 1 17 Feb 14:50 sweep.wav
-rw-r--r-- 1 amiga staff 80000 17 Feb 14:50 sweeper.raw
-rw-r--r-- 1 amiga staff 8000 17 Feb 14:50 symmetricalwave.raw
-rw-r--r-- 1 amiga staff 1 17 Feb 14:50 symmetricalwave.wav
-rw-r--r-- 1 amiga staff 48000 17 Feb 14:51 waveform.raw
-rw-r--r-- 1 amiga staff 99948 17 Feb 14:51 waveform.wav
AMIGA:amiga~> _
Script file statistics:-
# Total Lines=4566.
# Blank Lines=28.
# Code Lines=2129.
# Comments=2409, (including the builtin Manual).
# Filesize=196479 bytes.
The attached image is a whistle into the internal microphone using Quicktime Player as the capture source.
Well the screen now has frequency [COUNTER] and [ DC VOLTS ] windows both set to OFF when not enabled or not in use.
There is now a new startup screen on FIRST time run OR after a software RESET.
Four images from a cold first time run to SOX, showing the commands from QUIT to SOX...
I am now working on a low resolution pure text mode audio file converter and not sure whether to incorporate it into this project.
I had thought about an AF Spectrum Analyser but FFT(s) in shell scripting is really a none starter, unless I can incorporate say something like 'matlab' into it to do the heavy FFT lifting.
This single 'bash' script that creates everything including all calibration signals and text mode electronic circuits is now over 207,000 bytes in size...
The manual and quickstart notes can now be read is situ using either 'less' or 'more'. 'less' is the first chioce but switches to more if that doesn't exist.
Code:
# Files saved to the ""$HOME"/Temp/" directory.
#
# -rw-r--r-- 1 barrywalker wheel 48000 4 Aug 21:06 0000000000.BIN
# -rwxr--r-- 1 barrywalker wheel 585 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 staff 65536 4 Nov 21:08 Untitled.m4a
# -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 pulse1.wav
# -rw-r--r-- 1 barrywalker wheel 65580 4 Aug 21:06 pulse.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 staff 20071 4 Aug 21:06 symmetricalwave.wav
# -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 amiga staff xxxxx 17 Apr 17:09 AudioScope.Circuits
# -rw-r--r-- 1 amiga staff xxxxxx 17 Apr 17:09 AudioScope.Manual
# -rw-r--r-- 1 amiga staff xxx 17 Apr 17:09 AudioScope.Config
# -rwxr-xr-x 1 amiga staff xxxxxx 17 Apr 17:08 AudioScope.sh
# -rw-r--r-- 1 amiga staff xxxx 17 Apr 17:09 AudioScope_Quick_Start.Notes
# File size "xxxxxx" means it will change as the project progresses.
Change 06250.sh.txt to AudioScope.sh and place into the $HOME directory.
Change access rights to 755...
Stats so far:-
--------------
# Total Lines=4797.
# Blank Lines=28.
# Code Lines=2201.
# Comments=2568, (including the builtin Manual).
# Filesize=207173 bytes.
Not an upload but this is a taster for what is to come.
The spectrum analyser is completed and nothing like the primitive free version previously uploaded here.
The images start with a voice capture using SOX and displayed at 5mS/Division, Note the red CAPTURE mode inside the top little window. In the COMMAND window the command SPECAN is ready to be entered.
Once entered the next image prompts for an External source for measurement input, for example the external microphone. 'N' will be entered and a 48000 byte main capture raw file is converted to an 8000 byte version for the limited 4KHz resolution of this code. I will try and extend to at least 24KHz resolution at a later date.
After a few seconds the spectrum displays this low resolution capture. This will automatically switch from main red CAPTURE mode to green STORAGE mode for the last image to write protect the current main capture. This display awaits an ENTER to return to the STORAGE screen of the original capture.
This User Gave Thanks to wisecracker For This Post:
This a major upload and includes the limited Audio Frequency Spectrum _Analyser_ to 4KHz.
This has a relative _calibration_, not an absolute one.
This Spec-An is NOT available for CygWin as there is no access to at least Python 2.7.x in a default CygWin install.
OSX 10.12.x and above specific creating of a new terminal added.
Many thanks to 'xbin' for the code for this.
Also many thanks to much of Corona688's additions and following of this, much of which is inside this script in various modified formats.
File listings are as such:-
Code:
The "$HOME" drawer.
-rw-r--r-- 1 amiga staff 20715 20 May 13:40 AudioScope.Circuits
-rw-r--r-- 1 amiga staff 307 20 May 13:40 AudioScope.Config
-rw-r--r-- 1 amiga staff 115248 20 May 13:40 AudioScope.Manual
-rwxr-xr-x 1 amiga staff 217121 20 May 12:52 AudioScope.sh
-rw-r--r-- 1 amiga staff 6319 20 May 13:40 AudioScope_Quick_Start.Notes
The "$HOME"/Temp drawer.
0000000000.BIN pulse[1].wav sweep.raw
1KHz-Test.sh pulse[2].wav sweep.wav
Arduino_9600.pde pulsetest.sh sweeper.raw
Untitled.m4a sample.raw symmetricalwave.raw
VERT_BAT.BAT signed16bit.txt symmetricalwave.wav
VERT_DSP.sh sinewave.raw waveform.raw
VERT_SOX.sh sinewave.wav waveform.wav
dcdata.raw squarewave.raw
The /tmp/drawer for the spectrum display.
(From the manual.)
# SPECAN<CR>, This is the built in AF spectrum analyser that has an upper limit
# of 4KHz. This is experimental and generates a stand alone 'bash' script that
# includes a stand alone Python script to do the FFT heavy lifting. It uses the
# built in frequency counter to capture an external signal, otherwise it will
# use AudioScope's capture and convert it to a 'WAV' file. The files generated
# are saved into the '/tmp/' drawer and not permanantly kept. If you want to
# extract these files they are:-
#
# -rw-r--r-- 1 amiga wheel 914 27 Apr 19:29 FFT_WAV.py
# -rwxr-xr-x 1 amiga wheel 4705 27 Apr 19:29 Spec_An.sh
# -rw-r--r-- 1 amiga wheel **** 27 Apr 19:29 bash_array
# -rw-r--r-- 1 amiga wheel 48000 27 Apr 19:29 symmetricalwave.raw
# -rw-r--r-- 1 amiga wheel 8044 27 Apr 19:29 symmetricalwave.wav
# The '****' file length varies per the command 'SPECAN' call.
#
# The only important ones are 'FFT_WAV.py' and 'Spec_An.sh'.
# The files 'Spec_An.sh' and FFT_WAV.py are licenced as GPL2.
# A typical coloured disply looks something like this:-
#
# ++-------[ $VER Spec_An.sh_(C)2017_B.Walker_GPL2_Licence.]-------++
# 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++100
# || | | | | | | | ||
# 90 ++ | | | | | | | ++ 90
# R || | | | | | | | ||
# E 80 ++ | | | | | | | ++ 80
# L || * | | | | | | | ||
# A 70 ++ * | | | | | | | ++ 70
# T || * * | | | | | | | ||
# I 60 ++ * * | | | | | | | ++ 60
# V || * * | * | | | | | ||
# E 50 ++ * * | ** * | | | | | ++ 50
# || * * * ** ** | | | | | ||
# L 40 ++ * ** * * ** ** | | | | | ++ 40
# E || * ** ** * ** ** * ** * * | | | | ||
# V 30 ++ **** ** * ** ** * ** **** * | | | | ++ 30
# E || ******* ******* * ** **** ** | | | | ||
# L 20 ++ ******* ********* ** ******* | ** * | | ++ 20
#Log10(X)|| ***************************** ***** ***** * *| **** ** ||
# 10 ++ *********************************************** ******* ** ***+ 10
# ||****************************************************************|
# 0 +*****************************************************************+ 0
#FREQ Hz +0------500----1000----1500----2000----2500----3000----3500----4000
# Press <CR> to continue:-
Now working on true RMS for any random signal now, and it looks as though AWK might just do it.
Many more things like Average Voltage, LF frequency using the Chopper and much more.
The stats for the current incarnation.
# Total Lines=5045.
# Blank Lines=45.
# Code Lines=2334.
# Comments=2666, (including the builtin Manual).
# Filesize=217121 bytes.
The images are a whistle into the internal mic using SOX as the prime mover, zoomed in 8x.
A psectral display of the same whistle.
In this current state 'SPECAN<CR>' gives you the option of looking at the proper capture or an external one, but only to 4KHz
The power of the *NIX style shell, utilities and terminal!
Has anything like this ever been done before I wonder?
Well I have discovered that I was using a method to QUIT the program that was not allowed.
Thanks to Corona688 for putting me straight and using the correct method to quit now.
This was apparantly a major bug in bash and was in there until at least bash version 4.3.42.
When tested on bash 4.4.5 the bash bug had been removed and created a bug in the code, it is now cured.
There are two separate closedown modes available now:-
'QUIT<CR>' that quits, saving all four of the AudioScope files saved inside '$HOME'.
'EXIT<CR>' that literally exits without saving those files.
It has come to my attention that some terminals are NOT 80 x 24 or 25 from a default install.
In fact one comes in at 77 x 23, one wonders why? After all it is NOT a classic AMIGA which does have that sized CLI.
Well I have had to use this terminal escape code to correct to the size for AudioScope.sh "\x1B[8;24;80t" to force a size increase.
The original size is saved as stty size and the values used to reset the terminal size back to default state on 'QUIT' or 'EXIT'.
Of course this method might be subject to some terminals not responding to the escape codes so manual resizing will be needed.
The four images are a sung note, the spectrum up to 4KHz of said note, the 'QUIT' window and 'EXIT' window.
(Note: the absolute paths are created through "$HOME"/path../file .)
RMS code for fixed waveforms is done but not incorporated in this version.
Stats so far:-
# Total Lines=5128.
# Blank Lines=46.
# Code Lines=2356.
# Comments=2726, (including the builtin Manual).
# Filesize=221113 bytes.
Using AudioScope.sh on Ubuntu 17.04 from a live DVD disc I came across an error.
Consider the code below it is a MUCH shortened version of the KEYBOARD input in AudioScope.
#!/bin/bash
bash --version
uname -a
status=0
KEYBOARD()
{
read -r -p "Enter QUIT or EXIT to quit:- " kbinput
if ||... (11 Replies)
Hi all...
Apologies for any typos...
For those intersted in the AudioScope the next construction is finished.
I have not been totally idle but working out the hard stuff to be able to be very simple to build.
It is a single transistor simple timer that lasts for about 1.2 to 1.8 seconds.... (2 Replies)
Boy oh boy, with only a MONO mic input to use AudioScope gets much more difficult when the ALTDC board is included.
It needs, so far, two hits at the MIC input with a single hit at the HEADPHONE audio output.
The first at the highest practical resolution for the AC component and the second... (0 Replies)
Hi guys...
Well I have entered an area of partial insnity... ;o)
Below is a photo of the 'ALTDC' board for AudioScope.sh...
I have decided to incorporate all three methods for obtaining DC into this MBP via the MIC input.
1) VFO.
2) CHOPPER.
3) COUNTER.
The controller for the COUNTER... (9 Replies)
Development machine:- Standard MBP 13 inch, OSX 10.7.5...
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)
Copyright (C) 2007 Free Software Foundation, Inc.
Scenario:- Audio capture for AudioScope.sh for CygWin without ANY third party installs.
I am trying my hardest to get a... (6 Replies)
Hi all...
Has _below_ ever been done in UNIX shell scripting before?
(I have done this easily in Python but this is using purely the shell.)
The DEMO version IS built and has been tested.
Pre-amble...
I now need at least one control pulse for the AudioScope.sh when in PURELY audio I/O mode,... (2 Replies)
Hi Admin and Staff...
Thanks for hosting AudioScope.sh on this site. I have had the biggest surprise of my life today.
This months issue of the UK Linux magazine "Linux Format" have done a small piece on the project.
Issue April 2014, LXF 182, page 65...
This I never expected and I... (1 Reply)
A new project was posted on your project board.
Project title: Bash Shell Tutoring
Estimated Budget:
$50/hr
Start date:
Immediately
Required skills:
Linux, Bash, Shell, UNIX
I work as a datawarehouse designer and developer.
Although I usually stick to the role of an analyst,... (0 Replies)
We have a system running ssh. When a user logs in, they do not get the project they are assigned to (they run under "system"). I verify the project using the command "ps -e -o user,pid,ppid,args,project". If you do a "su - username", the user does get the project they are assigned to (and all... (2 Replies)