View Source NxAudio.Visualizations.Spectrogram (nx_audio v0.2.0)
Provides a binned heatmap visualization for Nx-based Spectrograms.
Each Spectrogram index [t, m or f]
or [c, t, m or f]
is treated as numeric data:
- "x_idx" = t
- "y_idx" = m (representing MEL frequency bands) or f (representing linear frequency bands)
Note: This module requires the vega_lite
package to be installed.
Add {:vega_lite, "~> 0.1"}
to your dependencies.
Summary
Functions
Plots a binned Spectrogram heatmap. The tensor can be
Functions
@spec plot!(Nx.Type.t(), NxAudio.Visualizations.SpectrogramConfig.t()) :: VegaLite.spec()
Plots a binned Spectrogram heatmap. The tensor can be:
[time, mel/frequency]
[channels, time, mel/frequency]
Example
spectrogram_tensor =
NxAudio.Transforms.MelSpectrogram.transform(
audio_tensor,
sample_rate: 16000,
n_fft: 512,
n_mels: 80
)
NxAudio.Visualizations.Spectrogram.plot!(
spectrogram_tensor,
title: "My MEL Spectrogram",
color_domain: [0, 300],
bin_maxbins: 50,
bin_maxbins: 40
)