<commit_before>import { Gain } from "../../core/context/Gain";
import { connect, ToneAudioNode, ToneAudioNodeOptions } from "../../core/context/ToneAudioNode";
import { optionsFromArguments } from "../../core/util/Defaults";
import { readOnly } from "../../core/util/Interface";
import { GainToAudio } from "../../signal/GainToAudio";
import { Signal } from "../../signal/Signal";

interface CrossFadeOptions extends ToneAudioNodeOptions {
	fade: NormalRange;
}

/**
 * Tone.Crossfade provides equal power fading between two inputs.
 * More on crossfading technique [here](https://en.wikipedia.org/wiki/Fade_(audio_engineering)#Crossfading).
 * @example
 * var crossFade = new CrossFade(0.5);
 * //connect effect A to crossfade from
 * //effect output 0 to crossfade input 0
 * effectA.connect(crossFade.a);
 * //connect effect B to crossfade from
 * //effect output 0 to crossfade input 1
 * effectB.connect(crossFade.b);
 * crossFade.fade.value = 0;
 * // ^ only effectA is output
 * crossFade.fade.value = 1;
 * // ^ only effectB is output
 * crossFade.fade.value = 0.5;
 * // ^ the two signals are mixed equally.
 */
export class CrossFade extends ToneAudioNode<CrossFadeOptions> {

	name = "CrossFade";

	/**
	 * The crossfading is done by a StereoPannerNode
	 */
	private _panner: StereoPannerNode = this.context.createStereoPanner();

	/**
	 * Split the output of the panner node into two values used to control the gains.
	 */
	private _split: ChannelSplitterNode = this.context.createChannelSplitter(2);
<commit_msg>adding some ascii art to better explain<commit_after>import { Gain } from "../../core/context/Gain";
import { connect, ToneAudioNode, ToneAudioNodeOptions } from "../../core/context/ToneAudioNode";
import { optionsFromArguments } from "../../core/util/Defaults";
import { readOnly } from "../../core/util/Interface";
import { GainToAudio } from "../../signal/GainToAudio";
import { Signal } from "../../signal/Signal";

interface CrossFadeOptions extends ToneAudioNodeOptions {
	fade: NormalRange;
}

/**
 * Tone.Crossfade provides equal power fading between two inputs.
 * More on crossfading technique [here](https://en.wikipedia.org/wiki/Fade_(audio_engineering)#Crossfading).
 * ```
 *                                             +---------+
 *                                            +> input a +>--+
 * +-----------+   +---------------------+     |         |   |
 * | 1s signal +>--> stereoPannerNode  L +>----> gain    |   |
 * +-----------+   |                     |     +---------+   |
 *               +-> pan               R +>-+                |   +--------+
 *               | +---------------------+  |                +---> output +>
 *  +------+     |                          |  +---------+   |   +--------+
 *  | fade +>----+                          | +> input b +>--+
 *  +------+                                |  |         |
 *                                          +--> gain    |
 *                                             +---------+
 * ```
 * @example
 * var crossFade = new CrossFade(0.5);
 * //connect effect A to crossfade from
 * //effect output 0 to crossfade input 0
 * effectA.connect(crossFade.a);
 * //connect effect B to crossfade from
 * //effect output 0 to crossfade input 1
 * effectB.connect(crossFade.b);
 * crossFade.fade.value = 0;
 * // ^ only effectA is output
 * crossFade.fade.value = 1;
 * // ^ only effectB is output
 * crossFade.fade.value = 0.5;
 * // ^ the two signals are mixed equally.
 */
export class CrossFade extends ToneAudioNode<CrossFadeOptions> {

	name = "CrossFade";

	/**
	 * The crossfading is done by a StereoPannerNode
	 */
	private _panner: StereoPannerNode = this.context.createStereoPanner();

	/**
	 * Split the output of the panner node into two values used to control the gains.
	 */
	private _split: ChannelSplitterNode = this.context.createChannelSplitter(2);

{'fraction_non_alphanumeric': 0.16847545219638244, 'fraction_numerical': 0.005943152454780362, 'mean_word_length': 2.026583268178264, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6700638', 'n_tokens_mistral': 1160, 'n_tokens_neox': 1102, 'n_words': 290}