Packages

object AudioUtils

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AudioUtils
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def calculateSpectrogram(waveform: DenseVector[Double], window: DenseVector[Double], frameLength: Int, hopLength: Int, melFilters: DenseMatrix[Double], power: Double, center: Boolean = true, onesided: Boolean = true, melFloor: Double = 1e-10): DenseMatrix[Double]

    Calculates a spectrogram over one waveform using the Short-Time Fourier Transform.

    Calculates a spectrogram over one waveform using the Short-Time Fourier Transform.

    We assume that the waveform has been zero padded beforehand. Currently, this method only supports the mel spectrogram. It uses the breeze implementation of the fourier transform.

    Adapted from huggingface transformer.

    How this works:

    1. The input waveform is split into frames of size frameLength that are partially overlapping by frameLength - hopLength samples.
    2. Each frame is multiplied by the window.
    3. The DFT is taken of each windowed frame.
    4. The resulting rows of the spectrogram are stacked to form the final matrix.
    waveform

    The input waveform to process

    window

    The window to use for each frame

    frameLength

    Length of each frame

    hopLength

    Length to advance in the waveform for each overlapping step

    melFilters

    The mel filters to apply

    power

    Exponent to scale the spectrogram

    center

    Whether to center the waveform and pad reflectively

    onesided

    Whether to only return the positive DFT

    melFloor

    Lowest value to apply for the mel spectrogram

    returns

    Log Mel Spectrogram of the waveform

  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def hertzToMel(freq: Double): Double

    Converts Hertz to Mels.

    Converts Hertz to Mels.

    Uses method proposed by Slaney 1998, adapted from huggingface transformer.

    freq

    Frequency in Hertz

    returns

    Frequency in Mels

  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def matrixToFloatArray(matrix: DenseMatrix[Double]): Array[Array[Float]]
  15. def melFilterBank(numFrequencyBins: Int, numMelFilters: Int, minFrequency: Double, maxFrequency: Double, samplingRate: Int): DenseMatrix[Double]

    Creates a matrix to convert a spectrogram to the mel scale.

    Creates a matrix to convert a spectrogram to the mel scale.

    Currently only the filter bank from the Auditory Toolbox for MATLAB (Slaney 1998) is supported.

    Adapted from huggingface transformer.

    numFrequencyBins

    Number of the frequency bins after used for fourier transform

    numMelFilters

    Number of mel filters to generate

    minFrequency

    Lowest frequency in Hz

    maxFrequency

    Highest frequency in Hz

    samplingRate

    Sample rate of the audio

  16. def melToHertz(mels: Double): Double

    Converts Hertz to Mels.

    Converts Hertz to Mels.

    Uses method proposed by Slaney 1998, adapted from huggingface transformer.

    mels

    Frequency in Mels

    returns

    Frequency in Hertz

  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. def padReflective(vector: DenseVector[Double], padding: (Int, Int)): DenseVector[Double]

    Pads a vector with the reflection of the vector.

    Pads a vector with the reflection of the vector. It is mirrored on the first and last values of it along each axis.

    This method is adapted from numpy. However, reflections larger than the initial vector are currently not supported.

    vector

    Vector to be padded

    padding

    Padding for the left and right side

    returns

    Vector of size padding._1 + vector.length + padding._2

  21. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  22. def toString(): String
    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped