Experimental awk audio converter for CygWin and AudioScope.sh
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 very fast CD quality to 8 bit mono converter for CygWin.
In the process I am learning awk with a difference.
I have a shell version but it is very slow speed wise making it totally unusable for CygWin.
I have a fully working embedded audio capture using SoundRecorder.exe for CygWin using Windows Vista and 7, and I assume 8.x too.
It autosaves as a .WAV file, stereo, 16 bit signed depth at 44100 Hz sampling rate.
There are NO default tools to convert the audio to my usable state so awk is my only way for CygWin.
(There are for OSX and Linux however.)
I needed to convert this to a raw file at quantised 8 bit unsigned depth.
My MBP awk does not have the function strtonum() so the code below is a workaround.
With my limited knowledge of awk, I could only do this in two separate awk stages.
As 'dd' and 'od' ARE part of a default CygWin install then creating a pseudo file was easy.
using 'od' in the script creates a very large file formatted exactly like this:-
This gave me S1 to $8 per line input where $1, $3, $5 and $7 are the signed 16 bit left hand channel.
$2, $4, $6 and $8 are the 16 bit signed right hand channel.
Thus the first awk script converts the signed 16 bit decimal to unsigned 8 bit decimal, left hand channel only.
The second awk script then converts the unsigned 8 bit decimal to a pure binary file 44100 bytes in size.
It all works and is seriously quick on this MBP but it looks seriously ugly too.
This WHOLE shell script takes around 0.5 seconds to complete:-
Ignore the '\' after BEGIN, etc, as this is my way if making it a little easier for me to read.
Please tear it apart and if there are better methods please point me in the right direction...
Many thanks guys...
I await the flak...
Last edited by wisecracker; 10-31-2014 at 07:06 PM..
Reason: Correct minor spelling errors...
Hello,
Can someone please help me on this.:confused:
I have a file which has more than 1 million lines (XML file).
What I need is:
Search for "abcd" in the input file > output the result into a output.txt (colloum1)
Search for "efghi" in the input file > output the result in to... (3 Replies)
I'm trying to record audio using Audacity 2.0.5 installed from SlackBuilds. My system is 64-bit Slackware 14.1 and a sound card is Intel HD Audio. I didn't change my sound system to OSS. (Default sound system in Slackware 14.1 is ALSA, isn't it?) First, I set Internal Microphone slider in KMix... (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)
One my friend wrote one script on his machine linux, when I try to use it under cygwin I recive one error about the command awk. Is there someone can suggest me the way to fix the error? The script is wrote using gawk and I have no idea what kind of comand is used by cygwin.
This is the script:... (8 Replies)
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_... (7 Replies)