• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: AudioDeviceSetProperty: kAudioDevicePropertyBufferFrameSize
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AudioDeviceSetProperty: kAudioDevicePropertyBufferFrameSize


  • Subject: Re: AudioDeviceSetProperty: kAudioDevicePropertyBufferFrameSize
  • From: Bill Farmer <email@hidden>
  • Date: Sun, 05 Feb 2012 12:57:31 +0000

Hi

Thank you for the response. This app is a port from windows where you can just specify what input sample rate and buffer size you want. I have been working around the idiosyncracies of the mac audio system.

I am using the algorithm from the DSP Dimension smpPitchShift page for accumulating samples and frequency measuring. I was attempting to compensate for the overhead of frequently calling the input callback proc by increasing the buffer size to compensate for the downshifting I am forced to do because you don't appear to be able to change the input sample rate. At an input sample rate of 48000, and a 1024 sample buffer the proc gets called about 50 times a second. I wanted to get it down to about 12 times a second. I can't remember exactly, but I think the default frame size was a value not a power of 2, so I needed to change it anyway so as to not have a ridiculously complex aggregating algorithm.

I will need to adjust the aggregating algorithm to allow for the buffer size range available.

Regards
Bill Farmer

On 04/02/2012 21:55, tahome izwah wrote:

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

 _______________________________________________
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

References: 
 >AudioDeviceSetProperty: kAudioDevicePropertyBufferFrameSize (From: Bill Farmer <email@hidden>)
 >Re: AudioDeviceSetProperty: kAudioDevicePropertyBufferFrameSize (From: tahome izwah <email@hidden>)

  • Prev by Date: Re: Identical Audio Unit Channel Layout for Input and Output
  • Next by Date: How to enable iphone call recording?
  • Previous by thread: Re: AudioDeviceSetProperty: kAudioDevicePropertyBufferFrameSize
  • Next by thread: How to enable iphone call recording?
  • Index(es):
    • Date
    • Thread