Re: Sample Rate Conversion using AudioConverter
Re: Sample Rate Conversion using AudioConverter
- Subject: Re: Sample Rate Conversion using AudioConverter
- From: Steve Hoek <email@hidden>
- Date: Fri, 06 Jun 2003 08:41:40 +1200
44100 x 32 x 2 = 2822400 bits / second
8000 x 8 x 1 = 64000 bits / second
ie a ratio of 44.1 to 1.
4096 / 44.1 = 92.879818594. This is what the number of input samples will
average over time, and there's probably a good reason to optimize input
buffers to multiples of 4 bytes.
--
Steve Hoek Ph. +64-9-480-2396
Director of R&D Fax. +64-9-480-2397
Serato Audio Research Ltd
http://www.serato.com/
>
From: Tommy Braas <email@hidden>
>
Date: Fri, 6 Jun 2003 01:00:08 -0700
>
To: coreaudio-api <email@hidden>
>
Subject: Sample Rate Conversion using AudioConverter
>
>
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.
_______________________________________________
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.