Fader(duration=1.0, start=1, end=0, transform=None, pauseWhenDone='auto')¶
A callable object that can be assigned to one of the dynamic properties of a
Playerto smoothly transition from a
endvalue. It is a self- terminating dynamic: when the transition is finished, it will raise a
StopIterationexception, which will be caught by the
Player, causing it to replace the dynamic with a final static value.
import time, audiomath as am p = am.Player(am.TestSound('12')) fadeIn = am.Fader(3.0, start=0, end=1) p.Play(loop=1, volume=fadeIn) # fade in time.sleep(6.0) # wait for fade-in, then # stay constant for a few seconds p.volume = am.Fader(3.0) # fade out, then stop.
- duration (float) – duration of the transition, in seconds
- start (float, numpy.ndarray) – start value
- end (float, numpy.ndarray) – end value
- transform – an optional function through which to transform
endand any value linearly interpolated between them.
- pauseWhenDone – if
Soundwhen the transition is finished. If
False, do not. A value of
'auto', means “pause the sound when the transition is finished if the
endvalue is zero”.