Re: Question about setting sampling rate of sound input
Re: Question about setting sampling rate of sound input
- Subject: Re: Question about setting sampling rate of sound input
- From: Chris Reed <email@hidden>
- Date: Fri, 24 Oct 2003 16:46:22 -0500
For this case, it would probably be best to use an AudioConverter to
convert from the input sample rate to whatever rate you want to run
your FFT at. There's no guarantee that the input device will support
the sample rate you intend to use.
-chris
On Oct 24, 2003, at 12:07 AM, Michael Bonnice wrote:
My application listens to the default input device (either line in or
internal microphone) and does an FFT on it to know the frequency
content. It works but lacks resolution at low frequencies. I've
just been learning CoreAudio so there are some things that are not
clear to me yet.
I want to change the sampling rate from within my code. Somehow there
must be some sort of function call that does this. However, the
AudioDeviceSetProperty routine doesn't have a selector to set the
sample rate of the input device. The AudioUnits section of the
documentation says I can set the sample rate, but I can't find a
Component Manager selector for the default input device so I don't have
a way to use AudioUnitSetProperty.
I've tried asking the device to match to a format that has a lower
sampling rate (10000), but it picks 44100. It only has one format
(44100) when I use this:
count = sizeof(indevice);
err =
AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice,
&count, (void *) &indevice);
err = AudioDeviceGetPropertyInfo ( indevice, 0, true,
kAudioDevicePropertyStreamFormats, &count, NULL );
numDescriptions = count / sizeof(AudioStreamBasicDescription);
fprintf (stderr, "found %ld formats\n", numDescriptions );
I know I have seen other programs do this because they have an
interface where you pick 44100 or 22000 or whatever. How do I do this
in software?
Mike
_______________________________________________
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.