def fm(sig,id=1) : return sin(sigadd( sig, sigmult( phasor(num(slider("fm_freq_%s"%id,-1000,1000))), num(slider("fm_amp_%s"%id,-500,500)) ) ))
def new_env(sig,id) : b = bang("envelope_%s" % id) attack = num(slider("attack_%s"%id,0,100)) script.connect(b,attack,0) decay = num(slider("decay_%s"%id,0,10000)) p = pack(attack,"f","f") script.connect(decay,p,1) return sigmult( sig, vline(msg(p,"1 \$1 \, 0 \$2 \$1")) )
def vol(sig,id=1) : return sigmult(sig,num(slider("vol_%s" % id,0,1)))
def noise_fm(id) : return fm(sigmult(noise(num()),1000),id)
def midi_filtered(sig,id=1) : # Gets filter frequency from MIDI control (basic experiment, only the default channel info so far) return vcf(sig, mult(ctl_in(),10), num(slider("filter_res_%s"%id,0,10)) )
def filtered(sig,id=1) : return vcf(sig, num(slider("filter_freq_%s"%id,0,1000)), num(slider("filter_res_%s"%id,0,10)) )
vline(m) ) def new_env(sig,id) : b = bang("envelope_%s" % id) attack = num(slider("attack_%s"%id,0,100)) script.connect(b,attack,0) decay = num(slider("decay_%s"%id,0,10000)) p = pack(attack,"f","f") script.connect(decay,p,1) return sigmult( sig, vline(msg(p,"1 \$1 \, 0 \$2 \$1")) ) script.clear() s1 = basic_synth(twin_osc(1),1) script.cr() s2 = basic_synth( fm(sin( num(slider("pitch_2",20,1000)) ),2)) script.cr() s3 = basic_synth(noise_fm(3),3) dac(s1,s2,s3) print script.out()