def au_file(name, freq, freq1, dur, vol):
    fout = open(name, 'wb')
fout.write('.snd' + pack('>5L', 24, 8 * dur, 2, 8000, 1))
factor = 2 * pi * freq / 8000
factor1 = 2 * pi * freq1 / 8000
for seg in range(8 * dur):
    sin_seg = sin(seg * factor) + sin(seg * factor1)
fout.write(pack('b', vol * 64 * sin_seg))
fout.close()
t = time.strftime('%S', time.localtime())
ti = time.strftime('%M', time.localtime())
Using python to play two sine tones at once