• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problems with a Low Pass Filter process
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with a Low Pass Filter process


  • Subject: Problems with a Low Pass Filter process
  • From: "herve.noury" <email@hidden>
  • Date: Sat, 04 Jun 2011 17:34:12 +0200

Hello,

I tried to create inside a SynthNote type additive synth a classical low pass filter. 

I created 2 arrays for the output values like this :
left = (float*)inBufferList.mBuffers[0].mData;
right = numChans == 2 ? (float*)inBufferList.mBuffers[1].mData : 0;
leftB = (float*)inBufferList.mBuffers[0].mData;   //the second array
rightB = numChans == 2 ? (float*)inBufferList.mBuffers[1].mData : 0;

I calculate alpha, beta and gamma belong a code source that I have :
float theta = Theta(cutOf, sampleRate);    //values of cutOf from 0 to 20 000 Hz.
float theSin = Qval / (2.0 * sin(theta));  //value for Q from 0 to 1
float beta = 0.5 * ((1.0 - theSin) / (1.0 + theSin));
float gamma = (0.5 + beta) * cos(theta);
float alpha = (0.5 + beta - gamma)/4.0;

//leftB[frame]+= the additive synth result

Then, inside the "case kNoteState_ReleasedButSustained" :
if (leftB[frame - 1] && leftB[frame-2]){
    UInt32 j = frame-2;
    UInt32 z = 0;
    if (j < z) j+=3;

                        

    UInt32 k = frame-1;
    if (k < z) k+=3;

                        

    left[frame] += 2*(alpha*(leftB[frame] + 2*leftB[k] + leftB[j]) + gamma*leftB[k] - beta*leftB[j]);
    if (right) right[frame] += 2*(alpha*(rightB[frame] + 2*rightB[k] + rightB[j]) + gamma*rightB[k] - beta*rightB[j]);
}

The result is just noisy : when the cutOf is in the middle, no effect, but when I want to filter the additive synth, it sounds like a BitCrunch effect. When Qval is too high, it crashes...
Would you have an idea?

Thanks!

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Problems with a Low Pass Filter process
      • From: Brian Willoughby <email@hidden>
  • Prev by Date: Re: Create MIDI device programmaticly without a MIDIDriver bundle
  • Next by Date: Re: Can MIDIPackets be modified after they are sent?
  • Previous by thread: Peculiarities setting the sample rate
  • Next by thread: Re: Problems with a Low Pass Filter process
  • Index(es):
    • Date
    • Thread