| Hi everyone, I am pretty sure there isn't a way to do this, but before I start hacking on a Ugen, I thought I would ask. Does anyone know of a way to jump ahead in an envelope? Basically, I would like to have a synthdef that uses a PlayBuf and an envelope that applies to the whole sound in the PlayBuf. BUT, if I start at a different point in the PlayBuf sound (say 1 second in), I would also like the EnvGen to start 1 second in so that the levels for a certain point in the soundfile are always the same: SynthDef(\test, {arg buffer, starttime; var play, env; env = EnvGen.kr(Env([0, 1, 0], [2, 2], \sin), doneAction: 2); // jump ahead by starttime? play = PlayBuf.ar(1, buffer, rate: BufRateScale.kr(buffer), startPos: starttime * BufSampleRate.kr(buffer), loop: 1); Out.ar(0, play * env); }).load(s); s.boot; s.sendMsg(\b_allocRead, 0, "sounds/a11wlk01.wav"); s.sendMsg(\s_new, \test, a = s.nextNodeID, 0, 1, \buffer, 0, \starttime, 1); I thought about rebuilding the envelope on the fly (with the offset in mind), but this creates problems with different curves: e = Env([0, 1, 0], [2, 2], \sin); f = Env([e[1], 1, 0], [1, 2], \sin); // rebuilt to "jump ahead 1 second" // test to see if curve values are the same later in the Env e[1.9].postln == f[0.9].postln; // -> false, curves aren't the same Any suggestions? I thought about sending the original Env as a Signal to a buffer, then using BufRd, but that creates another difficulty (since releaseNodes and doneAction are lost). Thanks for any ideas, Josh ****************************************** Joshua D. Parmenter http://homepage.mac.com/joshpar/ "...Some people think a composer's supposed to please them, but in a way a composer is a chronicler... He's supposed to report on what he's seen and lived." -Charles Mingus |