Function XSound

Properties

ajax: ((params: {
    timeout?: number;
    type?: XMLHttpRequestResponseType;
    url: string;
    errorCallback?(event: ProgressEvent<EventTarget>, textStatus: "error" | "timeout"): void;
    progressCallback?(event: ProgressEvent<EventTarget>): void;
    successCallback?(event: ProgressEvent<EventTarget>, respsonse:
        | string
        | ArrayBuffer
        | Blob
        | Document): void;
}) => void)

Type declaration

    • (params): void
    • This class (static) method retrieves resource on web by Ajax.

      Parameters

      • params: {
            timeout?: number;
            type?: XMLHttpRequestResponseType;
            url: string;
            errorCallback?(event: ProgressEvent<EventTarget>, textStatus: "error" | "timeout"): void;
            progressCallback?(event: ProgressEvent<EventTarget>): void;
            successCallback?(event: ProgressEvent<EventTarget>, respsonse:
                | string
                | ArrayBuffer
                | Blob
                | Document): void;
        }
        • Optionaltimeout?: number
        • Optionaltype?: XMLHttpRequestResponseType
        • url: string
        • errorCallback?:function
          • Parameters

            • event: ProgressEvent<EventTarget>
            • textStatus: "error" | "timeout"

            Returns void

        • progressCallback?:function
          • Parameters

            • event: ProgressEvent<EventTarget>

            Returns void

        • successCallback?:function
          • Parameters

            • event: ProgressEvent<EventTarget>
            • respsonse:
                  | string
                  | ArrayBuffer
                  | Blob
                  | Document

            Returns void

      Returns void

Analyser: typeof Analyser
Autopanner: typeof Autopanner
BitCrusher: typeof BitCrusher
Chorus: typeof Chorus
Compressor: typeof Compressor
computeFrequency: ((index: number) => number)

Type declaration

    • (index): number
    • This class (static) method computes frequency from index that corresponds to 12 equal temperament.

      Parameters

      • index: number

        This argument is index that corresponds to 12 equal temperament. For example, this value is between 0 and 88 in case of piano.

      Returns number

      Return value is frequency.

computeHz: ((frequency: number, detune: number) => number)

Type declaration

computeIndex: ((octave: number, pitchChar: PitchChar) => number)

Type declaration

    • (octave, pitchChar): number
    • This class (static) method computes index by octave and PitchChar string.

      Parameters

      • octave: number

        This argument is octave.

      • pitchChar: PitchChar

        This argument is PitchChar string.

      Returns number

      Return value is index that is computed by octave and pitch character.

computePlaybackRate: ((playbackRate: number, detune: number) => number)

Type declaration

    • (playbackRate, detune): number
    • This class (static) method computes playback rate from playbackRate property and detune property (@see https://www.w3.org/TR/webaudio/#computedplaybackrate).

      Parameters

      • playbackRate: number

        This argument is playbackRate property as instance of AudioParam.

      • detune: number

        This argument is detune property as instance of AudioParam.

      Returns number

      Return value is computed playback rate.

convertTime: ((time: number) => ConvertedTime)

Type declaration

    • (time): ConvertedTime
    • This class (static) method calculates minutes, seconds and milliseconds from designated time (seconds).

      Parameters

      • time: number

        This argument is time (seconds).

      Returns ConvertedTime

      Return value is converted time as associative array

decode: ((context: AudioContext, arraybuffer: ArrayBuffer, successCallback?: ((buffer: AudioBuffer) => void), errorCallback?: ((error: Error) => void)) => Promise<AudioBuffer>)

Type declaration

    • (context, arraybuffer, successCallback?, errorCallback?): Promise<AudioBuffer>
    • This class (static) method decodes instance of ArrayBuffer to instance of AudioBuffer.

      Parameters

      • context: AudioContext

        This argument is instance of AudioContext for decodeAudioData method.

      • arraybuffer: ArrayBuffer

        This argument is decoded to instance of AudioBuffer.

      • OptionalsuccessCallback: ((buffer: AudioBuffer) => void)

        This argument is invoked on success.

          • (buffer): void
          • Parameters

            • buffer: AudioBuffer

            Returns void

      • OptionalerrorCallback: ((error: Error) => void)

        This argument is invoked on failure.

          • (error): void
          • Parameters

            • error: Error

            Returns void

      Returns Promise<AudioBuffer>

      Return value is instance of Promise that has instance of AudioBuffer.

Delay: typeof Delay
DOT
drop: ((params: {
    event: DragEvent;
    type: "objectURL" | FileReaderType;
    errorCallback?(event: ProgressEvent<EventTarget>, textStatus: FileReaderErrorText): void;
    progressCallback?(event: ProgressEvent<EventTarget>): void;
    successCallback?(event: ProgressEvent<EventTarget>, result: any): void;
}) => string | File | null)

Type declaration

    • (params): string | File | null
    • This class (static) method gets instance of File from DataTransfer.

      Parameters

      • params: {
            event: DragEvent;
            type: "objectURL" | FileReaderType;
            errorCallback?(event: ProgressEvent<EventTarget>, textStatus: FileReaderErrorText): void;
            progressCallback?(event: ProgressEvent<EventTarget>): void;
            successCallback?(event: ProgressEvent<EventTarget>, result: any): void;
        }
        • event: DragEvent
        • type: "objectURL" | FileReaderType
        • errorCallback?:function
        • progressCallback?:function
          • Parameters

            • event: ProgressEvent<EventTarget>

            Returns void

        • successCallback?:function
          • Parameters

            • event: ProgressEvent<EventTarget>
            • result: any

            Returns void

      Returns string | File | null

      Return value is Object URL or instance of File on success. Otherwise, it is null.

Effector: typeof Effector
EQUAL_TEMPERAMENT
Equalizer: typeof Equalizer
exitFullscreen: (() => Promise<void>)

Type declaration

    • (): Promise<void>
    • This class (static) method shows Document in original size from full screen.

      Returns Promise<void>

      Return value is instance of Promise.

fft: ((reals: Float32Array, imags: Float32Array, size: number) => void)

Type declaration

    • (reals, imags, size): void
    • This class (static) method executes FFT.

      Parameters

      • reals: Float32Array

        This argument is instance of Float32Array for real number.

      • imags: Float32Array

        This argument is instance of Float32Array for imaginary number.

      • size: number

        This argument is FFT size (power of two).

      Returns void

file: ((params: {
    event: FileEvent;
    type: "objectURL" | FileReaderType;
    errorCallback?(event: ProgressEvent<EventTarget>, textStatus: FileReaderErrorText): void;
    progressCallback?(event: ProgressEvent<EventTarget>): void;
    successCallback?(event: ProgressEvent<EventTarget>, result: any): void;
}) => string | File | null)

Type declaration

    • (params): string | File | null
    • This class (static) method gets instance of File.

      Parameters

      • params: {
            event: FileEvent;
            type: "objectURL" | FileReaderType;
            errorCallback?(event: ProgressEvent<EventTarget>, textStatus: FileReaderErrorText): void;
            progressCallback?(event: ProgressEvent<EventTarget>): void;
            successCallback?(event: ProgressEvent<EventTarget>, result: any): void;
        }
        • event: FileEvent
        • type: "objectURL" | FileReaderType
        • errorCallback?:function
        • progressCallback?:function
          • Parameters

            • event: ProgressEvent<EventTarget>

            Returns void

        • successCallback?:function
          • Parameters

            • event: ProgressEvent<EventTarget>
            • result: any

            Returns void

      Returns string | File | null

      Return value is Object URL or instance of File on success. Otherwise, it is null.

Filter: typeof Filter
Flanger: typeof Flanger
FREQUENCY_RATIO
Fuzz: typeof Fuzz
HALF_DOWN
HALF_UP
ifft: ((reals: Float32Array, imags: Float32Array, size: number) => void)

Type declaration

    • (reals, imags, size): void
    • This class (static) method executes IFFT.

      Parameters

      • reals: Float32Array

        This argument is instance of Float32Array for real number.

      • imags: Float32Array

        This argument is instance of Float32Array for imaginary number.

      • size: number

        This argument is IFFT size (power of two).

      Returns void

isPitchChar: ((pitchChar: string) => pitchChar is PitchChar)

Type declaration

    • (pitchChar): pitchChar is PitchChar
    • This predicate method determine whether is PitchChar type.

      Parameters

      • pitchChar: string

        This argument is any string.

      Returns pitchChar is PitchChar

Listener: typeof Listener
MIN_A
NoiseGate: typeof NoiseGate
NoiseSuppressor: typeof NoiseSuppressor
OverDrive: typeof OverDrive
Panner: typeof Panner
Phaser: typeof Phaser
PitchShifter: typeof PitchShifter
Preamp: typeof Preamp
QUARTER_NOT
read: ((params: {
    file: File;
    type: FileReaderType;
    errorCallback?(event: ProgressEvent<EventTarget>, textStatus: FileReaderErrorText): void;
    progressCallback?(event: ProgressEvent<EventTarget>): void;
    successCallback?(event: ProgressEvent<EventTarget>, result: any): void;
}) => void)

Type declaration

    • (params): void
    • This class (static) method reads file.

      Parameters

      • params: {
            file: File;
            type: FileReaderType;
            errorCallback?(event: ProgressEvent<EventTarget>, textStatus: FileReaderErrorText): void;
            progressCallback?(event: ProgressEvent<EventTarget>): void;
            successCallback?(event: ProgressEvent<EventTarget>, result: any): void;
        }
        • file: File
        • type: FileReaderType
        • errorCallback?:function
        • progressCallback?:function
          • Parameters

            • event: ProgressEvent<EventTarget>

            Returns void

        • successCallback?:function
          • Parameters

            • event: ProgressEvent<EventTarget>
            • result: any

            Returns void

      Returns void

Recorder: typeof Recorder
requestFullscreen: ((element: Element) => Promise<void>)

Type declaration

    • (element): Promise<void>
    • This class (static) method shows designated Element in full screen.

      Parameters

      • element: Element

        This argument is instance of Element that is target of full screen.

      Returns Promise<void>

      Return value is instance of Promise.

Reverb: typeof Reverb
Ringmodulator: typeof Ringmodulator
SAMPLE_RATE: number

Class (Static) properties

Stereo: typeof Stereo
toFrequencies: ((indexes: number[]) => number[])

Type declaration

    • (indexes): number[]
    • This class (static) method calculates frequency from index that corresponds to 12 equal temperament.

      Parameters

      • indexes: number[]

        This argument is array that contains index that corresponds to 12 equal temperament. For example, this value is between 0 and 88 in case of piano.

      Returns number[]

      Return value is array that contains frequency.

toTextFile: ((text: string, asObjectURL: boolean) => string)

Type declaration

    • (text, asObjectURL): string
    • This class (static) method creates text file.

      Parameters

      • text: string

        This argument is string.

      • asObjectURL: boolean

        This argument is true in case of getting text file as Object URL.

      Returns string

      Return value is text file as Data URL or Object URL.

Tremolo: typeof Tremolo
VocalCanceler: typeof VocalCanceler
Wah: typeof Wah

Methods

  • This class (static) method releases memory of unused instances.

    Parameters

    • unusedSources: Source[]

      This argument is array that contains unused instance of Source.

    Returns void

  • This class (static) method gets instance of AudioContext.

    Returns AudioContext

  • This class (static) method gets elapsed time from creating instance of AudioContext.

    Returns number

  • This method deletes XSound function as global object.

    Parameters

    • deep: boolean

      This argument selects whether deleting both of global objects. If this value is true, both of global objects are deleted.

    Returns typeof XSound

  • This class (static) method returns Promise that waits instantiating AudioWorkletProcessors.

    Returns Promise<Error | {
        [sourceName: string]: Source | null;
    }>

    Return value is Promise.

  • This class (static) method changes AudioContextState to 'running'. Initial state is 'suspended' by Autoplay Policy. Therefore, this method must be invoked by user gestures.

    Returns Promise<void>

    Return value is Promise.