-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
288 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
"""Example to evaluate WAV files""" | ||
|
||
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, FileType | ||
|
||
from scipy.io import wavfile | ||
|
||
from vibromaf.metrics.snr import snr | ||
from vibromaf.metrics.spqi import spqi | ||
from vibromaf.metrics.stsim import st_sim | ||
|
||
|
||
def parse_arguments(): | ||
"""Parse command line arguments""" | ||
parser = ArgumentParser( | ||
description=__doc__, | ||
formatter_class=ArgumentDefaultsHelpFormatter, | ||
) | ||
parser.add_argument( | ||
"distorted", | ||
type=FileType("r"), | ||
help="Distorted .wav file", | ||
) | ||
parser.add_argument( | ||
"reference", | ||
type=FileType("r"), | ||
help="Undistorted reference .wav file", | ||
) | ||
return parser.parse_args() | ||
|
||
|
||
def main(): | ||
"""main""" | ||
args = parse_arguments() | ||
|
||
distorted_signal = wavfile.read(args.distorted.name)[1] | ||
reference_signal = wavfile.read(args.reference.name)[1] | ||
|
||
# Calculate metric scores | ||
snr_score = snr(distorted_signal, reference_signal) | ||
st_sim_score = st_sim(distorted_signal, reference_signal) | ||
spqi_score = spqi(distorted_signal, reference_signal) | ||
|
||
# Print individual metric scores | ||
print(f"SNR score: {snr_score}") | ||
print(f"ST-SIM score: {st_sim_score}") | ||
print(f"SPQI score: {spqi_score}") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"""Simple get started example with white noise signals""" | ||
|
||
import numpy as np | ||
|
||
from vibromaf.metrics.snr import snr | ||
from vibromaf.metrics.spqi import spqi | ||
from vibromaf.metrics.stsim import st_sim | ||
|
||
# Define sample signals | ||
sample_reference_signal = np.ones(1000) * 1000 + np.random.randn(1000) | ||
sample_distorted_signal = sample_reference_signal + np.random.randn(1000) | ||
|
||
# Calculate metric scores | ||
snr_score = snr(sample_distorted_signal, sample_reference_signal) | ||
st_sim_score = st_sim(sample_distorted_signal, sample_reference_signal) | ||
spqi_score = spqi(sample_distorted_signal, sample_reference_signal) | ||
|
||
# Print individual metric scores | ||
print(f"SNR score: {snr_score}") | ||
print(f"ST-SIM score: {st_sim_score}") | ||
print(f"SPQI score: {spqi_score}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.