[Stk] Wah-wah filter? UPDATE for STK using BiQuad

Perry Cook prc at CS.Princeton.EDU
Tue Oct 8 11:44:27 PDT 2013


You'd just change that "temp" variable between 0.0 (closed) 
and 1.0 (open).

The way the effects program works right now is that one thread
watches standard in for SKINI messages, and those get hooked
up to the parameters within.  It's possible you could just write a 
little C program to spew those SKINI messages out into the 
console, and pipe that into effects, to do your initial experiments.

Poke around the demos, look at the .bat files to see how it all 
gets hooked up, run the wish scripts by themselves and see 
how the messages work.  As I said, you can mimic that with
printf or whatever your stdout printing method works for you,
just to experiment.

PRC

On Oct 8, 2013, at 11:30 AM, Robert Oschler wrote:

> Hello Perry,
> 
> Thanks for the STK code.  Pardon the newbie question but I am new to
> STK.  Which parameter(s) in the code sample do I change over time to
> control the Wah sweep if I want to attach the effect to a custom
> controller?
> 
> Robert
> 
> On Tue, Oct 8, 2013 at 2:05 PM, Perry Cook <prc at cs.princeton.edu> wrote:
>> Howdy!!  My recent hacking of the Raspberry Pi have renewed my
>> enthusiasm for, and appreciation of, STK.
>> 
>> Today's Wah Wah update for the STK people.  I dug into ChucK's ResonZ
>> filter source code, and it turns out that it (of course) inherits from BiQuad.
>> 
>> I did a test comparing ResonZ and BiQuad (in ChucK), and they seem
>> to generate basically the same thing as long as I set the coefficients correctly.
>> Duh, huh?
>> 
>> I hacked a new version of the STK effects project, adding WahWah as
>> a radio button and condition.  Fairly minimal changes to effects.cpp,
>> and adding BiQuad.o to the Makefile.  That new project all lives at:
>> 
>> http://www.cs.princeton.edu/~prc/STKHacks/effectsWithWah.zip
>> 
>> Punchline:
>> 
>> You can make a BiQuad (or subclass it) , and set equal gain zeroes,
>> and set the frequency and radius thusly:
>> 
>> // given a float value named "temp" ranging from 0.0 to 1.0
>> // and an STK BiQuad filter named wahwah,
>> // in the main controller service functions, add this:
>> 
>> case 22: // effect parameter change 1
>> .
>> .  OTHER STUFF for Other EFX
>> .
>> 
>> {  // new block for wahWah servicing
>>          float freqs[3] = {460.0,840,2250}; // JOS data
>>          float Qs[3] = {9.4,4.0,2.0};      // from his pedal
>>          float myFreq, myQ;
>>          if (temp < 0.5) {
>>             myFreq = freqs[0] +
>>                ((freqs[1]-freqs[0])*2.0*temp);
>>             myQ = Qs[0] +
>>                ((Qs[1]-Qs[0])*2.0*temp);
>>          }
>>          else  {
>>             myFreq = freqs[1] +
>>                ((freqs[2]-freqs[1])*2.0*(temp-0.5));
>>             myQ = Qs[1] +
>>                ((Qs[2]-Qs[1])*2.0*(temp-0.5));
>>          }
>>          data->wahwah.setEqualGainZeroes();
>>          float pFreq = myFreq * TWO_PI / SRATE;
>>          float bandwidth = pFreq / myQ;
>>          float radius = 1.0 - (bandwidth * 0.5);
>>          data->wahwah.setResonance(myFreq,radius,1);
>>      }
>> 
>> ********************************************************
>> // For the bilingual, here's my ChucK test program to
>> // compare the ResonZ to BiQuad:
>> 
>> Noise nz => ResonZ wah => WvOut left => dac;
>> nz =>       BiQuad wah2 => WvOut right => dac;
>> "left.wav" => left.wavFilename;
>> "right.wav" => right.wavFilename;
>> 
>> 0.3 => nz.gain;
>> 
>>    [460.0,840,2250] @=> float freqs[]; // JOS data
>>    [9.4,4.0,2.0] @=> float Qs[];      // from his pedal
>> 
>> 1 => wah2.eqzs;
>> 
>> for (0 => int i; i < 3; i++)  {
>>    (freqs[i],Qs[i]) => wah.set;
>>    freqs[i]*6.28/44100.0 => float pFreq;
>>    pFreq / Qs[i] => float bandwidth;
>>    1.0 - (bandwidth * 0.5) => float radius;
>>    freqs[i] => wah2.pfreq;
>>    radius => wah2.prad;
>>    (1.0 - radius*radius) * 0.5 => wah2.gain;
>>    2.0 :: second => now;
>> }
>> 
>> left.closeFile();
>> right.closeFile();
>> 
>> /// END
> 
> 
> 
> -- 
> Thanks,
> Robert Oschler
> Twitter -> http://twitter.com/roschler
> http://www.RobotsRule.com/
> http://www.Robodance.com/
> 
> _______________________________________________
> Stk mailing list
> Stk at ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/stk




More information about the Stk mailing list