9 lines
564 B
Python
9 lines
564 B
Python
import wave,math,struct,pathlib
|
|
root=pathlib.Path('.qa/smart-edit');sr=22050
|
|
with wave.open(str(root/'beats.wav'),'wb') as f:
|
|
f.setnchannels(1);f.setsampwidth(2);f.setframerate(sr)
|
|
f.writeframes(b''.join(struct.pack('<h',int(18000*math.sin(2*math.pi*1200*i/sr)*max(0,1-(i%(sr//2))/(sr*.025)))) for i in range(sr*12)))
|
|
with wave.open(str(root/'speech.wav'),'wb') as f:
|
|
f.setnchannels(1);f.setsampwidth(2);f.setframerate(sr)
|
|
f.writeframes(b''.join(struct.pack('<h',int(12000*math.sin(2*math.pi*440*i/sr)) if (1<i/sr<2 or 3<i/sr<4) else 0) for i in range(sr*6)))
|