CrossFade
class Component ↳ extends ToneAudioNode<CrossFadeOptions>
Tone.Crossfade provides equal power fading between two inputs. More on crossfading technique here.
+---------+ +> input a +>--++-----------+ +---------------------+ | | || 1s signal +>--> stereoPannerNode L +>----> gain | |+-----------+ | | +---------+ | +-> pan R +>-+ | +--------+ | +---------------------+ | +---> output +> +------+ | | +---------+ | +--------+ | fade +>----+ | +> input b +>--+ +------+ | | | +--> gain | +---------+const crossFade = new Tone.CrossFade().toDestination(); // connect two inputs Tone.to a/b const inputA = new Tone.Oscillator(440, "square").connect(crossFade.a).start(); const inputB = new Tone.Oscillator(440, "sine").connect(crossFade.b).start(); // use the fade to control the mix between the two crossFade.fade.value = 0.5;
Constructor
Section titled “Constructor”new CrossFade(fade?: number)Parameters
-
fade
numberoptionalThe initial fade value [0, 1].
new CrossFade(options?: Partial<CrossFadeOptions>)Parameters
- options
Partial<CrossFadeOptions>optional
Properties
Section titled “Properties”read-only
fade: Signal<"normalRange">The mix between the two inputs. A fade value of 0 will output 100% crossFade.a and a value of 1 will output 100% crossFade.b.
read-only
input: undefinedCrossFade has no input, you must choose either a or b
output
Section titled “output”read-only
output: GainThe output is a mix between a and b at the ratio of fade
Methods
Section titled “Methods”getDefaults()
Section titled “getDefaults()”static
getDefaults(): CrossFadeOptionsReturns all of the default options belonging to the class.
Returns CrossFadeOptions
Inherited members
Section titled “Inherited members”- From
ToneWithContext: context, blockTime, sampleTime, get(), immediate(), now(), set(), toFrequency(), toSeconds(), toTicks() - From
Tone: debug, version, disposed, toString() - From
ToneAudioNode: channelCount, channelCountMode, channelInterpretation, numberOfInputs, numberOfOutputs, chain(), connect(), disconnect(), fan(), toDestination(), toMaster()