fromscipy.ioimportwavfile# Demodulationx=np.diff(np.unwrap(np.angle(x)))# De-emphasis filter, H(s) = 1/(RC*s + 1), implemented as IIR via bilinear transformbz,az=bilinear(1,[75e-6,1],fs=sample_rate)x=lfilter(bz,az,x)# decimate by 6 to get mono audiox=x[::6]sample_rate_audio=sample_rate/6# normalize volume so its between -1 and +1x/=np.max(np.abs(x))# some machines want int16sx*=32767x=x.astype(np.int16)# Save to wav file, you can open this in Audacity for examplewavfile.write('fm.wav',int(sample_rate_audio),x)