View Single Post
Old 01-06-2021, 04:59 PM   #5
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

Got it! Multiplied the translated LFO value with the cutoff frequency, then added that to the cutoff frequency and divided the result by the sample rate to bring it to between 0 and 1. Seems to be correct so far anyway...

Code:
     // Process the input signal
     for (int i=0; i<numchans; i++)
     {
         // Get the sample to process
         double sampleBeingProcessed = inputs[i][s];
         
         // Filter
         if (GetParam(kFilterActive)->Value())
         {
             frequency = GetParam(kFilterCutoff)->Value() / (oversampledsamplerate);
             double resonance = GetParam(kFilterResonance)->Value();
             inputFilter[i]->setQ(resonance);
             
             lfotempval = LFODataGeneratedA[i][s];
             lfotempval = pow(2.0, lfotempval)-1;
             lfotempval = lfotempval * (GetParam(kFilterCutoffLFO1Mod)->Value() * 0.01);
             
             convfreq = GetParam(kFilterCutoff)->Value() + (GetParam(kFilterCutoff)->Value()*lfotempval);
             
             inputFilter[i]->setFc(convfreq / oversampledsamplerate);

             filtered = inputFilter[i]->process(inputs[i][s]);
             sampleBeingProcessed = filtered;
         }
Bobflip is offline   Reply With Quote