def warm_bass(length,freq): sig=mix( sf.FixSize( sf.Power( sf.Clean( mix( [sf.Pcnt25(sf.MakeSquare (sf.PhasedSineWave(length,freq ,random.random()))),0], [sf.Pcnt50(sf.MakeTriangle(sf.PhasedSineWave(length,freq*0.501,random.random()))),32], [sf.Pcnt25(sf.MakeTriangle(sf.PhasedSineWave(length,freq*0.252,random.random()))),64], [sf.Pcnt25(sf.MakeTriangle(sf.PhasedSineWave(length,freq/8.01,random.random()))),64] ) ) ,1.25 ) ), sf.Multiply( clean_noise(length,freq), sf.SimpleShape((0,-60),(64,-12),(128,-24),(length,-24)) ) ) sh=sf.WhiteNoise(length) sh=sf.Multiply(sh,+sig) sig=mix(sig,sf.Pcnt5(sh)) if freq<128: q=freq*6.0 elif freq<256: q=freq*5 else: q=freq*4.0 sig=sf.BesselLowPass(sig,q,1) return pitch_move(sig)
def trost_posaune(length,freq): b=posaunePulse(length,freq) b=mix( [b,12], [ sf.NumericShape( (0, -2.0), (4, 2.0), (12,-1.00), (20, 1.00), (28,-1.00), (length,0) ),0] ) b=sf.RBJPeaking(b,freq*2,2,2) b=polish(b,freq) sig=mix( b , sf.Pcnt20(sf.Multiply(+b,sf.WhiteNoise(length))), sf.Multiply( clean_noise(length,freq*0.5), sf.SimpleShape((0,-60),(64,-14),(128,-28),(length,-24)) ) ) return pitch_move(sig)
def orchestral_oboe(length,freq): vox=make_simple_base(length,freq,0.25) vox=sf.Multiply( sf.NumericShape((0,0),(sf.Period(freq)/2.0,1),(length,1)), vox ) vox=polish(vox,freq) vox=sf.Finalise(sf.Power(vox,1.5)) vox=polish(vox,freq) vox=sf.Finalise(sf.Power(vox,1.5)) vox=polish(vox,freq) vox=sf.RBJPeaking(vox,freq*5,0.5,5) vox=sf.RBJPeaking(vox,freq*7,1,5) vox=sf.RBJNotch (vox,freq*2,0.5,1) vox=sf.FixSize(vox) res=512*math.ceil(float(freq)/256.0) vox=mix( sf.RBJPeaking(+vox,res ,1,8), sf.RBJPeaking( vox,res*4.0,1,8), ) vox=sf.ButterworthLowPass(vox,freq*4,4) vox=sf.FixSize(vox) nos=sf.Multiply( +vox, sf.Multiply( clean_noise(length,freq), sf.SimpleShape((0,-60),(64,0),(128,-9),(length,-9)) ) ) vox=mix( vox, sf.Pcnt10(sf.FixSize(nos)) ) vox=polish(vox,freq) return sf.FixSize(vox)
def trumpet(length,freq): if length>256: sig1=trumpe_base(length,freq,-0.25) sig2=trumpet_base(length,freq, 0.25) env1=sf.NumericShape((0,0),(256,1),(length,1)) env2=sf.NumericShape((0,1),(256,0),(length,0)) sig1=sf.Multiply(sig1,env1) sig2=sf.Multiply(sig2,env2) sig=mix(sig1,sig2) else: sig=trumpet_base(length,freq,-0.25) sig=sf.FixSize(sig) sig=polish(sig,freq) sig=mix( sig, sf.Multiply( clean_noise(length,freq*1.0), sf.SimpleShape((0,-60),(32,-22),(64,-60),(length,-90)) ) ) sig=sf.FixSize(sig) sig=polish(sig,freq) return sf.FixSize(sig)
def do_formant(sig, f1, f2, f3, freq, intensity=4): if not sf.Check(+sig): d_log('Incoming broken') y = +sig f1b = f1 f2b = find_nearest_overtone(f2, freq) f3b = find_nearest_overtone(f3, freq) for x in range(1, intensity): s1 = sf.RBJBandPass(+sig, f1b, 0.25) s2 = sf.RBJBandPass(+sig, f2b, 0.5) s3 = sf.RBJBandPass(+sig, f3b, 0.5) sig = sf.FixSize( mix(sf.Pcnt10(sig), sf.Pcnt50(sf.FixSize(s1)), sf.Pcnt20(sf.FixSize(s2)), sf.Pcnt30(sf.FixSize(s3)))) s1 = sf.RBJPeaking(+sig, f1b, 1.0, 5) s2 = sf.RBJPeaking(+sig, f2b, 2.0, 5) s3 = sf.RBJPeaking(sig, f3b, 2.0, 5) sig = sf.FixSize( mix(sf.Pcnt50(sf.FixSize(s1)), sf.Pcnt20(sf.FixSize(s2)), sf.Pcnt30(sf.FixSize(s3)))) x = polish(sig, freq) x = sf.FixSize(x) if not sf.Check(+x): -x x = y d_log('Formant Failed', f1, f2, f3, freq, intensity) else: -y return x
def trost_orchestral_oboe(length,freq): start=sf.Multiply( mix( sf.FixSize(sf.Power(sf.MakeSawTooth(sf.SineWave(length,freq*0.500)),2.0)), sf.FixSize(sf.Power(sf.MakeSawTooth(sf.SineWave(length,freq*0.123)),2.0)) ), sf.NumericShape((0,3.0),(32,0),(length,0)) ) start=polish(start,freq*0.5) sig=mix(orchestral_oboe(length,freq),sf.FixSize(start)) return sf.FixSize(polish(sig,freq))
def double_bombard(length,freq): sig=mix( mix( [sf.Pcnt50(bombard_pulse(length,freq)),0], [sf.Pcnt50(bombard_pulse(length,freq*1.5)),10] ), sf.Multiply( clean_noise(length,freq*0.5), sf.SimpleShape((0,-60),(64,-10),(128,-24),(length,-20)) ) ) return pitch_move(sig)
def voice1(length, freq): sigs = [] for i in range(1, 3): sig = byquad_filter( 'peak', byquad_filter( 'peak', sf.Pcnt1( sf.SineWave(length, freq - 2.0 + random.random() * 4.0)), 1.0, 64), freq, 0.1, 64) sig = byquad_filter('peak', sig, freq, 1.0, 128) sig = sf.FixSize(excite(sig, 1.0, 2.0)) sig = sf.FixSize(sf.Saturate(sf.LinearVolume(sig, 2.0))) sig = create_vibrato(sig, length, longer_than=0.5, rate=2 + random.random(), at=0.45, depth=0.1, pitch_depth=0.01) sigs.append(sig) sig = mix(sigs) return sf.Finalise(sig)
def folk_basson(length,freq): sig=sf.FixSize( sf.Power( phasing_sawtooth(length,freq) , 1.5 ) ) sig=polish(sig,freq) sig=sf.FixSize(sf.Power(sig,1.5)) sig=polish(sig,freq) sig=sf.FixSize(sf.Power(sig,1.5)) sig=polish(sig,freq) sig=sf.FixSize(sig) sig=sf.RBJPeaking(sig,freq*5,0.5,5) sig=sf.RBJPeaking(sig,freq*7,1,5) sig=sf.RBJNotch (sig,freq*2,0.5,1) sig=sf.Clean(sig) sig=mix( sf.FixSize(sig), sf.ButterworthLowPass ( sf.Multiply( sf.MakeSquare(sf.SineWave(length,freq)), sf.SimpleShape((0,-60),(64,-32),(96,-60),(length,-60)) ), freq*9, 4 ) ) sig=sf.ButterworthLowPass (sig,freq*9,2) sig=polish(sig,freq) return sf.FixSize(sig)
def folk_flute(length,freq): sig=mix( byquad_filter( 'low', sf.Mix( phasing_triangle(length,freq), sf.Pcnt1(sf.MakeSquare(sf.SineWave(length,freq*0.9))) ), freq*2.0, 2 ), sf.Multiply( byquad_filter( 'peak', clean_noise(length,freq*0.5), freq, 0.5, 16 ), sf.SimpleShape((0,-60),(64,-28),(128,-40),(length,-40)) ) ) sig=create_vibrato( sig,length, longer_than=512, rate=2.5, at=450, depth=0.5, pitch_depth=0.02 ) return sf.FixSize(polish(sig,freq))
def vox_humana_femail_soprano_a(length,freq): vox = vox_humana_inner(length,freq,860,2050,2850,1.8,2.5) a = sf.BesselLowPass(+vox,freq ,2) b = sf.Power(sf.BesselHighPass(vox,freq*4.0,2),1.35) b = sf.Clean(b) b = sf.ButterworthHighPass(b,freq*1.5 ,6) a = sf.ButterworthHighPass(a,freq*0.75,6) return mix(sf.Pcnt75(a),sf.Pcnt25(b))
def post_process_tremolate(notes,rate=3.5,magnitude=0.25): count=0 tnsl=[] tnsr=[] for note in notes: nlr,atl,atr=note c_log("Trem phase 1 done: ",count) notel,noter=nlr tnsl.append([notel,atl]) tnsr.append([noter,atr]) count+=1 tnl=mix(tnsl) tnr=mix(tnsr) tnl=tremolate(tnl,rate,magnitude) tnr=tremolate(tnr,rate,magnitude) c_log("Trem phase 3 done") return tnl,tnr
def vox_humana_femail_soprano_ah(length,freq): vox = vox_humana_inner(length,freq,850,1200,2800,2.0,3.0) a = sf.BesselLowPass(+vox,freq ,2) b = sf.Power(sf.BesselHighPass(vox,freq*4.0,2),1.25) b = sf.Clean(b) b = sf.ButterworthHighPass(b,freq*1.5 ,6) a = sf.ButterworthHighPass(a,freq*0.75,6) return sf.Realise(mix(sf.Pcnt75(a),sf.Pcnt25(b)))
def bombard(length,freq): b=mix( [sf.Pcnt33(bombard_pulse(length,freq)),0], [sf.Pcnt33(bombard_pulse(length,freq)),10], [sf.Pcnt33(bombard_pulse(length,freq)),20] ) b=polish(b,freq) sig=mix( b , sf.Pcnt10(sf.Multiply(+b,sf.WhiteNoise(length))), sf.Multiply( clean_noise(length,freq*0.5), sf.SimpleShape((0,-60),(64,-14),(128,-28),(length,-24)) ) ) return pitch_move(sig)
def plucked_glass(length,freq): sig=mix( sf.Pcnt50(stretched_bass(length,freq,z=3.5,s=1.005,d=1.00,at=3000)), sf.Pcnt50(stretched_bass(length,freq,z=3.5,s=1.005, d=1.00,at=1500)) ) sig=sf.Multiply( sig, sf.NumericShape((0,0.5),(16,1),(length,1)) ) sig=sf.BesselLowPass(sig,freq*5,1) sig=sf.Multiply( sig, sf.DirectMix(1,sf.Pcnt5(sf.SineWave(length,16+random.random()*8.0))) ) sig=sf.RBJPeaking(sig,freq*5,0.5,5) start=sf.Multiply( mix( sf.FixSize(sf.MakeSawTooth(sf.SineWave(length,120))), sf.FixSize(sf.MakeSawTooth(sf.SineWave(length,freq*0.75))), sf.FixSize(sf.MakeSawTooth(sf.SineWave(length,freq**0.5))) ), sf.SimpleShape((0,1.0),(16,-30),(32,-60),(length,-99)) ) start=sf.Multiply( start, sf.NumericShape((0,0),(16,1),(length,0),(length*0.5,0)) ) start=sf.Clean(start) conv =clean_noise(64,32) conv =sf.Multiply( sf.SimpleShape((0,-12),(60,-60),(66,-60)), conv ) conv=sf.Multiply( conv, sf.NumericShape((0,0),(60,1),(66,0)) ) conv=reverberate(start,conv) conv=sf.Multiply( conv, sf.SimpleShape((0,1.0),(16,-30),(32,-60),(length,-99)) ) sig=mix(sf.FixSize(sig),sf.Pcnt50(sf.FixSize(conv))) sig=sf.Cut(0,length,sig) return sf.FixSize(polish(sig,64))
def post_process(notes): count=0 tnsl=[] tnsr=[] all_left=[] all_right=[] for note in notes: nlr,atl,atr=note c_log("Mix phase 1 done: ",count,atl,atr) notel,noter=nlr tnsl.append([notel,atl]) tnsr.append([noter,atr]) count+=1 tnl=mix(tnsl) tnr=mix(tnsr) c_log("Mix phase 2 done") return tnl,tnr
def post_process_echo(notes): count=0 tnsl=[] tnsr=[] for note in notes: nlr,atl,atr=note c_log("Echo phase 1 done: ",count) notel,noter=nlr tnsl.append([notel,atl]) tnsr.append([noter,atr]) count+=1 tnl=mix(tnsl) tnr=mix(tnsr) c_log("Echo phase 2 done") tnl=echo_division(tnl) tnr=echo_division(tnr) c_log("Echo phase 3 done") return tnl,tnr
def grand_bass(length,freq): sig=mix( mix( [sf.Pcnt25(nice_saw(length,freq)),0], [sf.Pcnt50(sf.MakeTriangle(sf.PhasedSineWave(length,freq*0.501,random.random()))),32], [sf.Pcnt25(sf.MakeTriangle(sf.PhasedSineWave(length,freq*0.252,random.random()))),64], [sf.Pcnt25(sf.MakeTriangle(sf.PhasedSineWave(length,freq/8.01,random.random()))),64] ), sf.Multiply( clean_noise(length,freq), sf.SimpleShape((0,-60),(64,-12),(128,-24),(length,-20)) ) ) sig=sf.BesselLowPass(sig,freq*3.0,1) sig=sf.FixSize(polish(sig,freq)) sig=pitch_move(sig) sig=sf.ButterworthLowPass(sig,freq*9.0,1) return sf.FixSize(sf.Clean(sig))
def celest_flute(length,freq): sig=mix( sf.Pcnt50(sweet_flute_base(length,freq)), sf.Pcnt50(sweet_flute_base(length,freq+1.0)), sf.Multiply( clean_noise(length,freq*0.5), sf.SimpleShape((0,-60),(64,-28),(128,-40),(length,-40)) ) ) return pitch_move(sig)
def bright_flute(length,freq): sig=mix( bright_flute_base(length,freq), sf.Multiply( clean_noise(length,freq*0.5), sf.SimpleShape((0,-60),(64,-28),(128,-40),(length,-40)) ) ) sig=sf.FixSize(polish(sig,freq)) return pitch_move(sig)
def viola(length,freq): sig=mix( viola_base(length,freq), sf.Multiply( clean_noise(length,freq*0.5), sf.SimpleShape((0,-60),(64,-20),(128,-36),(length,-36)) ) ) sig=sf.FixSize(polish(sig,freq)) return pitch_move(sig)
def single_bombard(length,freq): sig=mix( sf.Pcnt33(bombard_pulse(length,freq)) , sf.Multiply( clean_noise(length,freq*0.5), sf.SimpleShape((0,-60),(64,-16),(128,-24),(length,-20)) ) ) return pitch_move(sig)
def stopped_reed(length,freq): s1=stopped_pulse(length,freq*1.000) s1=polish(s1,freq) sig=mix( s1, sf.Multiply( clean_noise(length,freq*2.0), sf.SimpleShape((0,-60),(64,-16),(128,-20),(length,-20)) ) ) sig=sf.FixSize(sig) sig=mix( sf.Pcnt10(sf.Clean(sf.Saturate(+sig))), sig ) sig=polish(sig,freq) return sf.FixSize(sig)
def bright_plucked_glass(length,freq): sig=mix( stretched_bass(length,freq,z=1.5,s=1.02,d=1.0,at=4000), sf.Multiply( clean_noise(length,freq*2.0), sf.SimpleShape((0,-60),(64,-20),(128,-36),(length,-36)) ) ) sig=sf.RBJPeaking(sig,freq*5,0.5,5) start=sf.Multiply( mix( sf.FixSize(sf.MakeSawTooth(sf.SineWave(length,freq*0.75))), sf.FixSize(sf.MakeSawTooth(sf.SineWave(length,freq**0.5))) ), sf.SimpleShape((0,1.0),(16,-30),(32,-60),(length,-99)) ) start=sf.Clean(start) sig=mix(sf.FixSize(sig),sf.FixSize(start)) return sf.FixSize(sf.Clean(sig))
def vox_humana_inner(length,freq,a,b,c,z1=1.0,z2=1.25): vox=mix( sf.Pcnt75(sing_base(length,freq,z1)), sf.Pcnt25(sing_base(length,freq*2.0,z1)) ) length=sf.Length(+vox) vox=sf.FixSize(polish(vox,freq)) if length>1024: rt=3.0 dp=0.2 pdp=0.1 else: rt=4.5 dp=0.1 pdp=0.05 if length>2048: a=length*0.75 else: a=length*0.5 vox=create_vibrato(vox,length,longer_than=512,rate=rt,depth=dp,pitch_depth=pdp,at=a) vox=do_formant(vox,a,b,c,freq) vox=polish(vox,freq) vox=excite(vox,0.2,2.0) vox=polish(vox,freq) notch=(freq+a)/2.0 vox=mix( sf.Pcnt75(sf.RBJNotch(+vox,notch,0.5)), sf.Pcnt25(vox) ) vox=mix( sf.Multiply( sf.FixSize(sf.Power(clean_noise(length,freq*0.5),1.5)), sf.SimpleShape((0,-60),(64,-35),(128,-40),(length,-60)) ), vox ) vox=polish(vox,freq) vox=sf.RBJPeaking(vox,freq,3,4) vox=polish(vox,freq) return sf.FixSize(vox)
def mute_oboe(length,freq): sig=sf.FixSize( sf.Power( sf.Clean( mix( nice_saw(length,freq), sf.PhasedSineWave(length,freq,random.random()) ) ) , 1.5 ) ) sig=polish(sig,freq) sig=sf.FixSize(sf.Power(sig,1.5)) sig=polish(sig,freq) sig=sf.FixSize(sf.Power(sig,1.5)) sig=polish(sig,freq) sig=sf.FixSize(sig) sig=sf.RBJPeaking(sig,freq*5,0.5,5) sig=sf.RBJPeaking(sig,freq*7,1,5) sig=sf.RBJNotch (sig,freq*2,0.5,1) sig=sf.Clean(sig) sig=mix( sf.FixSize(sig), sf.Multiply( clean_noise(length,freq*9.0), sf.SimpleShape((0,-60),(64,-16),(128,-20),(length,-20)) ) ) sig=polish(sig,freq) sig=sf.BesselLowPass (sig,freq*4,1) osig=+sig osig=sf.BesselHighPass(sig,freq*4,2) sig=sf.BesselLowPass (sig,freq*6,1) sig=sf.BesselLowPass (sig,freq*8,4) sig=mix(sig,osig) return sf.FixSize(sf.Clean(sig))
def trost_sweet_flute(length,freq): sig = sweet_flute_base(length,freq) wind = sf.Multiply( clean_noise(length,freq), sf.SimpleShape((0,-60),(64,-16),(128,-20),(length,-20)) ) sig = sf.Multiply( sf.NumericShape((0,0),(32,1),(length,1)), sig ) start=sf.Multiply( mix( sf.FixSize(sf.Power(sf.MakeSawTooth(sf.SineWave(length,freq*0.500)),2.0)), sf.FixSize(sf.Power(sf.MakeSawTooth(sf.SineWave(length,freq*0.123)),2.0)) ), sf.NumericShape((0,3.0),(32,0),(length,0)) ) start=polish(start,freq*0.5) sig=mix(sig,start,wind) sig=sf.FixSize(polish(sig,freq)) return pitch_move(sig)
def folk_clarinet(length,freq): s1=stopped_pulse(length,freq*1.000) sig=mix( s1, sf.Multiply( nice_saw(length,freq*0.5), sf.SimpleShape((0,-32),(64,-16),(128,-99),(length,-99)) ) ) sig=polish(sig,freq) sig=polish(sf.Saturate(sf.FixSize(sig)),freq) return sf.FixSize(sig)
def vox_humana_femail_soprano_ma(length,freq): vox = vox_humana_femail_soprano_a(length,freq) if length>128: qsh =sf.NumericShape((0,0.1),(120,2), (length,0.1)) msh =sf.NumericShape((0,1.0),(120,1.0),(length,0.0)) mshr=sf.NumericShape((0,0.0),(120,0.0),(length,1.0)) init=byquad_filter('low',+vox,freq,qsh) vox =sf.Multiply(vox ,mshr) init=sf.Multiply(init,msh) vox =mix(vox,init) vox=sf.FixSize(polish(vox,freq)) return vox
def lead_diapason(length,freq): sig=mix( sf.Pcnt65(sf.MakeTriangle(sf.PhasedSineWave(length,freq,random.random()))), sf.Pcnt25(sf.MakeTriangle(sf.PhasedSineWave(length,freq*2.0,random.random()))), sf.Pcnt15(sf.PhasedSineWave(length,freq*4.0,random.random())), sf.Multiply( clean_noise(length,freq), sf.SimpleShape((0,-60),(64,-20),(128,-36),(length,-36)) ) ) sig=sf.FixSize(polish(sig,freq)) return pitch_move(sig)
def excite(sig_,mix_ammount,power): sig=sig_ m=sf.Magnitude(+sig) sigh=sf.BesselHighPass(+sig,500,2) mh=sf.Magnitude(+sigh) sigh=sf.Power(sigh,power) sigh=sf.Clean(sigh) sigh=sf.BesselHighPass(sigh,1000,2) nh=sf.Magnitude(+sigh) sigh=sf.LinearVolume(sigh,mh/nh) sig=mix(sf.LinearVolume(sigh,mix_ammount),sf.LinearVolume(sig,1.0-mix_ammount)) n=sf.Magnitude(+sig) return realise(sf.LinearVolume(sig,m/n))
def do_formant(sig,f1,f2,f3,freq,intensity=4): if not sf.Check(+sig): d_log('Incoming broken') y=+sig f1b=f1 f2b=find_nearest_overtone(f2,freq) f3b=find_nearest_overtone(f3,freq) for x in range(1,intensity): s1=sf.RBJBandPass(+sig,f1b,0.25) s2=sf.RBJBandPass(+sig,f2b,0.5) s3=sf.RBJBandPass(+sig,f3b,0.5) sig=sf.FixSize( mix( sf.Pcnt10(sig), sf.Pcnt50(sf.FixSize(s1)), sf.Pcnt20(sf.FixSize(s2)), sf.Pcnt30(sf.FixSize(s3)) ) ) s1=sf.RBJPeaking(+sig,f1b,1.0,5) s2=sf.RBJPeaking(+sig,f2b,2.0,5) s3=sf.RBJPeaking( sig,f3b,2.0,5) sig=sf.FixSize( mix( sf.Pcnt50(sf.FixSize(s1)), sf.Pcnt20(sf.FixSize(s2)), sf.Pcnt30(sf.FixSize(s3)) ) ) x=polish(sig,freq) x=sf.FixSize(x) if not sf.Check(+x): -x x=y d_log('Formant Failed',f1,f2,f3,freq,intensity) else: -y return x
def excite(sig_, mix_ammount, power): sig = sig_ m = sf.Magnitude(+sig) sigh = sf.BesselHighPass(+sig, 500, 2) mh = sf.Magnitude(+sigh) sigh = sf.Power(sigh, power) sigh = sf.Clean(sigh) sigh = sf.BesselHighPass(sigh, 1000, 2) nh = sf.Magnitude(+sigh) sigh = sf.LinearVolume(sigh, mh / nh) sig = mix(sf.LinearVolume(sigh, mix_ammount), sf.LinearVolume(sig, 1.0 - mix_ammount)) n = sf.Magnitude(+sig) return realise(sf.LinearVolume(sig, m / n))