Python scripts to generate sound from descriptions of sound waves.
Waveform formula from http://code.activestate.com/recipes/578168-sound-generator-using-wav-file/
License: MIT
There are three versions: soundgen.py
, soundgen2.py
and soundgen3.py
. If in doubt, use soundgen3.py
Latest iteration.
Allows you to specify a series of tones, each tone being an ordered triplet (duration, frequency, amplitude%).
$ python3 soundgen3.py {duration},{freq},{amplitude%} [...] [--play]
For example,
$ python3 soundgen3.py 4,44,100 6,440,100 2,440,50 --play
generates a wav audio with 4 seconds of 44 Hz waves at 100% amplitude, then 6s of 440 Hz at 100%, then 2s of 440 Hz at 50%,
and plays the resulting wav (--play
). Omit --play
to only generate audio and not play it.
Similar to soundgen3.py
, generates series of tones, except amplitude cannot be specified (i.e. is assumed to be 100%).
Original version.
Generates a single tone of given duration and frequency.
$ python3 soundgen.py duration freq [--play]
For example,
$ python3 soundgen.py 10 440 --play
generates a wav audio with 10 seconds of 440 Hz waves at 100% amplitude (which is assumed; cannot be specified),
and plays the resulting wav (--play
). Omit --play
to only generate audio and not play it.