• 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: panning
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: panning


  • Subject: Re: panning
  • From: Doug Wyatt <email@hidden>
  • Date: Sun, 5 May 2002 14:42:37 -0700

On Sunday, May 5, 2002, at 08:23 , Arthur Clemens wrote:
Hi
I've come across some examples of CoreAudio code that creates a panning effect for individual channels by iterating n frames over the source buffer and multiplying each source frame with the left and right volume values, something like this:

float f;
for (i=0; i<frameCount; ++i) {
f = *sourceBuffer++;
*outBuffer++ = f * leftVolume;
*outBuffer++ = f * rightVolume;
}


I wonder if this is a preferred method.

That's the correct algorithm ... you might find that the code will run faster by doing two or more samples per loop iteration in order to give the compiler more room for optimizing with instruction scheduling.

Wouldn't it be better to create a AUGraph for panning?
The problem is I don't really get the concept of AUGraphs, or when to use them.

From bottom up, we have several layers of audio API's:

CoreAudio - as close as you can get to talking to the hardware for audio I/O
AudioToolbox/AudioConverter - useful for sample rate conversion, channel mapping (when
dealing with multi-channel hardware), and format conversions (PCM only
in 10.1, but if you look at the API you'll see that it could be extended to support
codecs... (as we'll be discussing at WWDC)
AudioUnits
output units - hide some details of talking to the hardware, allow
you to output to the system (alert) and default output devices
effects etc. - reusable DSP plug-ins, some provided by Apple, developers
can also publish their own
AUGraph
construct arbtirarily complex chains (graphs) of AudioUnits
- for dedicated purposes if you hardcode the AudioUnits used
- allowing user-selectable effects if you allow the user to choose how the graph
is constructed

You can benefit from AUGraph if you want to leverage AudioUnits provided by Apple or others, or package your own DSP code in reusable components.

If you have a more highly specialized application, you might have no need for AUGraph and AudioUnits -- you might just do all your own DSP and then talk to the hardware or output AudioUnits.

HTH,
Doug

--
Doug Wyatt
work: email@hidden (CoreAudio)
personal: email@hidden http://www.sonosphere.com

"Don't negate, create."
-- dsw
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

References: 
 >panning (From: Arthur Clemens <email@hidden>)

  • Prev by Date: Re: More thread scheduling observations
  • Next by Date: Re: More thread scheduling observations
  • Previous by thread: panning
  • Next by thread: Re: More thread scheduling observations
  • Index(es):
    • Date
    • Thread