Author |
Message |
frank discourse

Joined: Apr 26, 2010 Posts: 10 Location: sydney
|
Posted: Tue May 31, 2011 4:26 pm Post subject:
thanks and adsr as modulator query Subject description: basic advice |
 |
|
Hey everyone,
Thanks for the direction with the sndbuf question Inventor.
I have been putting in the hours and worked the problem out trial and error.
Recently I have been trying to get the ADSR or Envelope to function as a modulation source for lfo amt but despite reading the manual and looking on the web am still having no luck.
Is there a way to access the env level in a similar way to using lfo.last()
when reading a lfo level? |
|
Back to top
|
|
 |
GrandJu
Joined: Jul 04, 2010 Posts: 32 Location: Rennes France
|
Posted: Fri Jun 03, 2011 7:41 am Post subject:
|
 |
|
Hi Frank,
Theoretically you can use .last() function for all UGen.
I use ADSR to control filters frequency. So it should work for modulation too.
If you want your ADSR to output values don't forget put an input into it.
Like this:
Code: |
Step target_freq =>ADSR vcf_adsr => vcf.freq_ctrl;
target_freq.next(59.0);
vcf_adsr.set(50::ms, 0::ms, 1, 100::ms);
|
Don't hesitate to send the piece of code that doesn't work on your side.
Ju |
|
Back to top
|
|
 |
frank discourse

Joined: Apr 26, 2010 Posts: 10 Location: sydney
|
Posted: Mon Jun 06, 2011 9:32 pm Post subject:
thanks GrandJu |
 |
|
Appreciate the guidance, I think I was omitting the ADSR input as you suggested.I am painfully aware that my training wheels will be on for a while with ChucK but am putting in serious hours and making some headway.
Thanks again frankie_d. |
|
Back to top
|
|
 |
flies
Joined: May 20, 2008 Posts: 33 Location: NJ
|
Posted: Wed Nov 30, 2011 2:25 pm Post subject:
|
 |
|
I can't find a UGen that has a freq_ctrl property. How do you do frequency modulation on a filter? (am noob.) |
|
Back to top
|
|
 |
GrandJu
Joined: Jul 04, 2010 Posts: 32 Location: Rennes France
|
Posted: Fri Dec 02, 2011 9:26 am Post subject:
|
 |
|
Hi flies,
I didn't find it too. But I think there is no way to perform it directly.
I created a class using the freq() function of the filter and udating it each sample to change cutoff frequency.
Code: |
public class lpf_vcf_light {
Gain in;
Gain out;
LPF lpf_filter_u;
lpf_filter_u.freq(300);
fun UGen connect(UGen @ u)
{
int i;
u => in => lpf_filter_u => out;
return out;
}
fun void update_freq(UGen @ freq_in) {
while (1) {
Std.mtof(freq_in.last()) => lpf_filter_u.freq;
if (lpf_filter_u.freq() <1> now;
}
}
fun void update_Q(UGen @ Q_in) {
while (1) {
Q_in.last()/24 => lpf_filter_u.Q;
1::samp => now;
}
}
fun void freq_ctrl (UGen @ freq_in) {
freq_in => blackhole;
spork ~ update_freq(freq_in);
}
fun void Q_ctrl (UGen @ Q_in) {
Q_in => blackhole;
spork ~ update_Q(Q_in);
}
}
/* Examlpe, please comment when used as public class */
lpf_vcf_light vcf;
SqrOsc s => vcf.connect => dac;
s.gain(0.3);
Phasor p => vcf.freq_ctrl;
p.gain(127);
p.freq(0.5);
Phasor p2 => vcf.Q_ctrl;
p2.gain(127);
p2.freq(0.1);
while(1) {1::ms => now; <<<vcf>>>;}
|
|
|
Back to top
|
|
 |
|