calibrax.metrics.functional.audio¤
Audio quality metrics for evaluating signal reconstruction and synthesis. Includes spectral convergence, mel cepstral distortion, and signal-to-noise ratio -- all operating on JAX arrays.
Audio quality metrics -- FFT-based, pure math.
All metrics are pure mathematical operations on audio signal arrays. No pretrained models, no external audio processing libraries.
Includes: spectral_convergence, mel_cepstral_distortion, signal_to_noise_ratio.
Registered with domain="audio".
spectral_convergence(predictions: Any, targets: Any) -> Any
¤
Spectral convergence between predicted and target signals.
Computes ||STFT(targets) - STFT(predictions)||_F / ||STFT(targets)||_F.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
predictions
|
Any
|
Predicted signal array, shape (n,). |
required |
targets
|
Any
|
Target signal array, shape (n,). |
required |
Returns:
| Type | Description |
|---|---|
Any
|
Spectral convergence ratio. Lower is better. 0.0 = identical spectra. |
Examples:
mel_cepstral_distortion(predictions: Any, targets: Any, *, num_mels: int = 80) -> Any
¤
Mel Cepstral Distortion between two signals.
Computes (10/ln(10)) * sqrt(2 * sum((c_pred - c_tgt)^2)) on cepstral coefficients derived from the signal spectra.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
predictions
|
Any
|
Predicted signal array, shape (n,). |
required |
targets
|
Any
|
Target signal array, shape (n,). |
required |
num_mels
|
int
|
Number of mel-frequency coefficients to use. |
80
|
Returns:
| Type | Description |
|---|---|
Any
|
MCD value in dB. Lower is better. 0.0 = identical signals. |
Examples:
signal_to_noise_ratio(signal: Any, noise: Any) -> Any
¤
Signal-to-Noise Ratio in dB.
SNR = 10 * log10(|signal|^2 / |noise|^2).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signal
|
Any
|
Clean signal array. |
required |
noise
|
Any
|
Noise signal array (same shape as signal). |
required |
Returns:
| Type | Description |
|---|---|
Any
|
SNR value in dB. Higher is better. |
Examples: