• 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: Problems with AUPitch and sample rate (perhaps S/R change problems in general)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with AUPitch and sample rate (perhaps S/R change problems in general)


  • Subject: Re: Problems with AUPitch and sample rate (perhaps S/R change problems in general)
  • From: William Stewart <email@hidden>
  • Date: Mon, 17 Jul 2006 11:15:28 -0700


On 15/07/2006, at 9:53 AM, B.J. Buchalter wrote:

To answer my own question for the archives:

When I change the sample rate, I do the following:

err = AudioUnitUninitialize(mInstance);
err = AudioUnitSetProperty(mInstance, kAudioUnitProperty_SampleRate,
kAudioUnitScope_Global, 0, &caSR, size);
err = AudioUnitInitialize(mInstance);

Turns out that this changes the Sample rate only on the 0 element of the
output scope (in the AU SDK, the code says that this is a "convenience"
alias to the output).


IMO, this is a bug in the AU base classes. If I change the SR globally on a
AU, the AU base classes should automatically scan over all valid scopes and
elements and apply the SR change to all of them.

No, its quite deliberate.

A sample rate (just as with any other format characteristic) is explicitly related to the particular scope/element. There is no general concept of an AU's global sample rate.

A couple of cases can illustrate this:
(1) Some of Apple's format converters can take a different sample rate and thus perform a sample rate conversion between an input and an output sample rate
(2) Apple's 3DMixer will allow inputs to have a different sample rate



Bill, would you agree with this? Was this just an oversight, or was it done
like this by design? If you folks agree that this is a bug, I will radar it.


In any case, the work-around for this (or perhaps, the proper recipe) is to
manually apply the SR change to all the scopes and elements that are in use:


Yes, this is expected and correct

Bill



err = AudioUnitUninitialize(mInstance);
err = AudioUnitSetProperty(mInstance, kAudioUnitProperty_SampleRate,
kAudioUnitScope_Global, 0, &caSR, size);
err = AudioUnitSetProperty(mInstance, kAudioUnitProperty_SampleRate,
kAudioUnitScope_Input, 0, &caSR, size);
err = AudioUnitSetProperty(mInstance, kAudioUnitProperty_SampleRate,
kAudioUnitScope_Output, 0, &caSR, size);
err = AudioUnitInitialize(mInstance);



This removes the odd behavior I was seeing from AUPitch.

Best regards,

B.J. Buchalter

Metric Halo
5 Donovan Drive
Hopewell Junction, NY 12533 USA
tel +1 845 223-6112
fax +1 603 250-2451


_______________________________________________ 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

--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________ __
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________ __


_______________________________________________
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


  • Follow-Ups:
    • Re: Problems with AUPitch and sample rate (perhaps S/R change problems in general)
      • From: "B.J. Buchalter" <email@hidden>
References: 
 >Re: Problems with AUPitch and sample rate (perhaps S/R change problems in general) (From: "B.J. Buchalter" <email@hidden>)

  • Prev by Date: Re: Empty file created with ExtAudioFileWrite
  • Next by Date: Re: Using aggregate devices with iSight
  • Previous by thread: Re: Problems with AUPitch and sample rate (perhaps S/R change problems in general)
  • Next by thread: Re: Problems with AUPitch and sample rate (perhaps S/R change problems in general)
  • Index(es):
    • Date
    • Thread