def envelope(sig,id) : m = msg("1 10 \, 1 100 2000 \, 0 100 1000") b = bang("envelope_%s" % id) script.connect(b,m,0) return sigmult( sig, vline(m) )
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 lfo(sig,id=1) : return sigmult( sig, phasor(slider("lfo_%s"%id,-40,40)) )