Re: Four Channel Output from Mono File (EMI 2|6) - newbie
Re: Four Channel Output from Mono File (EMI 2|6) - newbie
- Subject: Re: Four Channel Output from Mono File (EMI 2|6) - newbie
- From: Brian Willoughby <email@hidden>
- Date: Wed, 12 Feb 2003 17:24:05 -0800
Jamie,
I believe that your primary obstacle is that the EMI 2|6 only supports
2-channel and 6-channel modes. There is no 4-channel mode available. You
should modify your code to request 6 channels, and simply leave the latter 2
channels unmodified in your output callbacks.
I'm not sure what algorithm you should use to select among the available
modes, but it is possible to get a list from CoreAudio enumerating the
available modes. This is what Daisy does when populating the popups which you
use to select a configuration. You could probably come up with some code which
discards the 2-channel modes from the list, and selects the appropriate
6-channel mode since you require at least 4 channels for your application.
I am using Objective C and the Default Output Device to access the EMI 2|6 for
4-channel surround output. Rather than implement a GUI for selecting the
output format, I use Daisy to select the appropriate channel configuration from
the popup and set this as the default output device. There are various
sampling rates (44.1kHz, 48kHz, 96kHz) and bit depths (16-bit, 24-bit)
available, but only 2-channel and 6-channel configurations are available. Once
selected as the default output device, my program has access to 4 channels
(actually, 6) on the EMI 2|6.
My code is designed to adapt to the number of channels reported by the output
callback. When the Default Output Device mode has only 2 channels, the audio
is distributed over a stereo field, and any sound data for the rear channels is
discarded since there is nowhere to write it in the data packets. When the
Default Output Device mode has 4 or more channels, the code fills the buffers
for the first 4 channels, and leaves any number of additional channels
unaltered. I've never bothered hooking up audio outputs to the 5 and 6 to see
if there is white noise or silence, but I suspect they're silent.
I cannot give any advice on Java or mono sources, since I have not been
working with those, but I don't see that there would be any difference between
a mono source panned across 4 channels and a 4-channel source output to 4
channels. I also have not tried setting the 6-channel mode from software, only
from the GUI in Daisy, but I am sure you can confirm how this is done by
examining the Daisy source code.
Your program should not crash when requesting 4 channels, though, so I assume
that the exception you receive is informational and not catastrophic...
Brian Willoughby
Sound Consulting
Begin forwarded message:
Subject: Four Channel Output from Mono File (EMI 2|6) - newbie
From: "Jamie Cameron Allen" <email@hidden>
To: email@hidden
Date: Sun, 09 Feb 2003 22:23:22 +0000
I am trying to implement a spatial audio system using the CA Java API. The
idea is to individually control a play-out signal into four output channels of
an EMI 2|6 interface (USB), starting with a Mono source file.
I have started with the OutputTester Apple example and have tried to change
the output properties of the device in order to change the conversion which
gets performed in the AudioProvider. That is, because the example is set up to
convert to the desired receiving format of the output device, using:
getOutputProperty(0,AHConstants.kAudioDevicePropertyStreamFormat, streamFormat)
in order to achieve the desired output.
I have mostly tried a multitude of setOutputProperties
(kAudioDevicePropertyPreferredChannelsForStereo, etc.), but I only get invalid
property information when I create a CAString to hold a non-default value.
Another strategy is that I have been trying to use
streamFormat.setChannelsPerFrame(4), and streamFormat.setBitsPerChannel(16),
etc., to try and get SOMETHING playing out of channels 3 & 4 (although I
realise this doesn't make much sense in terms of interleaving information as of
yet). All this gives is CAException in the AudioConverter class somewhere.
I guess, then, my questions are as follows:
-Should I be looking at AudioUnits to do this kind of thing? I've only been
trying to get it working with the HAL interfaces as the AudioUnits examples
don't compile (10.2.3, December Dev Tools!).
-Has anyone any experience with trying to generate multichannel output from
mono files?
-At what point in the play-out chain should I copy the data for output to 4
channels?
-Will it be necessary to generate a new 4-way interleaved intermediate buffer
of some kind before using AudioDevice.play? Is there anyway of just holding
copies of these data and outputting them in sync (without mixing them), without
having to interleave for play-out?
Any help that could be given would be greatly appreciated - Java related or
otherwise... I had assumed this would be quite a bit easier to implement
(i.e.: get channel numbers, load file into buffer, copy buffer, play all
buffers to channels), and am now a bit stuck!
Many thanks,
Jamie Allen
University of Glasgow
Centre for Music Technology
_______________________________________________
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.