[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] env ugen(s) don't function correctly??



Thanks so much for this. This really helped a lot.

For the envelopes I created, you're exactly right, the 0.001 was still much
to high for the envelope to work.

What really surprised me was changing the EnvGen from .kr to .ar - this
seems to fix almost all of the problems I was having with my code using the
present Envs. Is there an explanation of this difference that I missed in
the help files? It has made a world of difference. 

I still have a bit of an issue with Env.triangle using an EnvGen.ar... but
since all of the others seem to work correctly with this combination, I'm
much more inclined to say that the triangle env issue is a matter of
perception, because the rest work so well.

Thanks for the help,
stwbass



Julian Rohrhuber wrote:
> 
> I believe, your / our problem appears because of the moment the end 
> level of the envelope is reached, together with the doneAction.(your 
> end level of 0.001 is pretty high still) Compare:
> 
> SynthDef(\bell1, { arg note = 300, dur = 1.4, vol = 0.5, doneAction = 2;
> 	var sound, input, env, together;
> 	input = BrownNoise.ar(0.5);
> 	sound = Klank.ar(`[[note, note*3/2, note*8/5, note*18/8], 
> [0.01, 0.02, 0.03,
> 	0.04], [dur, 1.2, 1.3, 1.4]], input).dup;
> 	env =
> 
> 	EnvGen.kr(/*perc*/Env.new([0.001,vol,0.001],[0.001,dur],'exponential'),
> 	doneAction: doneAction);
> 
> 	together = sound*env;
> 	Out.ar(0, together);
> }).send(s);
> 
> 
> Synth(\bell1, [\dur, 3, \doneAction, 2]);
> Synth(\bell1, [\dur, 3, \doneAction, 0])
> 
> 
> // exponential with audio rate
> 
> SynthDef(\bell1, { arg note = 300, dur = 1.4, vol = 0.5, doneAction = 2;
> 	var sound, input, env, together;
> 	input = BrownNoise.ar(0.5);
> 	sound = Klank.ar(`[[note, note*3/2, note*8/5, note*18/8], 
> [0.01, 0.02, 0.03,
> 	0.04], [dur, 1.2, 1.3, 1.4]], input).dup;
> 	env =
> 
> 	EnvGen.ar(/*perc*/Env.new([0.001,vol,0.001],[0.001,dur],'exponential'),
> 	doneAction: doneAction);
> 
> 	together = sound*env;
> 	Out.ar(0, together);
> }).send(s);
> 
> 
> Synth(\bell1, [\dur, 3, \doneAction, 2]);
> Synth(\bell1, [\dur, 3, \doneAction, 0])
> 
> 
> 
>>Sorry to hound, but I've been thinking about this a bit more.
>>
>>I think there may be a misunderstanding because of your comment after the
>>test you suggested.
>>
>>I find the beginnings of the envelopes to be quite good, the attack
portion
>>always sounds proportioned nicely no matter which curve, preset or
integer,
>>that I plug in. In almost all cases, the decay portion does not decay all
of
>>the way to silence as .plot shows or as is programed in the code.
>>
>>This does still occur with sine waves. I actually even hear it when using
>>.test so I'm convinced that it's not my synthesis method as you suggested,
>>esp. since the attack portions are fine and immediate (or only take 0.001
>>seconds, which is immediate enough for me).
>>
>>Also, FWIW, I went and got the 3.1.1 from November on the sourceforge site
>>today, so I believe I'm all the way up to date on builds - the problem
>>remains.
>>
>>Thanks again,
>>stwbass
>>
>>
>>Josh Parmenter wrote:
>>>
>>>  Here is a better test... do you still hear the problem?
>>>
>>>
>>>  SynthDef(\convolPulse, {arg note = 350, dur = 1.4, vol = 0.5, out = 0;
>>>  var in, kernel, sound, env, together, pan;
>>>	env = EnvGen.kr(Env.sine(dur, 1), doneAction: 2);
>>>	together = SinOsc.ar(note, 0, vol);
>>>	pan = Pan2.ar(together * env, out);
>>>  Out.ar(0, pan);
>>>  }).send(s);
>>>
>>>
>>>  //the chord:
>>>
>>>  (
>>>  Synth(\convolPulse,[\note, 80.midicps, \dur,3]);
>>>  Synth(\convolPulse,[\note, 66.midicps, \dur,3]);
>>>  Synth(\convolPulse,[\note, 53.midicps, \dur,3]);
>>>  Synth(\convolPulse,[\note, 45.midicps, \dur,3]);
>>>  )
>>>
>>>  If so, what system and version of SC are you using? I imagine the 
>>>  difference in attack and decay that you are hearing has to do with 
>>>  your synthesis technique taking some time to get started, and the 
>>>  cutoff sounds faster then the attack. If the above gives you a 
>>>  problem, then perhaps there is a bug, but we need to know your 
>>>  version, etc.
>>>
>>>  Best,
>>>
>>>  Josh
>>>
>>>  On Dec 22, 2007, at 1:05 AM, stwbass wrote:
>>>
>>>>
>>>>  hello list-
>>>>
>>>>  I've been having some interesting problems with the Env ugen and 
>>>>  some of
>>>>  it's presets...
>>>>
>>>>  The presets I've had the most trouble with are .sine and .triangle. 
>>>>  Here's
>>>>  an example of those acting funny.
>>>>
>>>>  //preset SynthDef:
>>>>
>>>>  SynthDef(\convolPulse, {arg note = 350, dur = 1.4, vol = 0.5, out = 0;
>>>>  var in, kernel, sound, env, together, pan;
>>>>	in = Pulse.ar(note, 0.2, vol);
>>>>	kernel = WhiteNoise.ar(0.05);
>>>>	sound = Convolution.ar(in, kernel, 2048, 0.5);
>>>>	env = EnvGen.kr(Env.sine(dur, 1), doneAction: 2);
>>>>	together = RLPF.ar(sound*env, note*2.2);
>>>>	pan = Pan2.ar(together, out);
>>>>  Out.ar(0, pan);
>>>>  }).send(s);
>>>>
>>>>  //or this one:
>>>>
>>>>  SynthDef(\convolPulse, {arg note = 350, dur = 1.4, vol = 0.5, out = 0;
>>  >> var in, kernel, sound, env, together, pan;
>>>>	in = Pulse.ar(note, 0.2, vol);
>>>>	kernel = WhiteNoise.ar(0.05);
>>>>	sound = Convolution.ar(in, kernel, 2048, 0.5);
>>>>	env = EnvGen.kr(Env.triangle(dur, 1), doneAction: 2);
>>>>	together = RLPF.ar(sound*env, note*2.2);
>>>>	pan = Pan2.ar(together, out);
>>>>  Out.ar(0, pan);
>>>>  }).send(s);
>>>>
>>>>
>>>>  //the chord:
>>>>
>>>>  (
>>>>  Synth(\convolPulse,[\note, 80.midicps, \dur,3]);
>>>>  Synth(\convolPulse,[\note, 66.midicps, \dur,3]);
>>>>  Synth(\convolPulse,[\note, 53.midicps, \dur,3]);
>>>>  Synth(\convolPulse,[\note, 45.midicps, \dur,3]);
>>>>  )
>>>>
>>>>  The tail end of the envelope doesn't taper correctly, it seems to 
>>>>  get about
>>>>  3/4 of the way towards the bottom of the "curve" and the drops off
>>>>  completely (at least on my end). The .triangle env seems much worse 
>>>>  than
>>>>  .sine, but they both sound like they have the same issue.
>>>>
>>>>  I've also tried faking a new triangle env SynthDef below:
>>>>
>>>>  //new SynthDef attempt:
>>>>
>>>>  SynthDef(\convolPulse, {arg note = 350, dur = 1.4, vol = 0.5, out = 0;
>>>>  var in, kernel, sound, env, together, pan;
>>>>	in = Pulse.ar(note, 0.2, 0.5);
>>>>	kernel = WhiteNoise.ar(0.05);
>>>>	sound = Convolution.ar(in, kernel, 2048, 0.5);
>>>>	env =
>>>>  EnvGen.kr(/*tri*/Env.new([0.001,0.15*vol,vol,0.15*vol,0.001],
>>>>  [0.15*dur,0.35*dur,0.35*dur,0.15*dur],'exponential'),
>>>>  doneAction: 2);
>>>>	together = RLPF.ar(sound*env, note*2.2);
>>>>	pan = Pan2.ar(together, out);
>>>>  Out.ar(0, pan);
>>>>  }).send(s);
>>>>
>>>>
>>>>  That one seems closer (the shape is a bit off), but the taper 
>>>>  doesn't really
>>>>  work either.
>>>>
>>>>
>>>>  I've had similar problems in the past with Env.perc. SynthDefs and 
>>>>  passage
>>>>  below:
>>>>
>>>>  // .perc SynthDefs
>>>>
>>>>  SynthDef(\bell1, { arg note = 300, dur = 1.4, vol = 0.5;
>>>>  var sound, input, env, together;
>>>>  input = BrownNoise.ar(0.5);
>>>>  sound = Klank.ar(`[[note, note*3/2, note*8/5, note*18/8], [0.01, 
>>>>  0.02, 0.03,
>>>>  0.04], [dur, 1.2, 1.3, 1.4]], input).dup;
>>>>  env = EnvGen.kr(Env.perc(0.001, dur, vol), doneAction: 2);
>>>>  together = sound*env;
>>>>  Out.ar(0, together);
>>>>  }).send(s);
>>>>
>>>>  SynthDef(\bell2, { arg note = 300, dur = 1.4, vol = 0.6;
>>>>  var sound, input, env, together;
>>>>  input = Impulse.ar(0.1, 0, 10);
>>>>  sound = Klank.ar(`[[note, note*3/2, note*8/5, note*18/8], [0.02, 
>>>>  0.03, 0.04,
>>>>  0.05], [dur, 1.2, 1.3, 1.4]], input).dup;
>>>>  env = EnvGen.kr(Env.perc(0.001,dur,vol), doneAction: 2);
>>>>  together = sound*env;
>>>>  Out.ar(0, together);
>>>>  }).send(s);
>>>>
>>>>  //here's the passage:
>>>>
>>>>  a = TempoClock(92/60);
>>>>  //m. 31-32
>>>>  a.sched(1, {Synth(\bell1, [\note, 48.midicps, \dur, 1.3044, \vol, 
>>>>  0.2])});
>>>>  a.sched(1, {Synth(\bell2, [\note, 47.midicps])});
>>>>  a.sched(2, {Synth(\bell2, [\note, 56.midicps])});
>>>>  a.sched(2, {Synth(\bell2, [\note, 57.midicps])});
>>>>  a.sched(2.25, {Synth(\bell2, [\note, 81.midicps, \vol, 0.5])});
>>>>  a.sched(2.4375, {Synth(\bell2, [\note, 65.midicps, \vol, 0.5])});
>>>>  a.sched(2.625, {Synth(\bell2, [\note, 78.midicps, \vol, 0.5])});
>>>>  a.sched(2.8125, {Synth(\bell2, [\note, 80.midicps, \vol, 0.5])});
>>>>  a.sched(3, {Synth(\bell2, [\note, 49.midicps, \vol, 0.5])});
>>>>  a.sched(5, {
>>>>		Synth(\bell2, [\note, 50.midicps, \vol, 0.65]);
>>>>		Synth(\bell2, [\note, 51.midicps, \vol, 0.65]);
>>>>		Synth(\bell2, [\note, 54.midicps, \vol, 0.65]);
>>>>		Synth(\bell2, [\note, 61.midicps, \vol, 0.65]);
>>>>		Synth(\bell2, [\note, 64.midicps, \vol, 0.65]);
>>>>		Synth(\bell2, [\note, 65.midicps, \vol, 0.65]);
>>>>		});
>>>>  a.sched(5, {
>>>>		Synth(\bell1, [\note, 50.midicps, \dur, 6, \vol, 0.15]);
>>>>		Synth(\bell1, [\note, 51.midicps, \dur, 6, \vol, 0.15]);
>>>>		Synth(\bell1, [\note, 54.midicps, \dur, 6, \vol, 0.15]);
>>>>		Synth(\bell1, [\note, 61.midicps, \dur, 6, \vol, 0.15]);
>>>>		Synth(\bell1, [\note, 64.midicps, \dur, 6, \vol, 0.15]);
>>>>		Synth(\bell1, [\note, 65.midicps, \dur, 6, \vol, 0.15]);
>>>>		});
>>>>
>>>>  That one sounds fine, the very end still doesn't seem to taper 
>>>>  correctly to
>>>>  me. Some other sounds in the piece the taper a bit more oddly; sorry 
>>>>  about
>>>>  not fining the best example for that one.
>>>>
>>>>  Again, I tried to make some perc-like envs... but I think the 
>>  >> preset .perc's
>>>>  are better, though they still have issues. Even still, I don't 
>>>>  understand
>>>>  why these one's do not sound correct to me. Maybe there're some code
>>>>  suggestions for these?
>>>>
>>>>  // perc-like envs - SynthDefs
>>>>
>>>>  SynthDef(\bell1, { arg note = 300, dur = 1.4, vol = 0.5;
>>>>  var sound, input, env, together;
>>>>  input = BrownNoise.ar(0.5);
>>>>  sound = Klank.ar(`[[note, note*3/2, note*8/5, note*18/8], [0.01, 
>>>>  0.02, 0.03,
>>>>  0.04], [dur, 1.2, 1.3, 1.4]], input).dup;
>>>>  env =
>>>>  EnvGen.kr(/*perc*/Env.new([0.001,vol,0.001],
>>>>  [0.001,dur],'exponential'),
>>>>  doneAction: 2);
>>>>  together = sound*env;
>>>>  Out.ar(0, together);
>>>>  }).send(s);
>>>>
>>>>  SynthDef(\bell2, { arg note = 300, dur = 1.4, vol = 0.6;
>>>>  var sound, input, env, together;
>>>>  input = Impulse.ar(0.1, 0, 10);
>>>>  sound = Klank.ar(`[[note, note*3/2, note*8/5, note*18/8], [0.02, 
>>>>  0.03, 0.04,
>>>>  0.05], [dur, 1.2, 1.3, 1.4]], input).dup;
>>>>  env =
>>>>  EnvGen.kr(/*perc*/Env.new([0.001,vol,0.001],
>>>>  [0.001,dur],'exponential'),
>>>>  doneAction: 2);
>>>>  together = sound*env;
>>>>  Out.ar(0, together);
>>>>  }).send(s);
>>>>
>>>>
>>>>  The \bell2 sound doesn't have as much resonance as the \bell1 sound 
>>>>  and I
>>>>  think that's why the "misshapen" envelope can pass for that sound; 
>>>>  but I
>>>>  don't understand why the envelope has such a steep drop off at the 
>>>>  end of
>>>>  the \bell1 sound.
>>>>
>>>>  In working on this piece I've become very confused by these envelope
>>>>  tapering issues. I find that the attacks all sound nice, but the 
>>>>  decays
>>>>  always have something funny. If it becomes neccessary (or would just 
>>>>  help) I
>>>>  can post the whole piece and which events have the biggest problems 
>>>>  to my
>>>>  ears - maybe that will be the best way to diagnose the problem.
>>>>
>>>>  Thanks in advance,
>>>>  stwbass
>>>>
>>>>
>>>>  --
>>>>  View this message in context:
>>>> 
>>>>http://www.nabble.com/env-ugen%28s%29-don%27t-function-correctly---tp14467510p14467510.html
>>>>  Sent from the Supercollider - User mailing list archive at Nabble.com.
>>>>
>>>>  _______________________________________________
>>>>  sc-users mailing list
>>>>  sc-users@xxxxxxxxxxxxxxx
>>>>  http://www.create.ucsb.edu/mailman/listinfo/sc-users
>>>
>>>  ******************************************
>>>  /* Joshua D. Parmenter
>>>  http://www.realizedsound.net/josh/
>>>
>>>  "Every composer - at all times and in all cases - gives his own 
>>>  interpretation of how modern society is structured: whether actively 
>>>  or passively, consciously or unconsciously, he makes choices in this 
>>>  regard. He may be conservative or he may subject himself to continual 
>>>  renewal; or he may strive for a revolutionary, historical or social 
>>>  palingenesis." - Luigi Nono
>>>  */
>>>
>>>
>>>  _______________________________________________
>>>  sc-users mailing list
>>>  sc-users@xxxxxxxxxxxxxxx
>>>  http://www.create.ucsb.edu/mailman/listinfo/sc-users
>>>
>>>
>>
>>--
>>View this message in context: 
>>http://www.nabble.com/env-ugen%28s%29-don%27t-function-correctly---tp14467510p14477012.html
>>Sent from the Supercollider - User mailing list archive at Nabble.com.
>>
>>
>>_______________________________________________
>>sc-users mailing list
>>sc-users@xxxxxxxxxxxxxxx
>>http://www.create.ucsb.edu/mailman/listinfo/sc-users
> 
> 
> -- 
> 
> 
> 
> 
> 
> .
> _______________________________________________
> sc-users mailing list
> sc-users@xxxxxxxxxxxxxxx
> http://www.create.ucsb.edu/mailman/listinfo/sc-users
> 
> 

-- 
View this message in context: http://www.nabble.com/env-ugen%28s%29-don%27t-function-correctly---tp14467510p14485437.html
Sent from the Supercollider - User mailing list archive at Nabble.com.