SuperCollider Forum
May 21, 2013, 11:44:18 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: The SuperCollider forum is currently experiencing a rash of spambot registrations. New user requests may not be approved quickly as a result -- and if your email address looks like spam, it might not be approved at all. We are working to improve the security of the registration process, and to provide alternate means to contact the administrators to get a new account. Thanks for your patience.
 
   Home   Help Search Calendar Login Register  
Pages: [1]
  Print  
Author Topic: Volume Control  (Read 2098 times)
0 Members and 1 Guest are viewing this topic.
maxpower
Newbie
*

Karma: 0
Posts: 1


View Profile
« on: May 11, 2008, 11:28:24 PM »

Hi,

I am looking into methods of fading out a synth that can be set dynamically.

For example if one is to use an EnvGen.kr(Env.adsr,gate) the gate can be set with
Code:
s.sendMsg("/n_set", n, \gate, 1)
; etc but... if I set the 
Code:
s.sendMsg("/n_set", n, \gate, -61)
  and then decided - during the period it is fading out - that I want it to fade faster, slower or not at all.  Well an envelope just will not do this.

My solutions so far are:
 
Code:
Out.ar(out, z * mul.lag(x))
where mul and x are arg's
set like this
Code:
s.sendMsg("/n_set", 1990, \x, 20, \mul, 0.1 );
or
 
Code:
Out.ar(out, z * mul
) where the mul arg is set with a Routine

Both seem to work fine...but are there other ways that are better?


Logged
dewdrop_world
AdminGroup
Full Member
*

Karma: 9
Posts: 193



View Profile WWW
« Reply #1 on: May 13, 2008, 11:02:38 AM »

That's tricky... EnvGen sets its parameters for each envelope node and doesn't update the rates etc. until the next node.

However, there is this:

Quote from: EnvGen help file
Forced release of the EnvGen

If the gate of an EnvGen is set to -1 or below, then the envelope will cutoff immediately. The time for it to cutoff is the amount less than -1, with -1 being as fast as possible, -1.5 being a cutoff in 0.5 seconds, etc. The cutoff shape is linear.

e.g.,

Code:
// this is to prove how long the release really takes
o = OSCresponderNode(s.addr, '/n_end', { |t, r, m| [t, m].postln }).add;

(
SynthDef(\envtest, { |gate = 1|
var sig = SinOsc.ar(440, 0, 0.1),
env = EnvGen.kr(Env(#[0, 1, 0.8, 0], #[0.1, 4], releaseNode: 1),
gate, doneAction: 2);
Out.ar(0, (sig * env) ! 2);
}).memStore;
)

a = Synth(\envtest);

(
a.set(\gate, 0); Main.elapsedTime.postln;  // start normal release rate
{ a.set(\gate, -1.5) }.defer(0.5);  // force 0.5 second cutoff
)

// clean up
o.remove;

The difference between the posted times should be about 1 second.

hjh
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!