Unix/Linux Go Back    


OS X (Apple) OS X is a line of Unix-based graphical operating systems developed, marketed, and sold by Apple.

AudioScope Project.

OS X (Apple)


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 12-04-2016
wisecracker's Unix or Linux Image
wisecracker wisecracker is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 27 April 2017, 6:06 AM EDT
Location: Loughborough
Posts: 1,190
Thanks: 356
Thanked 318 Times in 248 Posts
AudioScope Project.

AudioScope Project.

(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:-

Code:
# The builtin HELP:-
# ------------------
# These commands will be expanded upon later, type HELP<CR> to show these
# commands. Note that the commands are nearly all UPPER CASE ONLY. They are
# paged so just press <CR> to see the next page. So far there are three pages.
#
# <CR> .............................................. Reruns the scan(s) again.
# RUN<CR> ...................... Reruns the scan(s), always with real captures.
# QUIT<CR> OR EXIT<CR>...................................... Quits the program.
# HELP<CR> ............................................. This help as required.
# HOLD<CR> ..................................... Switch to pseudo-storage mode.
# DEMO<CR> ....... Switch capture to default DEMO mode and 10 continuous scans.
# DSP<CR> ................... Switch capture to Linux /dev/dsp mode and 1 scan.
# SOX<CR> .... Switch capture to multi-platform SOund eXchange mode and 1 scan.
# ONE<CR> ...................................... Sets the number of scans to 1.
# TEN<CR> ..................................... Sets the number of scans to 10.
# HUNDRED<CR> .......... Sets the number of scans to 100, (not very practical).
# VER<CR> ............... Displays the version number inside the status window.
# TBVAR<CR> ......... Set up uncalibrated user timebase offset and jump points.
#      SubCommands: ............................. Follow the on screen prompts.
# FASTEST<CR>, SLOWEST<CR> ... Set timebase to the fastest or slowest possible.
# 1mS<CR>, 2mS<CR>, 5mS<CR> ............ Set scanning rate to 1, 2, or 5mS/DIV.
# 10mS<CR>, 20mS<CR>, 50mS<CR> ....... Set scanning rate to 10, 20 or 50mS/DIV.
# 100mS<CR> ................................... Set scanning rate to 100mS/DIV.
# VSHIFT<CR> ........ Set the vertical position from -4 to +4 to the mid-point.
#      SubCommands: ............ Press U or D then <CR> when value is obtained. 
# DRAW<CR> ....... Connect up each vertical plot to give a fully lined display.
# TRIG<CR> ........ Sets the synchronisation methods for storage mode retraces.
#      SubCommand: SYNCEQ<CR> .. Synchronise from a variable, fixed value only.
#      SubCommand: SYNCGT<CR> ......... Synchronise from a positive going edge.
#      SubCommand: SYNCLT<CR> ......... Synchronise from a negative going edge.
#      SubCommand: EXT<CR> ............ SOX ONLY! Follow the on screen prompts.
# SAVEON<CR> ................. Auto-saves EVERY scan with a numerical filename.
# SAVEOFF<CR> ........................... Disables auto-save facility, default.
# ZOOM<CR> ............................. Low signal level gain, ZOOM, facility.
#      SubCommand: 0<CR> ................. Default lowest zoom/gain capability.
#      SubCommand: 1<CR> ............................. X2 zoom/gain capability.
#      SubCommand: 2<CR> ............................. X4 zoom/gain capability.
#      SubCommand: 3<CR> ............................. X8 zoom/gain capability.
#      SubCommand: 4<CR> ............................ X16 zoom/gain capability.
#      SubCommand: <CR> ...... To exit zoom mode when waveform has been viewed.
# HSHIFT<CR> ......... Shift the trace left or right at the highest scan speed.
#      SubCommand: L ........................ Shift the trace left by one byte.
#      SubCommand: l ... Shift the trace left by 64 bytes, (one complete scan).
#      SubCommand: R ....................... Shift the trace right by one byte.
#      SubCommand: r .. Shift the trace right by 64 bytes, (one complete scan).
#      SubCommand: Q or q ........ Exit back to normal usage, (quit this mode).
# RESET<CR> ......................... Do a complete COLD restart of the script.
# FREQ<CR> .. Measure a symmetrical waveform's frequency, accuracy 0.1 percent.
# MODE<CR> Display the X, Y, coupling and mode ranges inside the status window.
# STATUS<CR> . Display the previous status for 3 secs inside the status window.
# LOAD<CR> .................................. Load a binary file for reviewing.
#      SubCommand: ............................... Follow the on screen prompt.
# AC<CR> ......................... Set vertical input to default AC input mode.
# DC<CR> ............................ Attempt to measure DC polarity and level.
# BURST<CR> ........ Play an 8 second sinewave.wav burst using afplay or aplay.
# ARDDET<CR> ................ Detect an Arduino (Diecimila) Board if available.
#      SubCommand: .............................. Follow the on screen prompts.
# ALTDC<CR> ........ Alternate home built DC input device using the sound card.
#      SubCommand: ................................................ UNFINISHED.
# POLARITY<CR> ........... Generate pulse waveforms purely for amplifier tests.
# QTMAC<CR> ........... EXPERIMENTAL MAC, (MBP), QuickTime Player capture mode.
# WINSOUND<CR> ..... Special Windows SoundRecorder.exe for CygWin capture mode.
# ALSA<CR> ................. Special Linux command line, arecord, capture mode.
# SWEEP<CR> .............................. Sweep generator for bandwidth tests.
# SAVE<CR> ............................ Manually save the current scan to disk.
# V<CR> ...... Set the vertical Volts per Division range, (10mV), 100mV to 10V.
#      SubCommand: .............................. Follow the on screen prompts.
#
# !!!Use capture modes QTMAC<CR>, WINSOUND<CR> and ALSA ENTIRELY AT YOUR
# OWN RISK!!!

Enjoy.

Barry...
Attached Thumbnails
AudioScope Project.-06000-jpeg  
Attached Files
File Type: sh AudioScope.sh (179.6 KB, 1 views)
The Following User Says Thank You to wisecracker For This Useful Post:
Corona688 (1 Week Ago)
Sponsored Links
    #2  
Old Unix and Linux 12-29-2016
wisecracker's Unix or Linux Image
wisecracker wisecracker is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 27 April 2017, 6:06 AM EDT
Location: Loughborough
Posts: 1,190
Thanks: 356
Thanked 318 Times in 248 Posts
Hi all...

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.

Enjoy...
Attached Thumbnails
AudioScope Project.-06060-jpeg   AudioScope Project.-as_cygwin-jpg  
Attached Files
File Type: sh AudioScope.sh (188.7 KB, 0 views)

Last edited by wisecracker; 12-30-2016 at 12:38 PM.. Reason: Added CygWin in Windows 10 snapshot.
The Following User Says Thank You to wisecracker For This Useful Post:
Corona688 (1 Week Ago)
Sponsored Links
    #3  
Old Unix and Linux 02-17-2017
wisecracker's Unix or Linux Image
wisecracker wisecracker is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 27 April 2017, 6:06 AM EDT
Location: Loughborough
Posts: 1,190
Thanks: 356
Thanked 318 Times in 248 Posts
(AudioScope.sh)
06150.sh

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.

Enjoy...
Attached Thumbnails
AudioScope Project.-06150-jpeg  
Attached Files
File Type: sh 06150.sh (191.9 KB, 1 views)
The Following User Says Thank You to wisecracker For This Useful Post:
Corona688 (02-17-2017)
    #4  
Old Unix and Linux 1 Week Ago
wisecracker's Unix or Linux Image
wisecracker wisecracker is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 27 April 2017, 6:06 AM EDT
Location: Loughborough
Posts: 1,190
Thanks: 356
Thanked 318 Times in 248 Posts
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.

Enjoy.

Bazza...
Attached Thumbnails
AudioScope Project.-06250_start-jpeg   AudioScope Project.-06250_second_run-jpeg   AudioScope Project.-06250_draw-jpeg   AudioScope Project.-06250_sox_1ms-jpeg  
Attached Files
File Type: txt 06250.sh.txt (202.3 KB, 0 views)
The Following User Says Thank You to wisecracker For This Useful Post:
Corona688 (1 Week Ago)
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
AudioScope... wisecracker What is on Your Mind? 0 06-26-2015 07:26 AM
The Alternate DC board for AudioScope.sh. wisecracker OS X (Apple) 9 06-25-2015 10:27 AM
AC to DC trigger pulse for AudioScope.sh. wisecracker OS X (Apple) 2 04-14-2014 05:47 AM
AudioScope has had a magazine review. <shock> wisecracker What is on Your Mind? 1 03-03-2014 03:02 PM



All times are GMT -4. The time now is 10:26 PM.