# Python script for "NTM 4th 2 ways" import math import cmath fc=716 # centre frequency k=math.sqrt(1/5) # factor "k" (frequency ratio) x=math.sqrt(2*(1-k**2)) q=0.16 offset=90 # targets dB offset inf=15.625 # start frequency sup=32000 # end frequency N=264 # number of points (24 * 11 octaves = 264) file_low=open("low_NTM.frd","w") # names of files file_high=open("high_NTM.frd","w") for i in range(0,N+1): f=inf*(sup/inf)**(i/N) # frequency sweep s=1j*f/fc low=(1+q*k*s+(k*s)**2)/(1+x*s+s**2)**2 # transfer functions high=s**2*(k**2+q*k*s+s**2)/(1+x*s+s**2)**2 file_low.write(str(f)) file_low.write("\t") file_low.write(str(20*math.log10(abs(low))+offset)) file_low.write("\t") file_low.write(str(cmath.phase(low)*180/math.pi)) file_low.write("\n") file_high.write(str(f)) file_high.write("\t") file_high.write(str(20*math.log10(abs(high))+offset)) file_high.write("\t") file_high.write(str(cmath.phase(high)*180/math.pi)) file_high.write("\n") file_low.close() file_high.close()