Re: Processing stereo data?
Re: Processing stereo data?
- Subject: Re: Processing stereo data?
- From: Rick Mann <email@hidden>
- Date: Wed, 09 Mar 2011 00:54:14 -0800
Thanks for the tips. It turns out I only need the very last sample, and I did exactly what you suggest in terms of optimization.
I was able to get the simple gain change to work by subclassing ProcessBufferLists(). I then tried doing my more complex processing (which is to treat left & right as I and Q samples from a downconverted radio front-end). The overall operation is straightforward (as described here: http://www.nonstopsystems.com/radio/article-sdr-is-qs.pdf):
newSample = (Q * lastI - I * lastQ) / (I * lastI + Q * lastQ);
But I get nothing but crackliness. Clearly I'm not doing something right. Could be the incoming data is not what I expect, either. I'll consult with my radio friend and see what he has to say.
--
Rick
On Mar 9, 2011, at 00:42:38, Brian Willoughby wrote:
> Rick,
>
> If you carefully read the headers for the example classes, you'll note that they're intended for AUs that have the same number of inputs as outputs. Since you are creating a stereo-to-mono effect, you should avoid subclassing the code that is designed only for mono-to-mono or stereo-to-stereo, et cetera. Read all of the comments in AUBase.* AUEffectBase.* and AUInlineEffectBase.*, among others. There are fairly clear instructions there with regard to the number of channels being different on input versus output, and you should follow the recommendations as to which method to override.
>
> It's a bit more difficult because there isn't an example of the M-to-N effect, and there are some unfortunate design choices where the common class is missing a few handy routines that you'll have to copy over from the N-to-N class, but it's doable.
>
> As for using the last few samples to generate the next one, that means you have "state." This must be stored in your class variables so that the live between buffers. For the sake of speed, these state variables are usually copied to local register variables so that they can be accessed quickly during the loop over your input and output buffers, and then at the end of your loop the class variables should be updated with the final values of the register variables. Of course, you don't have to optimize your code like this, but it shouldn't hurt.
>
> Brian Willoughby
> Sound Consulting
>
>
> On Mar 8, 2011, at 23:57, Rick Mann wrote:
>> Thanks, Joe, that's very helpful. Not only do I have to process both channels together simultaneously, I also need to use the last few samples, to generate the next one, and I'm not sure how to do that across invocations (other than just storing the last samples from the previous invocation. Oh, and I need to produce mono output, but that will hopefully be more straightforward.
>>
>> Thanks for showing me ProcessBufferLists(). That'll help.
>>
>>>
>> Am 09.03.2011 um 05:12 schrieb Rick Mann:
>>> I'm working through the Audio Unit Programming Guide Simple Effect tutorial. I've created an Audio Unit Effect from Xcode 2.3.5 stationery.
>>>
>>> The comments in the Process() method say that num channels is always 1, and that it requires non-interleaved format for all inputs and outputs.
>>>
>>> But then when they advance the input sample pointer by inNumChannels (which is 1), the comment says "stereo, we're advancing 2 samples".
>>>
>>> In any case, my effect only gets one channel. How can I work with stereo data? Is that covered later in the tutorial?
>
_______________________________________________
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