• 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
Re: Biquad Filter in Audio Unit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Biquad Filter in Audio Unit


  • Subject: Re: Biquad Filter in Audio Unit
  • From: tahome izwah <email@hidden>
  • Date: Mon, 13 Dec 2010 21:04:21 +0100

Looks like your x's and y's are local variables... you need to keep
them around between calls otherwise you'll get clicks.

HTH
--th

2010/12/13 cocell <email@hidden>:
> I'm trying to implement a Peak Biquad filter in my CallBack. I get
> distortion during playback. Can someone plz help me?
> What am I doing wrong?
>
> Here's my callback, everything else is setup.
> playing the sample , outA[i] = *callBack->samplePtr++   by itself works
> great, but not when I but the filter in.
>
> OSStatus CallBack(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags,
> const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32
> inNumberFrames, AudioBufferList *ioData) {
> AudioBufferList list;
>
> CallBack *callBack = (CallBack*) inRefCon;
>
> sampleInp = *callBack->samplePtr++;  //AudioSampleType
> AudioSampleType *outA = (AudioSampleType *)ioData->mBuffers[0].mData;
>
> ///Declare coeff
>
> ////////////////////
> //Build the Peak Filter here
> ////////////////
>
> b0=1.0 +(alpha *A);
> b1= -2.0 * cs;
> b2=1.0 -(alpha *A);
> a0=1.0 + (alpha/A);
> a1=-2.0*cs;
> a2=1.0-(alpha / A);
>
> a0=b0/a0;
> a1=b1/a0
> a2=b2/a0;
> a3=a1/a0;
> a4=a2/a0;
>
>
>
>
> /// Loop sample
> for (UInt32 i = 0; i < inNumberFrames; ++i){
>
> outA[i] = a0*sampleInp+a1*x1+a2*x2 - b1*y1-b2*y2;
>
> x2=x1;
> x1=sampleInp;
>
> y2=y1
> y1=outA[i];
>
> }
>  return 0;
> }
>
>
 _______________________________________________
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

References: 
 >Biquad Filter in Audio Unit (From: cocell <email@hidden>)

  • Prev by Date: Biquad Filter in Audio Unit
  • Next by Date: Re: Biquad Filter in Audio Unit
  • Previous by thread: Biquad Filter in Audio Unit
  • Next by thread: Re: Biquad Filter in Audio Unit
  • Index(es):
    • Date
    • Thread