OK, now the start of the audio scope...

Code junkies hangout here

Moderators: ChriThor, LXF moderators

Re: OK, now the start of the audio scope...

Postby guy » Sun Jun 28, 2015 9:26 pm

Hi Bazza,

As ever, I am impressed. I rather think your project has outgrown us Linux diehards in more ways than one.

'fraid I don't wield my soldering iron in anger much these days, and I'm sure you don't want all the old puns about negative feedback, but I'm thinking that much of this kind of educational/hobbyist tinkering these days is done round a Raspberry Pi running raspbian, the RP build of Debian. You might get that holy grail of more positive feedback combined with lower distortion if you seek out their newsgroups etc. :)

HTH
"We don't need no frikkin' aliens, we c'n do this ourselves!" — anon.
guy
LXF regular
 
Posts: 1323
Joined: Thu Apr 07, 2005 12:07 pm
Location: Worcestershire

Re: OK, now the start of the audio scope...

Postby Bazza » Mon Jun 29, 2015 11:09 am

guy wrote:Hi Bazza,

As ever, I am impressed. I rather think your project has outgrown us Linux diehards in more ways than one.

'fraid I don't wield my soldering iron in anger much these days, and I'm sure you don't want all the old puns about negative feedback, but I'm thinking that much of this kind of educational/hobbyist tinkering these days is done round a Raspberry Pi running raspbian, the RP build of Debian. You might get that holy grail of more positive feedback combined with lower distortion if you seek out their newsgroups etc. :)

HTH

Hi guy...
Cheers matey, and "negative feedback", ha ha.
I have 2 Arduinos and 2 Raspberry Pis. I haven't done much with them recently as I/O is too easy, both analogue and digital. I love working on the limits.

I must admit though that I can understand why people abandon their prized applications ofter years of updates, modifications and bug cures.
I am getting application fatigue myself with this tool.

As it stands AudioScope only needs the Vertical Amp to be calibrated and it can be used stand alone as a simple, isolated input, AC only, measuring tool albeit to 4 bit depth visually, but 8 bit depth in actuality.

Thanks for the comment.

Bazza...
73...

Bazza, G0LCU...

Team AMIGA...

The less that I speak, the smarter I sound.
User avatar
Bazza
LXF regular
 
Posts: 1594
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Re: OK, now the start of the audio scope...

Postby Bazza » Mon Sep 14, 2015 9:18 am

Hi all...

AudioScope.sh Version 0.32.41...
Well the DC controlled switcher board is now completed.

For those interested 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.
( As is well known the MBP 13" laptop only has a single pole microphone input and no line inputs so:- )

It is a single transistor simple timer that lasts for about 1.2 to 1.8 seconds.
The time length is not important as one can code around it.

How it works.
When AudioScope.sh is run several test files are generated and placed into the '/tmp/' drawer. One of these files is a one second 2KHz square wave RAW file at 8 bit depth, unsigned integer and 8KHz sample rate.
It is set to this so that '/dev/dsp' and 'SOX' can use it directly. I have decided that all of the ALTDC modes MUST be used with SOX capture only, so for these extras SOX becomes a dependency.
The filename is called squarewave.raw. When used in normal, ('/dev/dsp'), mode it is a 1 second 2KHz poor example of a square wave. HOWEVER, it is called using SOX and at 48KHz sample rate.
This creates about a 170mS burst of a square wave at 12KHz. This is fed to the earphone output on the MBP and from there to the DC_Control board.
This board is a voltage doubler and its output at around 2.5 Volts for 170mS is fed to the timer board. This fires the timer board to hold a relay for about the times mentioned above.

The two sets of relay contacts are completely isolated and can be used to switch the input and/or output from the AC signal to the DC one.

There are two captures when in ALTDC and SOX capture mode; the first capture is the normal AC one through the Y amplifier.
The second is the timer switcher to allow the current guise, the VFO, to have enough time for a 1 second capture for the frequency counter to count the number of cycles of this burst.
It is then converted to a voltage to the accuracy of 4 to 5 bit depth.
The positive DC component is displayed in the yellow part of the COMMAND window for a couple of seconds and AC component, (if any), in the DISPLAY window.

I hope this is lucid enough...

The circuit is near the end of this script and the code finished to suit the VFO mode of ALTDC DC access.

A hook up wiring circuit has yet to be done, as is the VFO circuit. In text mode these take a long time to draw and _proof_read_ so bear with me on this one.

Stats so far:-

# Total Lines=3780.
# Blank Lines=29.
# Code Lines=1916.
# Comments=1835, (including the builtin Manual).
# Filesize=154912 bytes.

If you DL the file be sure to put it into your $HOME drawer and rename to AudioScope.sh and to set the executable flags as required.

Enjoy...

Bazza...
Attachments
Trig_Lores.jpg
Trig_Lores.jpg (133.14 KiB) Viewed 2400 times
DC_Board.jpg
DC_Board.jpg (67.91 KiB) Viewed 2400 times
03241.sh.txt
AudioScope bash shell script...
(151.28 KiB) Downloaded 55 times
Last edited by Bazza on Mon Sep 21, 2015 8:28 am, edited 1 time in total.
73...

Bazza, G0LCU...

Team AMIGA...

The less that I speak, the smarter I sound.
User avatar
Bazza
LXF regular
 
Posts: 1594
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Re: OK, now the start of the audio scope...

Postby guy » Wed Sep 16, 2015 10:54 am

That all looks a great project. Still thinking about schools and colleges, they have these Raspberry Pis etc. lying around and even if it is easy to use the built-in i/o that is no reason to turn their noses up at an educational hardware project. I still think this is a great opportunity to get into the kind of thing that actually goes on inside them.
"We don't need no frikkin' aliens, we c'n do this ourselves!" — anon.
guy
LXF regular
 
Posts: 1323
Joined: Thu Apr 07, 2005 12:07 pm
Location: Worcestershire

Re: OK, now the start of the audio scope...

Postby Bazza » Mon Dec 21, 2015 5:32 pm

Hi guys and gals...

Well I have not been entirely idle on this baby but CygWin64 has given me a few minor headaches.

There has been some code changes to prevent some errors inside CygWin, other platforms are not affected...

There is also a cosmetic change to the display...

The white [DISPLAY] section changes to green [STORAGE] mode when stopped in HOLD mode or red [CAPTURE] mode when stopped in RUN mode.
The white [DISPLAY] is still there during plotting and EXT trigger in waiting mode.

The manual has had a little more done to it...

Stats:-

# Total Lines=3797.
# Blank Lines=30.
# Code Lines=1915.
# Comments=1852, (including the builtin Manual).
# Filesize=155775 bytes.

Added CygWin window of current version.
This uses SoundRecorder.exe in quiet mode...

Enjoy...
Attachments
CygWin.png
CygWin.png (12.66 KiB) Viewed 1925 times
03250.sh.txt
Rename as AudioScope.sh and run from your $HOME drawer...
(152.12 KiB) Downloaded 23 times
73...

Bazza, G0LCU...

Team AMIGA...

The less that I speak, the smarter I sound.
User avatar
Bazza
LXF regular
 
Posts: 1594
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Re: OK, now the start of the audio scope...

Postby Bazza » Fri May 13, 2016 3:08 pm

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.

Enjoy...

The image is dsiplaying speech at low level...

EDIT:
Forgot to add probe photo...
Attachments
probe.jpg
probe.jpg (57.66 KiB) Viewed 1787 times
03270.jpg
03270.jpg (109.91 KiB) Viewed 1812 times
AudioScope.sh.txt
Latest version 03270...
(155.66 KiB) Downloaded 21 times
73...

Bazza, G0LCU...

Team AMIGA...

The less that I speak, the smarter I sound.
User avatar
Bazza
LXF regular
 
Posts: 1594
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Re: OK, now the start of the audio scope...

Postby Bazza » Sun Jun 05, 2016 5:11 pm

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...
Attachments
AudioScope.sh.txt
Remember to upload to $HOME and rename to AudioScope.sh and set access rights.
(171.57 KiB) Downloaded 18 times
05000.jpg
05000.jpg (130.9 KiB) Viewed 1758 times
73...

Bazza, G0LCU...

Team AMIGA...

The less that I speak, the smarter I sound.
User avatar
Bazza
LXF regular
 
Posts: 1594
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Re: OK, now the start of the audio scope...

Postby Bazza » Wed Aug 10, 2016 11:54 am

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: Select all
# 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...
Attachments
05020.sh.txt
Rename to "AudioScope.sh" without the quotes, save inside your $HOME darwer and change permissions as required.
(176.32 KiB) Downloaded 20 times
73...

Bazza, G0LCU...

Team AMIGA...

The less that I speak, the smarter I sound.
User avatar
Bazza
LXF regular
 
Posts: 1594
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Re: OK, now the start of the audio scope...

Postby Bazza » Thu Sep 29, 2016 7:30 pm

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...
Attachments
05050.jpg
05050.jpg (115.24 KiB) Viewed 1542 times
05050.sh.txt
Rename to AudioScope.sh, change permissions and place inside $HOME.
(176.17 KiB) Downloaded 17 times
73...

Bazza, G0LCU...

Team AMIGA...

The less that I speak, the smarter I sound.
User avatar
Bazza
LXF regular
 
Posts: 1594
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Re: OK, now the start of the audio scope...

Postby Bazza » Thu Dec 29, 2016 10:32 pm

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.

Code: Select all
# 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 four 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...
Attachments
06060.sh.txt
This is version 0.60.60...
Rename to AudioScope.sh and run from your $HOME drawer.
(188.72 KiB) Downloaded 18 times
06060.jpeg
AudioScope.sh Version 0.60.60 image.
06060.jpeg (86.99 KiB) Viewed 1432 times
73...

Bazza, G0LCU...

Team AMIGA...

The less that I speak, the smarter I sound.
User avatar
Bazza
LXF regular
 
Posts: 1594
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Re: OK, now the start of the audio scope...

Postby Bazza » Thu Mar 02, 2017 2:46 pm

(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: Select all
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...
Attachments
06150.sh.txt
Rename to AudioScope.sh and place inside $HOME.
(191.87 KiB) Downloaded 12 times
06150.jpeg
Quicktime Player as the capture source...
06150.jpeg (100.25 KiB) Viewed 1312 times
73...

Bazza, G0LCU...

Team AMIGA...

The less that I speak, the smarter I sound.
User avatar
Bazza
LXF regular
 
Posts: 1594
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Re: OK, now the start of the audio scope...

Postby Bazza » Fri Apr 28, 2017 10:58 am

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.
Two images from a cold first time run to DEMO, 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:
Code: Select all
# 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...
Attachments
06250.sh.txt
As usual, download and rename to AudioScope.sh in the $HOME drawer.
(202.32 KiB) Downloaded 14 times
06250_Second_Run.jpeg
Re-start after first run.
06250_Second_Run.jpeg (83.26 KiB) Viewed 1155 times
06250_Start.jpeg
First run of code.
06250_Start.jpeg (122.87 KiB) Viewed 1155 times
Last edited by Bazza on Fri Apr 28, 2017 1:01 pm, edited 1 time in total.
73...

Bazza, G0LCU...

Team AMIGA...

The less that I speak, the smarter I sound.
User avatar
Bazza
LXF regular
 
Posts: 1594
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Re: OK, now the start of the audio scope...

Postby Bazza » Fri Apr 28, 2017 12:56 pm

Hopefully this does not attach itself to the previous upload today, 28-04-2017, of AudioScope.sh Version 06250.

The next release will include a low resolution audio spectrum analyser.

The bash code creates a python script that does the heavy FFT lifting. The python script uses the default OSX 10.12.4 python 2.7.x so that it what I coded for.

It also creates a stand alone shell script for the capture of a signal and display its spectrum to 4KHz maximum resolution. I am working on a much higher resolution using a special capture of 48000 samples per second to include the full normal "HI FI" 20Hz to 20KHz bandwidth all using bash and available utilities on a virgin OSX 10.12.4 install, my iMac.

Enjoy...

Bazza.
Attachments
Storage_Mode_Original.jpeg
Back to the main capture but now in write protect STORAGE mode
Storage_Mode_Original.jpeg (86.87 KiB) Viewed 1146 times
Spectrum_Of_Main_Capture.jpeg
After a prompt for an external source an 'N" pressed this main capture spectrum is displayed.
Spectrum_Of_Main_Capture.jpeg (103.96 KiB) Viewed 1146 times
Speech_SOX_Capture_Mode.jpeg
Speech capture using SOX in CAPTURE mode.
Speech_SOX_Capture_Mode.jpeg (87.57 KiB) Viewed 1146 times
73...

Bazza, G0LCU...

Team AMIGA...

The less that I speak, the smarter I sound.
User avatar
Bazza
LXF regular
 
Posts: 1594
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Re: OK, now the start of the audio scope...

Postby guy » Sat Apr 29, 2017 7:04 am

Love the spectrum analyzer idea. A thought on the display, if you are not well on top of it already. FFT-ing to full 20-20kHz resolution requires a sample rate of at least 40kHz which: a) requires 2,000 sample points along the waveform, and b) gives a frequency resolution throughout the spectrum of 20Hz - in turn yielding 1,000 distinct frequencies. How to navigate all that on a console? Answer: interactive zoom and scroll functions.
"We don't need no frikkin' aliens, we c'n do this ourselves!" — anon.
guy
LXF regular
 
Posts: 1323
Joined: Thu Apr 07, 2005 12:07 pm
Location: Worcestershire

Re: OK, now the start of the audio scope...

Postby Bazza » Mon May 22, 2017 11:06 am

guy wrote:Love the spectrum analyzer idea. A thought on the display, if you are not well on top of it already. FFT-ing to full 20-20kHz resolution requires a sample rate of at least 40kHz which: a) requires 2,000 sample points along the waveform, and b) gives a frequency resolution throughout the spectrum of 20Hz - in turn yielding 1,000 distinct frequencies. How to navigate all that on a console? Answer: interactive zoom and scroll functions.


The biggest problem is the default Terminal display. These are normally 80 characters wide but I use 64 of them, (2^6). However AudioScope already has, and has had, for about a year and a half now a built in hidden command 'HIRES' to capture at 192,000 sps, and would potentially give 96KHz AF range. This is however purely SOX dependent so I have not used it yet.

_Quantising_ down to 64 sections would compress the linear horizontal scale much too much, it's bad enough to 4KHz...

A logarithmic horizontal scale would be possible but would look absolutely dreadful in text mode...

So it is decisions - decisions - time, do I leave or got further. Probably the former.
73...

Bazza, G0LCU...

Team AMIGA...

The less that I speak, the smarter I sound.
User avatar
Bazza
LXF regular
 
Posts: 1594
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

PreviousNext

Return to Programming

Who is online

Users browsing this forum: No registered users and 6 guests