Re: Variable-Variable Speed Playback
Re: Variable-Variable Speed Playback
- Subject: Re: Variable-Variable Speed Playback
- From: Chris Rogers <email@hidden>
- Date: Mon, 11 Jul 2005 18:50:07 -0700
On Jul 11, 2005, at 4:33 PM, Wayne Anderson wrote:
I need to vary the playback speed of a sound sample where the speed
is controlled by a mathematical curve.
That is, the instantaneous playback speed is proportional to the
instantaneous slope of the curve.
Assuming the slope is always positive, the varispeed audio unit
seems like a good choice for this.
To use it, I plan to use an algorithm that maps a set of straight
line segments to the curve.
The slope of each segment is proportional to one of the available
discrete steps on the varispeed unit.
My questions are as follows:
1) What are the limitations, if any, on real time programatic
setting of the speed while playing?
The playback rate changes are taken into account on a per-buffer
basis, so if you're rendering
512 sample-frames at a time (with a call to AudioUnitRender() ), then
you're able to adjust the
rate at that granularity. You can increase the precision by
rendering at a smaller buffer size
(256, 128, 64, etc.). The basic idea is you set the rate parameter
value in the pre-render
notification.
2) what are the actual discrete settings that the unit can accept?
The default interface implies that the minimum unit is Cents,
Is this really the internal resolution?
Are there preferred increments or "magic numbers" that improve
performance and/or output quality?
The rate (and pitch parameters) are continuously adjustable (they're
floating-point values).
Even though the pitch is in units of cents, it is possible to set to
+112.374 cents, for example.
These values can be set quite precisely, and no values are "magic" or
better, except that the
much more extreme rate changes will be processed at a lower quality
than very small rate changes
as a general rule.
3) what are the differences between the highest and lowest quality
settings?
The lowest quality setting is considerably better than linear-
interpolation. The highest quality is
fairly decent. You can use your ears to judge or make some
measurements yourself if you like.
In any case, the performance in highest quality mode isn't very heavy
on a reasonably fast machine,
so you may wish to just choose highest unless you're extremely
concerned about CPU usage.
What about the more general problem of curves that have slopes that
can go both positive and negative.
That is, the playback speed would vary and possibly reverse with
some varying speed.
Playing back audio in reverse simply means that the audio stream you
feed the varispeed AU
is reversed. So basically you'll have to take care of buffering the
input audio appropriately,
reading from the buffer either in forward or reverse order. If
you're feeding your buffer from a file,
then you'll need to deal with the possibility of reading sections
from the file in reverse order.
The varispeed AU doesn't know or really care if you're giving it a
"forwards" or "backwards" audio stream
and simply changes the playback speed of whatever it's given.
Any information or thoughts on this problem would be greatly
appreciated.
Wayne
__________________________________
Wayne Anderson
Red Rock Software, Inc.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com
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