Re: sample rate conversion
Re: sample rate conversion
- Subject: Re: sample rate conversion
- From: Brian Willoughby <email@hidden>
- Date: Fri, 3 Sep 2010 17:35:35 -0700
On Sep 3, 2010, at 17:17, Edwards, Waverly wrote:
I am working with ExtAudioFile API's and I hit a snag that I have
not been
able to figure out how to work through. I have two file both with
different
sample rates. I plan to mix the two files but I concluded that I
need to
ensure that the sample rates are the same, otherwise I will not be
able
to properly mix the two files. I've been reading the documentation
but
I havent found anything that would satisfy this need. Would someone
suggest a solution and even better, if there is an example that I
can look
at.
You're on the right track. I suggest that you write your code to
determine which of the files has the higher sample rate, and then use
the ExtAudioFile API to set the client format for the other file -
the one with the lower sample rate - to match the higher one. Then,
when you get data from ExtAudioFile for the lower-quality file, it
will be converted.
In contrast, AudioFile does not offer a client data format that is
different from the file format. You would need to create your own
AudioConverter object to handle that. Thankfully, ExtAudioFile
handles this for you, but you still need to tell it what client
format you prefer (e.g. you could decide to use a lower sample rate,
or even a much higher sample rate that is a common factor of both
input sample rates, for improved mixing quality - there are many
options).
There is sample source on your drive for afconvert, which should show
how this is done.
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