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 Bazza » Mon May 22, 2017 1:26 pm

AudioScope.sh Version 0.65.00.

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 as xterm has now been removed.
It is called 'NewCLI' and launched using the built in 'SHELL' command BEHIND the original shell/terminal; memories anyone? ;oD
Linux users that no longer have 'xterm', and YES there are some default installs that now don't, will have to modify the code themselves.

File listings are as such:-
Code: Select all
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 spectral 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?

Enjoy...
Attachments
Whistle_SpecAn.jpeg
The spectral display within the text mode limits.
Whistle_SpecAn.jpeg (85.1 KiB) Viewed 1057 times
Whistle_Zoom.jpeg
A simple whistle into the internal mic.
Whistle_Zoom.jpeg (101.17 KiB) Viewed 1057 times
06500.sh.txt
Download and rename inside $HOME to AudioScope.sh.
Change access rights to 755.
(212.03 KiB) Downloaded 28 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 » Tue May 23, 2017 10:03 am

Has this kind of character-based FFT display been done before? H-P or one of their customers could well have brewed up something like this in the late 1970s. Written for the early text-only HP3000 line in their flavour of Pascal or SPL (or, if you were the customer, in Fortran) and costing hundreds of dollars. With a graph plotter well beyond your budget, it could have been the sort of thing that you would print out on your text-only line printer and literally cut and paste into your golfball-typed report, ready for crappy reproduction on your xerox photocopier and distribution. My, it all sounds so unreal and retro-SF when I write it down in the 21st century, did we really live like that?
"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 » Tue May 23, 2017 7:23 pm

guy wrote:Has this kind of character-based FFT display been done before? H-P or one of their customers could well have brewed up something like this in the late 1970s. Written for the early text-only HP3000 line in their flavour of Pascal or SPL (or, if you were the customer, in Fortran) and costing hundreds of dollars. With a graph plotter well beyond your budget, it could have been the sort of thing that you would print out on your text-only line printer and literally cut and paste into your golfball-typed report, ready for crappy reproduction on your xerox photocopier and distribution. My, it all sounds so unreal and retro-SF when I write it down in the 21st century, did we really live like that?

Ha ha, if only there was a "like" button to save an extra upload...
Ahhh, Fortran, not part of an Apple install nor part of the XCode suite either. So no Fortran for the heavy FFT lifting for me. I don't know enough Perl so Python with the scipy module was my prime mover. I have absolutely no idea how to do it in AWK. Although RMS in AWK is 'seempul'. Because CygWin does not have 'bc'. 'dc', 'Python' or perhaps 'ksh' then floating point HAS to be done with AWK. So Python and hence FFT for the CygWin version is not possible.
However I hope you enjoy what you see with text mode only. ;o)
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 » Tue Jul 04, 2017 9:26 am

Well I have discovered that I was using a method to QUIT the program that was not allowed.
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 two images are now the 'QUIT' window and 'EXIT' windows.
(Note: the absolute paths are created through "$HOME"/path/to/file.)

Stats so far:-

# Total Lines=5128.
# Blank Lines=46.
# Code Lines=2356.
# Comments=2726, (including the builtin Manual).
# Filesize=221113 bytes.

Enjoy...
Attachments
06600.sh.txt
Place into your $HOME drawer and rename AudioScope.sh, then change permissions to execute.
(215.93 KiB) Downloaded 24 times
EXIT.jpeg
EXIT window.
EXIT.jpeg (15.73 KiB) Viewed 936 times
QUIT.jpeg
QUIT window.
QUIT.jpeg (46.29 KiB) Viewed 936 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 » Sat Jul 22, 2017 12:54 pm

(Apologies for any typos.)
Well with advent of the forums being _shut_down_ it looks as though I can no longer update AudioScope[.sh] here.

Farewell those of you who have followed it and thanks for the feedback over the years.

Thanks also to LXF for allowing me to post large doses of files and images.

I shelved the GitHub uploads because of problems I had with accessing the site and this along with LXF leaves the original outlet at 'www dot unix dot com' the only source for future ideas and updates.

Thanks to admins, mods and all others and farewell to this project...
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 » Sun Jul 23, 2017 8:02 am

Hi Bazza,

I am sure I could create a subdomain on my own site for you, and cut any HTML pages you might want help with.

Drop me a PM (or post here) if you'd like to explore that option further.
"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 » Sun Jul 30, 2017 6:45 pm

guy wrote:Hi Bazza,

I am sure I could create a subdomain on my own site for you, and cut any HTML pages you might want help with.

Drop me a PM (or post here) if you'd like to explore that option further.

Just seen this,,,
Hmmm, nice of you to offer.
I will be in touch...
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

Previous

Return to Programming

Who is online

Users browsing this forum: No registered users and 8 guests