UNPKG

1.4 kBTypeScriptView Raw
1import { ToneAudioWorkletOptions } from "../core/worklet/ToneAudioWorklet.js";
2import { Effect, EffectOptions } from "./Effect.js";
3import { Positive } from "../core/type/Units.js";
4import { Param } from "../core/context/Param.js";
5export interface BitCrusherOptions extends EffectOptions {
6 bits: Positive;
7}
8/**
9 * BitCrusher down-samples the incoming signal to a different bit depth.
10 * Lowering the bit depth of the signal creates distortion. Read more about BitCrushing
11 * on [Wikipedia](https://en.wikipedia.org/wiki/Bitcrusher).
12 * @example
13 * // initialize crusher and route a synth through it
14 * const crusher = new Tone.BitCrusher(4).toDestination();
15 * const synth = new Tone.Synth().connect(crusher);
16 * synth.triggerAttackRelease("C2", 2);
17 *
18 * @category Effect
19 */
20export declare class BitCrusher extends Effect<BitCrusherOptions> {
21 readonly name: string;
22 /**
23 * The bit depth of the effect
24 * @min 1
25 * @max 16
26 */
27 readonly bits: Param<"positive">;
28 /**
29 * The node which does the bit crushing effect. Runs in an AudioWorklet when possible.
30 */
31 private _bitCrusherWorklet;
32 constructor(bits?: Positive);
33 constructor(options?: Partial<BitCrusherWorkletOptions>);
34 static getDefaults(): BitCrusherOptions;
35 dispose(): this;
36}
37interface BitCrusherWorkletOptions extends ToneAudioWorkletOptions {
38 bits: number;
39}
40export {};