Changing sample rate of AVCaptureAudioDataInput
Changing sample rate of AVCaptureAudioDataInput
- Subject: Changing sample rate of AVCaptureAudioDataInput
- From: James <email@hidden>
- Date: Wed, 2 Feb 2011 17:30:27 +0000
Hi
I'm successfully using an AVAudioSession to capture input from the
microphone of my iPhone 4, using AVMediaTypeAudio as the
AVCaptureDevice. My callback is working, and I'm getting data, however
there doesn't seem to be an option to change the sample rate. In my
callback (- (void)captureOutput:(AVCaptureOutput *)captureOutput
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
fromConnection:(AVCaptureConnection *)connection), when I look at the
sampleBuffer it appears like this:
mediaSpecific: {
ASBD: {
mSampleRate: 44100.000000
mFormatID: 'lpcm'
mFormatFlags: 0xc
mBytesPerPacket: 2
mFramesPerPacket: 1
mBytesPerFrame: 2
mChannelsPerFrame: 1
mBitsPerChannel: 16 }
Is it possible to force the microphone to record at a lower sample
rate, or do I need to convert the sampleBuffer? I want to have a
sample rate of 8000, so am not sure the best way to achieve this. I
know it's possible with audio queues, and I know that you can use
setPreferredHardwareSampleRate on the shared instance of
AVAudioSession, but not sure if that affects AVCaptureSession.
Thanks
James
_______________________________________________
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