|
| 1 | +import { AdvancedAnalyserNodeProperties, EventListenerTypes, Listener, WindowFunctionTypes } from "../types"; |
| 2 | +/** |
| 3 | + * The Audio Node class. Do not instantiate this class directly. |
| 4 | + * Use the `createAdvancedAnalyserNode` method instead. |
| 5 | + */ |
| 6 | +export declare class AdvancedAnalyserNode extends AudioWorkletNode { |
| 7 | + private _portMapId; |
| 8 | + private _portMap; |
| 9 | + private _fftSize; |
| 10 | + private _samplesBetweenTransforms?; |
| 11 | + private _timeDomainSamplesCount?; |
| 12 | + private _windowFunction; |
| 13 | + private _minDecibels; |
| 14 | + private _maxDecibels; |
| 15 | + private _smoothingTimeConstant; |
| 16 | + readonly channelCount: number; |
| 17 | + readonly numberOfInputs: number; |
| 18 | + readonly numberOfOutputs: number; |
| 19 | + readonly channelCountMode: ChannelCountMode; |
| 20 | + readonly channelInterpretation: ChannelInterpretation; |
| 21 | + /** |
| 22 | + * The size of the FFT used for frequency-domain analysis (in sample-frames). |
| 23 | + * This MUST be a power of two in the range 32 to 32768. The default value is 2048. |
| 24 | + * Note that large FFT sizes can be costly to compute. |
| 25 | + * |
| 26 | + * @defaultValue 2048 |
| 27 | + */ |
| 28 | + get fftSize(): number; |
| 29 | + set fftSize(value: number); |
| 30 | + set samplesBetweenTransforms(value: number); |
| 31 | + get samplesBetweenTransforms(): number; |
| 32 | + get frequencyBinCount(): number; |
| 33 | + set timeDomainSamplesCount(value: number); |
| 34 | + get timeDomainSamplesCount(): number; |
| 35 | + set windowFunction(value: WindowFunctionTypes); |
| 36 | + get windowFunction(): WindowFunctionTypes; |
| 37 | + /** |
| 38 | + * Represents the minimum power value in the scaling range for the FFT analysis data, |
| 39 | + * for conversion to unsigned byte values. |
| 40 | + * Basically, this specifies the minimum value for the range of results when using `getByteFrequencyData()` |
| 41 | + * or listening to the `bytefrequencydata` event, in which any frequencies with an amplitude of minDecibels |
| 42 | + * or lower will be returned as 0. |
| 43 | + * |
| 44 | + * An exception will be thrown if set to more than or equal to maxDecibels. |
| 45 | + * @defaultValue -100 dB |
| 46 | + */ |
| 47 | + get minDecibels(): number; |
| 48 | + set minDecibels(value: number); |
| 49 | + /** |
| 50 | + * Represents the maximum power value in the scaling range for the FFT analysis data, |
| 51 | + * for conversion to unsigned byte values. |
| 52 | + * Basically, this specifies the maximum value for the range of results when using `getByteFrequencyData()` |
| 53 | + * or listening to the `bytefrequencydata` event, in which any frequencies with an amplitude of maxDecibels |
| 54 | + * or higher will be returned as 255. |
| 55 | + * |
| 56 | + * An exception will be thrown if set to less than or equal to maxDecibels. |
| 57 | + * @defaultValue -30 dB |
| 58 | + */ |
| 59 | + get maxDecibels(): number; |
| 60 | + set maxDecibels(value: number); |
| 61 | + /** |
| 62 | + * Represents the averaging constant with the last analysis frame. |
| 63 | + * It's basically an average between the current buffer and the last buffer the AnalyserNode processed, |
| 64 | + * and results in a much smoother set of value changes over time. |
| 65 | + * |
| 66 | + * @defaultValue 0. No averaging is applied. |
| 67 | + */ |
| 68 | + get smoothingTimeConstant(): number; |
| 69 | + set smoothingTimeConstant(value: number); |
| 70 | + private _eventListenersCount; |
| 71 | + /** |
| 72 | + * The Audiio Node class. Do not instantiate this class directly. |
| 73 | + * Use the `createAdvancedAnalyserNode` method, which registers this Worklet before instantiating it |
| 74 | + */ |
| 75 | + constructor(context: BaseAudioContext, properties: AdvancedAnalyserNodeProperties); |
| 76 | + private _uniqId; |
| 77 | + private _postMessage; |
| 78 | + onprocessorerror: (err: Event) => void; |
| 79 | + private _onmessage; |
| 80 | + private _updateProcessorOptions; |
| 81 | + private _postIdentifiedDataRequest; |
| 82 | + getFloatFrequencyData(): Promise<Float32Array>; |
| 83 | + getByteFrequencyData(): Promise<Uint8Array>; |
| 84 | + getFloatTimeDomainData(): Promise<Float32Array>; |
| 85 | + getByteTimeDomainData(): Promise<Uint8Array>; |
| 86 | + private _pushEventListener; |
| 87 | + private _removeEventListener; |
| 88 | + addEventListener(type: EventListenerTypes.bytefrequencydata | EventListenerTypes.bytetimedomaindata, listener: Listener<Uint8Array>): void; |
| 89 | + addEventListener(type: EventListenerTypes.frequencydata | EventListenerTypes.timedomaindata, listener: Listener<Float32Array>): void; |
| 90 | + addEventListener(type: "processorerror", listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; |
| 91 | + removeEventListener(type: "processorerror" | EventListenerTypes, listener: EventListenerOrEventListenerObject | Listener<ArrayBuffer>, options?: boolean | EventListenerOptions): void; |
| 92 | +} |
0 commit comments