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

Fw: Biquad Filter in Audio Unit


  • Subject: Fw: Biquad Filter in Audio Unit
  • From: cocell <email@hidden>
  • Date: Mon, 13 Dec 2010 16:00:38 -0800 (PST)



----- Forwarded Message ----
From: cocell <email@hidden>
To: Hamilton Feltman <email@hidden>
Sent: Mon, December 13, 2010 3:22:06 PM
Subject: Re: Biquad Filter in Audio Unit

Ok, moved that into the Loop still distortion. The variables are  members of a struct which make them public...?  I took out here for simplicity.
it's actually struct->x1.... Plz help I'm been trying to figure this out for months now


From: Hamilton Feltman <email@hidden>
To: cocell <email@hidden>
Cc: "email@hidden" <email@hidden>
Sent: Mon, December 13, 2010 2:05:53 PM
Subject: Re: Biquad Filter in Audio Unit

sampleInp = *callBack->samplePtr++;

You need to put this line inside the loop.


--Hamilton Feltman
http://www.harmonicdog.com


On Dec 13, 2010, at 9:30 AM, cocell <email@hidden> wrote:

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>)
 >Re: Biquad Filter in Audio Unit (From: Hamilton Feltman <email@hidden>)

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