Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import wave
- import math
- f = wave.open("test.wav", "wb")
- f.setnchannels(1)
- f.setframerate(44100)
- f.setsampwidth(1)
- #for frec in [261.63, 277.18, 293.66, 311.13, 329.63, 349.23, 369.99, 392.00, 415.30, 440.00, 466.16, 493.88, 523.25]:
- ampl = 96.0
- for frec in [440.00]:
- data = bytearray()
- for i in range(44100):
- data += chr(int(math.sin((i / 44100.0) * math.pi * frec * 2.0) * ampl + 128.0))
- f.writeframesraw(data)
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement