This is my first post on DSP.SE! I'm a student in Computer Sciences and am just getting started with Signals and Systems, thus getting in touch with discrete signals and analyzing them.
I wanted to explore this world a little further and so my first goal is to create a Sine Wave that has a Frequency of 440 Hz and write it to a .wav-File. Of course i have all the calculus in mind, but i can't seem to figure out the problem myself!
So far, i have this:
#!/usr/bin/env python3
import numpy as np
from scipy.io import wavfile
sampleRate = 44100
t = np.linspace(0, 20, sampleRate * 5) # Produces a 5 second Audio-File
y = np.sin(440 * t) # Should have frequency of 440Hz
wavfile.write('Sine.wav', sampleRate, y)
I understand why this code always creates a File, that is 5 seconds long, but i can't figure out, how to get the frequency right!
Have i even gotten the rest of the code right, Dsp-Guy-wise?
t = np.linspace(0, 5, sampleRate*5 + 1)
. $\endgroup$ – robert bristow-johnson Nov 6 '18 at 22:24