Re: set buffer size for a duration?
Re: set buffer size for a duration?
- Subject: Re: set buffer size for a duration?
- From: Michael Thornburgh <email@hidden>
- Date: Thu, 10 Aug 2006 23:39:24 -0700
???????? <- sizeof(Float32).
depending on what you really want to accomplish, using an
AudioBufferList or an MTAudioBuffer might make things even easier.
at the very least, i'd use an AudioBufferList (either interleaved or
de-interleaved, depending on the processing you want to do) rather
than a raw Float32 buffer. that way it's easier to interface with
AudioUnits as well as other stuff in the MTCoreAudio framework.
i'd recommend checking the "AudioBufferList Utility Functions" and
"MTAudioBuffer class" pages in the MTCoreAudio documentation. the
AudioMonitor sample app has an "MTConversionBuffer" class in it,
which has no documentation, but should be reasonably elf-explanatory
if you're comfortable with objc already and get how MTAudioBuffers
work. MTConversionBuffer is like MTAudioBuffer, but also does sample
rate conversion. AudioMonitor uses MTConversionBuffers for copying
audio from any input device (at any sample rate) to any output device
(at any sample rate).
the source for AudioMonitor is intended to be a template/tutorial for
using MTCoreAudio.
HTH. and i apologize for the old-osity of MTCoreAudio -- it's
definitely getting long in the tooth and could use some freshening up.
-mike
On Aug 10, 2006, at 10:29 PM, Paul Fredlein wrote:
Hi,
I'm playing with MTCoreAudio and need to record, say, 5 seconds of
audio.
int sample_rate, num_channels, buffer_frames;
sample_rate = [inputDevice nominalSampleRate];
num_channels = [inputDevice
channelsForDirection:kMTCoreAudioDeviceRecordDirection];
buffer_frames = [inputDevice deviceBufferSizeInFrames];
int duration = 5;
int bufsize = duration * sample_rate * num_channels * ????????
buf = malloc(bufsize);
How do I calculate the bufsize?
Thanks,
Paul
_______________________________________________
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