import numpy as np
from scipy.io.wavfile import write
rate = 44100
duration = 0.2
freq = 880
t = np.linspace(0, duration, int(rate * duration), False)
wave = 0.5 * np.sin(2 * np.pi * freq * t)
write("beep.wav", rate, wave.astype(np.float32))
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme