# Difference between frame rate and sampling rate?

Below are the two different methods of generating time to create an audio sine wave. While framerate is being used as steps in one method, the inverse of sampling rate is being used as steps in the other method. Where is the difference?

# Method 1

# Create a sound
framerate = 44100
time = np.linspace(0,5,framerate*5)         #Multiplying framerate

signal = np.sin(2*np.pi*220*time) + np.sin(2*np.pi*224*time)

----------------------------------


# Method 2

#Simulation parameters
srate = 500 #Sampling Rate in Hz
time = np.arange(0.0, 2.0, 1.0/srate)       #Dividing Sampling rate

#Sine Wave Parameters
freq = 3         #Frequency in Hz
ampl = 2         #Amplitude in a.u.
phas = np.pi/3   #Phase in Radians

#Generate the Sine Wave
sine_wave = ampl*np.sin(2*np.pi*freq*time + phas )

• How do you define a frame here? Apr 22 '20 at 6:54
• It's a part of my question. Apr 22 '20 at 11:31

One method uses np.linspace() and the other one np.arrange() to create the time domain vector.

Common error with using linspace: Let's say you want three samples that are 1 apart. linspace(0,3,3) will give you [0 1.5 3], so the spacing is bigger than you want. The correct way is to adjust the upper limit by subtracting 1 interval (or 1/samplerate), so it should be linspace(0,2,3) or
linspace(0,5-1/framerate,framerate*5)