HI everyone, I'm a month old python programmer that really loves anything sound, and will like to know how i can use python to create Audio software. What are the tools needed, the platform, the pros, the cons.
Thanks in advance.
If you just want to create a file of a sine wave of given frequency and length, you can use Python alone (no third party module) ...
# create a synthetic 'sine wave' wave file with a
# given frequency and length
# tested with Python27 and Python32
def make_soundfile(freq=440, data_size=10000, fname="test.wav"):
create a synthetic 'sine wave' wave file with frequency freq
file fname has a length of about data_size * 2
frate = 11025.0 # framerate as a float
amp = 8000.0 # multiplier for amplitude
# make a sine list ...
sine_list = 
for x in range(data_size):
# get ready for the wave file to be saved ...
wav_file = wave.open(fname, "w")
# give required parameters
nchannels = 1
sampwidth = 2
framerate = int(frate)
nframes = data_size
comptype = "NONE"
compname = "not compressed"
# set all the parameters at once
wav_file.setparams((nchannels, sampwidth, framerate, nframes,
# now write out the file ...
print( "may take a moment ..." )
for s in sine_list:
# write the audio frames to file
print( "%s written" % fname )
# set some variables ...
freq = 440.0
# data size, file size will be about 2 times that
# duration is about 4 seconds for a data_size of 40000
data_size = 40000
# write the synthetic wave file to ...
fname = "WaveTest_440.wav"
make_soundfile(freq, data_size, fname)