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 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")) )