• 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: Sample rate change
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sample rate change


  • Subject: Re: Sample rate change
  • From: William Stewart <email@hidden>
  • Date: Mon, 27 Aug 2007 11:17:43 -0700


On 26/08/2007, at 2:34 PM, Andreas Falkenhahn wrote:


Hi,

how could I change the sample rate of a sound while it is playing on a mixer
bus? I saw in the includes that the 3DMixer supports a parameter to change
the sample rate on the fly, but I'm currently using the StereoMixer because I
don't need the 3D stuff. I'm already doing sample rate conversion in the
StereoMixer using an audio converter in my render proc, but how should I
change the sample rate of a playing sample? This would require a new
audio converter AFAICS!

Yes


So the only idea that comes to my mind is to stop the render proc on that
bus, dispose of the old audio converter, create a new audio converter with
the new sample rate, and restart the render proc on the required bus. I
haven't tried this approach yet, but I could imagine that it would cause a
certain crack to be audible, because I'm temporarily stopping playback.

Yes - but you are correct that is what you would have to do.

In this case you have a disruptive situation to deal with - the input that you are providing to the mixer is now of a different sample rate than what you had configured.

But, I don't think this is what you are needing to do. From the sound of it what you want to do is to change the playback rate of that input - make it go faster and slower.

We have two audio units that you can use to do this:

AUVarispeed ('aufc', 'vari', 'appl') - this will allow you to change the playback rate (the rate parameter) to make the audio play faster or slower (faster means higher pitch, slower; lower pitch)
AUTimePitch ('aufc', 'tmpt', 'appl') - this gives you independent control on the play rate and the pitch.


Both of these audio units can also do sample rate conversions, so you would typically set them up as follows:

input sample rate - the sample rate of the audio generator (for example, the sample rate of a file you might be rendering)
output sample rate - the sample rate of the overall mix (typically, this would be the sample rate of the device you are playing out too)



You can have a look at both of these units in AULab - just launch AULab and make a document with an FilePlayer generator audio unit. You'll then see an ability to add either of these AUs in the strip with the file player. You can then see their UI when you add them, and see what affect changing the various parameters has. The parameters can be used programatically (they are listed in <AudioUnit/ AudioUnitParameters.h> or you can bring up the same generic slider view for these AUs in your application




So I'm wondering what I should do? Should I go with this approach, or is there a better one? Or should I abandon the StereoMixer completely and go with the 3DMixer which seems to support sample rate change on the fly?

The 3DMixer doesn't support sample rate changes on the fly, but it does support a playback rate parameter to adjust the speed/pitch. It has the same overall affect as AUVarispeed, but the quality is lower than using AUVarispeed.


Bill


Tks for any opinions

Andreas

 _______________________________________________
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


References: 
 >Sample rate change (From: "Andreas Falkenhahn" <email@hidden>)

  • Prev by Date: Re: AudioConverterNew() failure
  • Next by Date: Newbie confusion!
  • Previous by thread: Re: Sample rate change
  • Next by thread: Newbie confusion!
  • Index(es):
    • Date
    • Thread