A simple variable frequency sinewave audio generator.
Hi all...
Well I have not been inactive but working out how to make OSX 10.14.x command line audio player have a variable sample rate.
This is a back door as afplay does not have a sample rate flag unlike aplay for ALSA, in Linux flavours.
This is a DEMO only but a derivative of it will be used in a kids level, variable, AUDIO Function Generator from around 50HZ to 20KHz for pure audio use.
The other limitation is that the shell script must adhere to full POSIX compliance.
I use dash in the script but it should work on the majority of shells.
How does it work?
Well it creates the file everytime you run the script in the following order:
First the frequency '$1' is converted to the big endian word, hex, sample rate.
Next the bytes are extracted and converted to octal.
Finally these octal bytes are reversed and a string created in the correct order.
Now the 'WAV' header is built up using octal values with the 'RATE' placed in the middle.
After that the 'DATA' is added which makes the whole file 65580 bytes in size.
Although this was designed purely for OSX's command line audio player it also works with the ALSA's one too.
USAGE: [./]VFO.sh <Integer FREQUENCY value from 250 to 6000>
As it is a DEMO there is only limited error detection!
Enjoy...
Bazza.
Last edited by wisecracker; 06-06-2019 at 06:01 PM..
Reason: Correct copy and paste error.
These 2 Users Gave Thanks to wisecracker For This Post:
IKHz_SW_OSX.py
A DEMO mono _pure_ sinewave generator using standard text mode Python 2.6.7 to at least 2.7.3.
This code is EASILY modifyable to Python version 3.x.x...
This DEMO kids level 1KHz generator is mainly for a MacBook Pro, (13 inch in my case), OSX 10.7.5 and above. See below...... (0 Replies)
A very simple crude sinewave generator.
The file required is generated inside the code, is linear interpolated and requires /dev/audio to work. Ensure you have this device, if not the download oss-compat from your OS's repository...
It lasts for about 8 seconds before exiting and saves a... (5 Replies)
Hi all...
I don't think this has been done before but I am open to being corrected...
This batch file generates a 65536 byte binary file to give 8 seconds of pure sinewave at the earphone/speaker output(s)...
It uses ONLY a default Windows 32 bit installation, to Windows 7, except for the... (0 Replies)
This is a small program as a tester for a basic sweep generator for bandwidth testing of AudioScope.sh.
This DEMO is only capable of 4KHz down to about 85Hz and back due to the low bit rate, but it is proof of concept for a much wider variant using a much higher bit rate.
The file generated... (4 Replies)
This site is the first to get this snippet.
It will capture an audio recording of any time length within the limits of OSX's QuickTime Player's capablility...
A shell script derivative of this will be used as a further capture for CygWin's AudioScope.sh.
Thoroughly read ALL the comments in... (0 Replies)
Ok guys, gals and geeks...
As from today I am starting to learn awk in earnest doing something totally different.
I am going to create a pseudo-Audio_Function Generator centred around OSX 10.11.x minimum. The code below is a tester to see what the possibilities are.
All waveforms will be... (11 Replies)
Hi all...
I intend to do an Audio Function Generator using Awk, (already started thanks to Don), but the biggest thing I have struggled with was variable frequency.
I was going to generate differing sized waveforms on the fly but that would that would mean the frequencies are dependent on any... (2 Replies)
This is a DEMO shell script to generate a simple graticule and plot inside it...
Apologies for any typos...
it is another building block along with my other two shell uploads recently to start a semi_serious project of an Terminal_AudioScope...
The fist upload I posted recently was to show... (83 Replies)