Get Started
Create a sample signal or read one from your database. Here, we create a constant signal of 1000 with length 1000 and add random white noise. For the distorted signal, we add again random white noise to the reference signal.
import numpy as np
sample_reference_signal = np.ones(1000) * 1000 + np.random.randn(1000)
sample_distorted_signal = sample_reference_signal + np.random.randn(1000)
Calculate SNR
Calculate the SNR from the signals defined above.
from vibromaf.metrics.snr import snr
snr_score = snr(sample_distorted_signal, sample_reference_signal)
print(snr_score) # Should be around 60dB
Find further details how to use this metric at SNR.
Calculate ST-SIM
Calculate the ST-SIM from the signals defined above.
from vibromaf.metrics.stsim import st_sim
st_sim_score = st_sim(sample_distorted_signal, sample_reference_signal)
print(st_sim_score) # Should be around 0.81
Find further details how to use this metric at ST-SIM.
Calculate SPQI
Calculate the SPQI from the signals defined above.
from vibromaf.metrics.spqi import spqi
spqi_score = spqi(sample_distorted_signal, sample_reference_signal)
print(spqi_score) # Should be around 0.43
Find further details how to use this metric at SPQI.
Full Example
Find the full example in examples/white_noise.py
.
All examples available can be found in the examples
folder.