Re: AudioDeviceSetProperty: kAudioDevicePropertyBufferFrameSize
Re: AudioDeviceSetProperty: kAudioDevicePropertyBufferFrameSize
- Subject: Re: AudioDeviceSetProperty: kAudioDevicePropertyBufferFrameSize
- From: tahome izwah <email@hidden>
- Date: Sat, 04 Feb 2012 22:55:18 +0100
Hi Bill,
perhaps you can explain why you are setting the buffer size at all? The way I see it, there are two different variables involved here: your frequency resolution which depends on your internal analysis block/window size and the device's audio buffer size. These two should never be hard linked since you'll never know what buffer size a particular device will support.
So what you'll want to do is use overlap-add / overlap-save to accumulate enough samples to fill your internal buffer until you have enough samples and do the analysis.
There are a couple of tutorials on this on the web, Numerical Recipes has one (look for "overlap-add"), and the DSP Dimension has an example using pitch shifting as well (look for "Pitch Shifting using the Fourier Transform", or smbPitchShift).
HTH
--th
2012/2/4 Bill Farmer
<email@hidden>
Hi
I have an error report from one user reporting 'nope', kAudioHardwareIllegalOperationError from AudioDeviceSetProperty: kAudioDevicePropertyBufferFrameSize setting the buffer size probably to 4096. The reason I can't be sure is that the buffer size is calculated at run time dependent on whether the sample rate can be reduced to 11025 or 12000. The application is an musical instrument tuner so I am not interested in anything higher than about 4Khz, so there is no point in sampling at any higher rate. On the macs I have tested the sample rate has stayed at 48000, so I have had to downsample by taking every fourth sample and increase the buffer size accordingly.
The user says: "I'm running OS 10.6.8 on an Intel Core 2 Duo iMac. I also tried my MacBook Pro and got the same error". I'm a bit puzzled by this, the application has been out there for download on Google code since September 2010, with the same bit of code in it, and this is the first report I've had.
What the application is attempting to do is set up an AUHal audio unit for input in accordance with Technical Note TN2091 with a sample rate of 11025 or 12000 and a frame size of 1024, or failing that, to downsample to achieve the same thing. There has been previous correspondence on this here: http://lists.apple.com/archives/coreaudio-api/2010/Oct/msg00224.html. I did what the man said and it worked just fine.
Is there a standard way of doing this that I have missed? Should I be attempting to set the buffer size range: kAudioDevicePropertyBufferFrameSizeRange? Is it possible to use a format converter to downsample on audio input?
Regards
Bill Farmer
_______________________________________________
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
_______________________________________________
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