Re: Mixer at other sampling rates
Re: Mixer at other sampling rates
- Subject: Re: Mixer at other sampling rates
- From: Brian Willoughby <email@hidden>
- Date: Mon, 13 Dec 2010 20:14:41 -0800
On Dec 13, 2010, at 07:37, Zulfiqar Malik wrote:
I have a graph setup that combines inputs from different sources
into a mixer for output. For quicktime exports I use the exact same
setup but without output. I just get the data from the final mixer
node. The problem is that this entire graph setup is working at
44100Hz and we have customers who want the processing to be done in
48000Hz. When I try to set 48KHz frequency as input and output of
my mixer node it gives me an error (the error code is -10868). Can
someone explain why can I not process the audio data at 48KHz? Is
the only way to do this properly is to do it at 48KHz and then bump
it back to 44.1KHz? That would obviously incur a data loss which is
not desirable.
What you need to do is set 48 kHz in the StreamFormat property of the
output scope of every AudioUnit in your graph, before you call
AUGraphInitialize(). Then the system will copy the output sample
rate of each unit to the input sample rate of the next unit, and your
whole graph will be running at 48 kHz.
I believe that there is a way to change the sample rate after you
have initialized the graph, but it your case it would probably be
easier to just create everything and set the rate to 48 kHz before
you initialize or start anything.
A separate issue is setting the sample rate of the output device. If
your graph is writing to a file, then you would set 48 kHz when
creating the new audio file. If your graph is sending to an audio
device, then you have a few concerns. First, you could allow the
AUHAL to convert from 48 kHz to the default rate, but that might drop
audio quality. If you want to set the physical device rate, then you
need to be aware that changing the rate without manual user
intervention is a bad idea, because you could end up with a situation
where several applications are fighting to automatically change the
rate. Once you solve the issue of contention, either by having the
user manually set the rate or by hogging the output device and
setting it automatically, then you should be able to process at 48
kHz throughout your entire graph. You probably want to handle this
rate change before creating the AUHAL or initializing your graph, as
well.
Brian Willoughby
Sound Consulting
_______________________________________________
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