Skip to content

Instantly share code, notes, and snippets.

@stevetjoa
Created April 27, 2015 17:39
Show Gist options
  • Save stevetjoa/524828fc385873468053 to your computer and use it in GitHub Desktop.
Save stevetjoa/524828fc385873468053 to your computer and use it in GitHub Desktop.
Generate WAV files of pure tones.
import librosa
import scipy
fs = 8000.0 # sample rate
T = 5.0 # signal duration
N = fs*T # total number of samples
t = scipy.arange(N)/fs # time vector
for f0 in range(415, 467):
x = 0.1*scipy.sin(2*scipy.pi*f0*t)
librosa.output.write_wav('%d.wav' % f0, x, fs, normalize=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment