import numpy as np
def fm_mod(input,samplerate):
output = []
for x in range(0,len(input)):
output.append(0)
i = 0
audio_amp = 0.9
fm_deviation = 2.0*np.pi*75.0e3/samplerate
for i in range(0,len(input)):
if audio_amp > 0.0:
audio_amp = 1.0
else:
audio_amp = -1.0
fm_phase += fm_deviation*audio_amp
while fm_phase > np.float32(2.0*np.pi):
fm_phase -= np.float32(np.pi)
while fm_phase < np.float32(-np.pi):
fm_phase += np.float32(2.0*np.pi)
output[i*2] = np.float32(np.sin(fm_phase))
output[i*2+1] = np.float32(np.cos(fm_phase))
return np.complex64(output)