The WAVES experimentation box is a command line tool for generating and processing sinusoid audio data, immediately playing the result to your computer’s “audio out” line or saving it into WAV or CSV files. Harnessing your shell’s pipe and filter mechanism you can apply freely succeeding processing steps.
This tool makes heavy use of the
refcodes-audio
artifact.
If you want to try out the examples below directly, you can download the WAVES
command from this site’s downloads section. See the GIT
repository
for the sources of the WAVES
command.
Depending on the executable’s flavor the command might also be named waves-x.y.z.jar, waves-bundle-x86_64-x.y.z.elf, waves-bundle-x86_64-x.y.z.exe, waves-installer-x86_64-x.y.z.msi, waves-launcher-x.y.z.sh, waves-launcher-x86_64-x.y.z.elf, waves-launcher-x86_64-x.y.z.exe, waves-native-x86_64-x.y.z.elf where x.y.z stands for the version of the waves command. The according executable’s name will be referenced to in this manual as waves.
Given the below example (as well as the succeeding ones), the first line denotes
on how to generate a WAV
file and the second
line denotes on how to directly play the result on your computer’s “audio out” device:
1
2
./waves -c sine -l 5 -f 12540 -F wav -o sine_440Hz.wav
./waves -c sine -l 5 -f 12540 -F line_out
The -c
switch specifies the curve function to use. Possible values are sine
,
cosine
, tangent
, sawtooth
, square
or triangle
(as of the CurveFunctionFunction
class). The -l
switch specifies the length in seconds for the sound sample to be
generated. The -f
switch specifies the frequency in Herz (Hz) to use for the curve
function. The -F
switch specifies the format for the generated data. Possible
values are wav
, csv
, svg
as well as audio_out
. Finally the -o
switch
specifies the output file (if applicable to the chosen format and if the output is
not to be written to standard out). The -F
switch as well as the -o
switch must
be omitted if the generated data is to be piped to a succeeding processing step.
Simple operations
The WAVES
command line tool allows
you to generate a variety of basic wave forms, such as sine
, cosine
, tangent
,
sawtooth
, square
or triangle
:
Sine 440Hz
1
2
./waves -c sine -l 5 -f 440 -F wav -o sine_440Hz.wav
./waves -c sine -l 5 -f 440 -F line_out
Sine 880Hz
1
2
./waves -c sine -l 5 -f 880 -F wav -o sine_880Hz.wav
./waves -c sine -l 5 -f 880 -F line_out
Cosine 440Hz
1
2
./waves -c cosine -l 5 -f 440 -F wav -o cosine_440Hz.wav
./waves -c cosine -l 5 -f 440 -F line_out
Square 440Hz
1
2
./waves -c square -l 5 -f 440 -F wav -o square_440Hz.wav
./waves -c square -l 5 -f 440 -F line_out
Overlaying operations
Harnessing your shell’s pipeline mechanism, you can apply multiple operation on the generated waves by passing the output of one processing step as input to a succeeding processing step, which then applies modifications to its input just to produce once again output. That output again can be handled as input for a suceeding processing step or you can write it into a file or directly listen to it via your computer’s “line out” audio device.
Overlay sine 440Hz and 880Hz (multiply)
1
2
./waves -c sine -l 5 -f 440 | ./waves -c sine -m multiply -f 880 -F wav -o sine_440Hz_multiply_sine880Hz.wav
./waves -c sine -l 5 -f 440 | ./waves -c sine -m multiply -f 880 -F line_out
Overlay sine 440Hz and 880Hz (average)
1
2
./waves -c sine -l 5 -f 440 | ./waves -c sine -m average -f 880 -F wav -o sine_440Hz_average_sine880Hz.wav
./waves -c sine -l 5 -f 440 | ./waves -c sine -m average -f 880 -F line_out
Overlay a sine 440Hz with a square 880Hz (multiply)
1
2
./waves -c sine -l 5 -f 440 | ./waves -c square -m multiply -f 880 -F wav -o sine_440Hz_multiply_square_880Hz.wav
./waves -c sine -l 5 -f 440 | ./waves -c square -m multiply -f 880 -F line_out
Overlay a sine 440Hz with a square 880Hz (average)
1
2
./waves -c sine -l 5 -f 440 | ./waves -c square -m average -f 880 -F wav -o sine_440Hz_average_square_880Hz.wav
./waves -c sine -l 5 -f 440 | ./waves -c square -m average -f 880 -F line_out
Some more expieriments
You might also try the following ones:
1
2
3
4
./waves -c SINE -l 10 -f 440 | ./waves -c SINE -f 882 -m AVERAGE -F LINE_OUT
./waves -c sine -l 2 -f 300 | ./waves -c sine -m multiply -f 402 | ./waves -c sine -m multiply -f 504 -F line_out
./waves -c sine -l 2 -f 300 | ./waves -c sine -m multiply -f 420 | ./waves -c sine -m multiply -f 540 -F line_out
./waves -c sine -l 2 -f 400 | ./waves -c sine -m add -f 420 | ./waves -c sine -m add -f 430 -F line_out
Under the hood
The
WAVES
command line tool makes heavy use of therefcodes-audio
artifact!