• 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: Playing lots of tiny sounds with different formats?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Playing lots of tiny sounds with different formats?


  • Subject: Re: Playing lots of tiny sounds with different formats?
  • From: Chris Rogers <email@hidden>
  • Date: Thu, 1 Aug 2002 17:54:16 -0700

I would be concerned about the files being at different sample rates.
One possibility is to create a DLS or SoundFont sample bank, and then
directly trigger the sounds using the DLSMusicDevice software synth.
It's able to handle different sample rates with no extra overhead.
Unfortunately, I know of no good authoring tool on the Mac platform
for creating DLS or SoundFont files (a good opportunity for someone
out there...) - but they *can* be created. Tying the DLSMusicDevice
in with the 3D mixer can be tricky (but possible).

Otherwise, I would highly recommend pre-converting the files to the
system sample rate (usually 44.1KHz) since using AudioConverters
on-the-fly with many sound effects would be extremely inefficient.
At run time I would feed the samples into discrete inputs to the 3D mixer AudioUnit. You're able to setup callbacks on individual inputs to the
mixer, feed separate sound effect audio to each, and pan them around
individually. When an individual sound has stopped playing, you could
keep that mixer channel around (feeding it silence) until you have a new
sound effect ready to play, or more efficient would be to shut that channel
down (temporarily) until you actually need it by setting its input callback
to NULL...

Chris Rogers
Core Audio Engineer
Apple Computer



Ok, we've done a couple of game ports now using the low-level CoreAudio stuff, and we're trying to move up to AudioUnits.

We're currently using a single AudioUnit much the way we did the raw HAL -- we mix all of our sound effects and music ourselves and just hand out buffers to the default output device at 44.1.

Tonight I started playing with using the higher-level features of AudioToolbox and AudioUnits, and although I managed to get an reverb unit attached to the default output (and MAN did that sound cool) I still am fundamentally missing something.

So, given the following:

- I have 20-30 sound files that are stored at different sample rates (22 or 44), some stereo and some mono.
- During a game I need to queue these sounds in response to game actions, and play them out real-time, often overlapping each other.
- I want to add in the ability to do stereo panning for mono samples.
- I'd like to add in 3D positioning under Jaguar.
- I don't want to do the mixing myself.

Then, how should I set up my AudioUnits to use the least CPU?

Should I create an instance of the default output device for each format of sound file I might possibly play? (Does this even work?) This would create (potentially) a lot of devices that need to be serviced every cycle, and still leaves me doing the mixing myself for, say, all 22K mono sounds, then all 44K mono, then 22K stereo, etc.

Note: One thing I don't have a good grasp on is "input elements". I just haven't seen any docs on them. Reading through this list for the last couple of months, it looks like some (all?) audioUnits can accept multiple input streams at once, through the use of input elements.

Which units can do this? (The stereo mixer? The default output unit?) Can each input stream be configured to have a different sample rate? (Can the stereo mixer accept any sample rate I throw at it? Should I be pre-converting all my sound files when I launch the app?)

Maybe I should create and remove input elements on-the-fly on the default output unit, as I start and stop each sound? Or should I have a stable of input elements that are pre-configured on my mixer unit?

Am I totally off-base?

RELP!

Thanks,
-Wil Shipley
President, The Omni Group
_______________________________________________
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.
_______________________________________________
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: 
 >Playing lots of tiny sounds with different formats? (From: William Shipley <email@hidden>)

  • Prev by Date: Re: Playing lots of tiny sounds with different formats?
  • Next by Date: Re: VU Meter
  • Previous by thread: Re: Playing lots of tiny sounds with different formats?
  • Next by thread: Java Sample rate Conversation - AudioConverter.fillBuffer quits app with exitcode 10 ??? wth?
  • Index(es):
    • Date
    • Thread