Sample Rate Conversion using AudioConverter
Sample Rate Conversion using AudioConverter
- Subject: Sample Rate Conversion using AudioConverter
- From: Tommy Braas <email@hidden>
- Date: Fri, 6 Jun 2003 01:00:08 -0700
Hi,
I have been trying to figure out how to properly feed an instance of
AudioConverter using AudioConverterConvertBuffer(...).
Most of the time it works just nicely! Good job Bill et al!!!
Here's my specific problem, I am setting an AudioConverter up to
convert between;
8kHz, 8bit signed byte, mono
and
44.1kHz, 32 bit Float32, stereo
When I ask for the appropriate input buffer size (using
kAudioConverterPropertyCalculateInputBufferSize), it keeps changing
between calls! For 4096 bytes in the output buffer, it starts off
returning 104 bytes for the input buffer (I believe it should be 512 in
this case?). The second call returns 92! After the first value of 92,
every four calls will return the value 96 bytes for the input buffer
size. One would assume that the value would be the same (predictable),
but it is not. The read/convert loop runs for a while and finally the
converter reports a kAudioConverterErr_InvalidInputSize (much to my
dismay.)
Enough about the problem. Focusing on a solution.
What should I do to solve this problem? All my audio processing
(recording/playback/VST filtering) is done both on-line and off-line.
Both cases could possibly be solved by using AudioUnits, but at this
stage it would probably take too long to implement considering rapidly
approaching deadlines.
Please give me feedback on the following suggestions:
1. Manually transform a one channel audio format to a two channel
format by copying the one channel audio into both of the two channels
in the two channel audiop format
2. Use two AudioConverter instances. One for converting channels, and
one for converting the actual sample rate
3. Any other suggestion you might have :-)
I have searched through the core-audio dev list archives for answers,
but have been unsuccessful in finding anything useful, considering the
current predicament I find myself in...
Any and all help will be greatly appreciated!
Thanks,
Tommy Braas
_______________________________________________
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.