object AudioUtils
- Alphabetic
- By Inheritance
- AudioUtils
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
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:
- The input waveform is split into frames of size
frameLength
that are partially overlapping byframeLength - hopLength
samples. - Each frame is multiplied by the window.
- The DFT is taken of each windowed frame.
- 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
- The input waveform is split into frames of size
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
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
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def matrixToFloatArray(matrix: DenseMatrix[Double]): Array[Array[Float]]
-
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
-
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
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
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
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()