Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "core/audio_utils"

Index

Functions

applyWindow

  • applyWindow(buffer: Float32Array, win: Float32Array): Float32Array

frame

  • frame(data: Float32Array, frameLength: number, hopLength: number): Float32Array[]
  • Given a timeseries, returns an array of timeseries that are windowed according to the params specified.

    Parameters

    • data: Float32Array
    • frameLength: number
    • hopLength: number

    Returns Float32Array[]

hannWindow

  • hannWindow(length: number): Float32Array

hzToMidi

  • hzToMidi(frequencies: number[]): Promise<number[]>

loadAudioFromFile

  • loadAudioFromFile(blob: Blob): Promise<AudioBuffer>
  • Loads audio into AudioBuffer from a Blob to transcribe.

    By default, audio is loaded at 16kHz monophonic for compatibility with model. In Safari, audio must be loaded at 44.1kHz instead.

    Parameters

    • blob: Blob

    Returns Promise<AudioBuffer>

    The loaded audio in an AudioBuffer.

loadAudioFromUrl

  • loadAudioFromUrl(url: string): Promise<AudioBuffer>
  • Loads audio into AudioBuffer from a URL to transcribe.

    By default, audio is loaded at 16kHz monophonic for compatibility with model. In Safari, audio must be loaded at 44.1kHz instead.

    Parameters

    • url: string

      A path to a audio file to load.

    Returns Promise<AudioBuffer>

    The loaded audio in an AudioBuffer.

melSpectrogram

  • melSpectrogram(y: Float32Array, params: SpecParams): Float32Array[]

midiToHz

  • midiToHz(notes: number): Tensor<Rank>

padCenterToLength

  • padCenterToLength(data: Float32Array, length: number): Float32Array

padConstant

  • padConstant(data: Float32Array, padding: number | number[]): Float32Array

powerToDb

  • powerToDb(spec: Float32Array[], amin?: number, topDb?: number): Float32Array[]
  • Convert a power spectrogram (amplitude squared) to decibel (dB) units

    Intended to match librosa.core.power_to_db

    Parameters

    • spec: Float32Array[]

      Input power.

    • Default value amin: number = 1e-10

      Minimum threshold for abs(S).

    • Default value topDb: number = 80

      Threshold the output at topDb below the peak.

    Returns Float32Array[]

resampleAndMakeMono

  • resampleAndMakeMono(audioBuffer: AudioBuffer, targetSr?: number): Promise<Float32Array>
  • Parameters

    • audioBuffer: AudioBuffer
    • Default value targetSr: number = SAMPLE_RATE

    Returns Promise<Float32Array>

Generated using TypeDoc