0.6 Generating Signals
Let us now attempt to generate tones of changing frequencies every half second. This is a naive approach -- let's generate a few sine waves and append them together.
frequencies = np.array([525, 590, 664, 704, 790, 885, 995, 1055])
Fs = 16000
tone_sound = []
for itr in range(len(frequencies)):
t = np.arange(0.5*(itr-1), 0.5*itr, 1/Fs)
tone_sound = np.hstack([tone_sound, np.sin(frequencies[itr]*2*np.pi*t)])
IPython.display.Audio(tone_sound, rate=Fs)
wavfile.write('doremi.wav', Fs, tone_sound)Last updated
Was this helpful?