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 65536 byte file to your working directory/drawer/folder as sinewave.raw. Use an oscilloscope to check the waveform generated...
It is entirely Public Domain and you may do with it as you please...
Bazza, G0LCU...
#!/bin/bash
#
# 1KHz.sh
#
# A very simple DEMO crude sinewave generator using the device /dev/audio.
# It is an eight second burst and generates an approximation of a pure sinewave using linear interpolation.
# The "sinewave.raw" file length is 65536 bytes in size...
# Zero the raw file...
> sinewave.raw
# This is the b byte data list for the crude sinewave.
data="\\x0f\\x2d\\x3f\\x2d\\x0f\\x03\\x00\\x03"
# Generate the file as an eight second burst...
for waveform in {0..8191}
do
printf "$data" >> sinewave.raw
done
# Now play back a single run of the raw data for about eight seconds.
cat sinewave.raw > /dev/audio
# End of 1KHz.sh DEMO...
# Enjoy finding simple solutions to often very simple problems... ;o)