STK Modulate -- does it work?
Hello, Wondering if someone can explain STK Modulate to me; I just don't seem to get it! The code below is just a little test to try and figure it out -- works as expected if you comment out all the Modulate related bits, but as is, makes a muddy hum... Obviously I'm doing something wrong! Can anyone shine some light on this for me? Thanks ----------------------------------- // SinOsc m => dac; // the offending portion! SinOsc m => Modulate modu => dac; 60 => modu.vibratoRate; 1 => modu.vibratoGain; 1 => modu.randomGain; // fine from here... 200 => float freq; 0.3 => m.gain; while (true) { // just to keep it interesting... Std.rand2(1, 4) => int multipler; ((freq * 2) - freq) / 12 => float step; step * multipler => float newfreq; if (freq > 2000.0 || freq < 150.0) { if (freq < 150.0) { freq + newfreq => freq; } else { freq - newfreq => freq; } } else { if ( maybe ) { freq + newfreq => freq; } else { freq - newfreq => freq; } } freq => m.freq; 250::ms => now; }
Hi, Chris!
Wondering if someone can explain STK Modulate to me; I just don't seem to get it!
I believe you may be a bit confused and that Modulate is meant as something to "modulate" other things with, like a LFO in traditional synths, not as something to be "modulated", then listened to, though of course if the ampiltude and frequencty would be set to apropriate values you could listen to it as well. Here's a small example I cooked up for you. Note I'm using sync(2) for FM modulation, adding m's output to s's frequency. When controlling other Ugens or more advanced structures you may want to periodically poll m.last(). ================= Modulate m => SinOsc s => dac; 2 => s.sync; 20 => m.vibratoGain; 2 => m.vibratoRate; 50 => m.randomGain; minute => now; ============== Hope that helps, Kas.
That was fast! I actually tried that but without the s.sync -- hadn't
really noticed that in the docs but it definitely opens some doors :-)
Thanks very much for clearing it up for me
So I have one other question -- can this be used with with STK instruments
that (don't appear to) have a sync member?
On Wed, Jul 2, 2008 at 11:09 AM, Kassen
Hi, Chris!
Wondering if someone can explain STK Modulate to me; I just don't seem to get it!
I believe you may be a bit confused and that Modulate is meant as something to "modulate" other things with, like a LFO in traditional synths, not as something to be "modulated", then listened to, though of course if the ampiltude and frequencty would be set to apropriate values you could listen to it as well.
Here's a small example I cooked up for you. Note I'm using sync(2) for FM modulation, adding m's output to s's frequency. When controlling other Ugens or more advanced structures you may want to periodically poll m.last().
================= Modulate m => SinOsc s => dac; 2 => s.sync; 20 => m.vibratoGain; 2 => m.vibratoRate; 50 => m.randomGain;
minute => now; ============== Hope that helps,
Kas.
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
2008/7/2 Chris McDaniel
That was fast! I actually tried that but without the s.sync -- hadn't really noticed that in the docs but it definitely opens some doors :-)
I believe the docs may have assumed words for traditional synthesis techniques were common knowledge for potential STK users but this probably doesn't hold for ChucK, seeing as people are geting into ChucK (and should be able to!) without first getting into traditional synths. I agree that "modulate" could be documented a little more clearly, for example by referring to a file in the "examples" dir and creating such a file if there is none already. If we don't tell people it needs fairly high amounts of gain before doing modulation in a audible way they might be disappointed.
Thanks very much for clearing it up for me
You're quite welcome. Thanks for making me try it once; I never had before but I like it. That was two minutes well spend.
So I have one other question -- can this be used with with STK instruments that (don't appear to) have a sync member?
Well, I think that modulation inputs for Ugens are typical for ChucK Ugens (particularly osc's) and not for STK ones. If we'd go in that direction I think we may need to look at a more elaborate syntax for more elaborate modulation. For example; teh FM we were using in our example isn't actually a form of "sync" at all. You could imagine using both sync and FM on the same oscilator but ChucK won't (currently?) allow this. Another question is that I'm not sure all STK instruments are designed in a way conductive to continuous modulations (I might be wrong there). What you can still do is call the .last() function of your Modulate Ugen which will get you a float. If you'd add that to a float representing the desired frequency to modulate around and write the result to the .freq() member of a STK Ugen every few ms (or samp) you would get something like our SinOsc example. I sugest you try that and shout if you run into issues. Yours, Kas.
What you suggested works wonderfully and I've been happily immersed in
sticking the .last() of anything I can think of into anywhere it fits.
Thanks Kassen!
On Wed, Jul 2, 2008 at 6:50 PM, Kassen
2008/7/2 Chris McDaniel
: That was fast! I actually tried that but without the s.sync -- hadn't really noticed that in the docs but it definitely opens some doors :-)
I believe the docs may have assumed words for traditional synthesis techniques were common knowledge for potential STK users but this probably doesn't hold for ChucK, seeing as people are geting into ChucK (and should be able to!) without first getting into traditional synths.
I agree that "modulate" could be documented a little more clearly, for example by referring to a file in the "examples" dir and creating such a file if there is none already. If we don't tell people it needs fairly high amounts of gain before doing modulation in a audible way they might be disappointed.
Thanks very much for clearing it up for me
You're quite welcome. Thanks for making me try it once; I never had before but I like it. That was two minutes well spend.
So I have one other question -- can this be used with with STK instruments that (don't appear to) have a sync member?
Well, I think that modulation inputs for Ugens are typical for ChucK Ugens (particularly osc's) and not for STK ones. If we'd go in that direction I think we may need to look at a more elaborate syntax for more elaborate modulation. For example; teh FM we were using in our example isn't actually a form of "sync" at all. You could imagine using both sync and FM on the same oscilator but ChucK won't (currently?) allow this. Another question is that I'm not sure all STK instruments are designed in a way conductive to continuous modulations (I might be wrong there).
What you can still do is call the .last() function of your Modulate Ugen which will get you a float. If you'd add that to a float representing the desired frequency to modulate around and write the result to the .freq() member of a STK Ugen every few ms (or samp) you would get something like our SinOsc example.
I sugest you try that and shout if you run into issues.
Yours, Kas.
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
participants (2)
-
Chris McDaniel
-
Kassen