Function XSound

  • This function gets instance of Source. This functions is overloaded for type interface and type check.

    Parameters

    • sourceName: "oscillator"

      This argument selects instance for sound source.

    Returns OscillatorModule

  • This function gets instance of Source. This functions is overloaded for type interface and type check.

    Parameters

    • sourceName: "oneshot"

      This argument selects instance for sound source.

    Returns OneshotModule

  • This function gets instance of Source. This functions is overloaded for type interface and type check.

    Parameters

    • sourceName: "noise"

      This argument selects instance for sound source.

    Returns NoiseModule

  • This function gets instance of Source. This functions is overloaded for type interface and type check.

    Parameters

    • sourceName: "audio"

      This argument selects instance for sound source.

    Returns AudioModule

  • This function gets instance of Source. This functions is overloaded for type interface and type check.

    Parameters

    • sourceName: "media"

      This argument selects instance for sound source.

    Returns MediaModule

  • This function gets instance of Source. This functions is overloaded for type interface and type check.

    Parameters

    • sourceName: "stream"

      This argument selects instance for sound source.

    Returns StreamModule

  • This function gets instance of Source. This functions is overloaded for type interface and type check.

    Parameters

    • sourceName: "processor"

      This argument selects instance for sound source.

    Returns ProcessorModule

  • This function gets instance of Source. This functions is overloaded for type interface and type check.

    Parameters

    • sourceName: "mixer"

      This argument selects instance for sound source.

    Returns MixerModule

  • This function gets instance of Source. This functions is overloaded for type interface and type check.

    Parameters

    • sourceName: "midi"

      This argument selects instance for sound source.

    Returns MIDI

  • This function gets instance of Source. This functions is overloaded for type interface and type check.

    Parameters

    • sourceName: "mml"

      This argument selects instance for sound source.

    Returns MML

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: {
              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
    • 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;
        }

      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): 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: number, pitchChar: 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: number, detune: number): 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: number): 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: AudioContext,
          arraybuffer: ArrayBuffer,
          successCallback?: (buffer: AudioBuffer) => void,
          errorCallback?: (error: Error) => void,
      ): 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.

      • OptionalerrorCallback: (error: Error) => void

        This argument is invoked on failure.

      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: {
              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
    • 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;
        }

      Returns string | File | null

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

Effector: typeof Effector
EQUAL_TEMPERAMENT: 12
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<ArrayBufferLike>,
    imags: Float32Array<ArrayBufferLike>,
    size: number,
) => void

Type declaration

    • (
          reals: Float32Array<ArrayBufferLike>,
          imags: Float32Array<ArrayBufferLike>,
          size: number,
      ): void
    • This class (static) method executes FFT.

      Parameters

      • reals: Float32Array<ArrayBufferLike>

        This argument is instance of Float32Array for real number.

      • imags: Float32Array<ArrayBufferLike>

        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: {
              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
    • 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;
        }

      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: 1.0594630943592953
Fuzz: typeof Fuzz
HALF_DOWN: "-"
HALF_UP: "+"
ifft: (
    reals: Float32Array<ArrayBufferLike>,
    imags: Float32Array<ArrayBufferLike>,
    size: number,
) => void

Type declaration

    • (
          reals: Float32Array<ArrayBufferLike>,
          imags: Float32Array<ArrayBufferLike>,
          size: number,
      ): void
    • This class (static) method executes IFFT.

      Parameters

      • reals: Float32Array<ArrayBufferLike>

        This argument is instance of Float32Array for real number.

      • imags: Float32Array<ArrayBufferLike>

        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: string): 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: 27.5
NoiseGate: typeof NoiseGate
NoiseSuppressor: typeof NoiseSuppressor
OverDrive: typeof OverDrive
Panner: typeof Panner
Phaser: typeof Phaser
PitchShifter: typeof PitchShifter
Preamp: typeof Preamp
QUARTER_NOT: 4
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: {
              file: File;
              type: FileReaderType;
              errorCallback(
                  event: ProgressEvent<EventTarget>,
                  textStatus: FileReaderErrorText,
              ): void;
              progressCallback(event: ProgressEvent<EventTarget>): void;
              successCallback(event: ProgressEvent<EventTarget>, result: any): void;
          },
      ): 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;
        }

      Returns void

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

Type declaration

    • (element: 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[]): 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: string, asObjectURL: boolean): 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]: null | Source }>

    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.