CLI and library to compute the Mel-Cepstral Distance of two WAV files based on the paper 'Mel-Cepstral Distance Measure for Objective Speech Quality Assessment' by Robert F. Kubichek.
Project description
Mel-Cepstral Distance
CLI and library to compute the mel-cepstral distance of two WAV files based on the paper "Mel-Cepstral Distance Measure for Objective Speech Quality Assessment" by Robert F. Kubichek.
Installation
pip install mel-cepstral-distance --user
Usage as CLI
mcd-cli
Example
# Download two example audio files
wget https://github.com/jasminsternkopf/mel_cepstral_distance/raw/main/examples/similar_audios/original.wav
wget https://github.com/jasminsternkopf/mel_cepstral_distance/raw/main/examples/similar_audios/inferred.wav
# Calculate metrics
mcd-cli from-wav original.wav inferred.wav
Output:
Mel-Cepstral Distance: 19.013673608495836
Penalty: 0.11946050096339111
# Frames: 519
This will print a message informing you about the mel-cepstral distance and penalty between the audios whose paths were given as arguments and the number of frames that were used in the computation.
Usage as a library
from mel_cepstral_distance import get_metrics_wavs, get_metrics_mels, get_metrics_mels_pairwise
Main methods
get_metrics_wavs
get_metrics_mels
Both methods return the mel-cepstral distance, the penalty and the final frame number. Examples and information on the parameters can be found in the corresponding documentations.
Development setup
# update
sudo apt update
# install Python 3.8-3.11 for ensuring that tests can be run
sudo apt install python3-pip \
python3.8 python3.8-dev python3.8-distutils python3.8-venv \
python3.9 python3.9-dev python3.9-distutils python3.9-venv \
python3.10 python3.10-dev python3.10-distutils python3.10-venv \
python3.11 python3.11-dev python3.11-distutils python3.11-venv
# install pipenv for creation of virtual environments
python3.8 -m pip install pipenv --user
# check out repo
git clone https://github.com/jasminsternkopf/mel_cepstral_distance.git
cd mel_cepstral_distance
# create virtual environment
python3.8 -m pipenv install --dev
Running the tests
# first, install the tool (see "Development setup")
# then, navigate into the directory of the repo
cd mel_cepstral_distance
# activate environment
python3.8 -m pipenv shell
# run tests
tox
License
MIT License
References
- Kubichek, R. “Mel-Cepstral Distance Measure for Objective Speech Quality Assessment.” In Proceedings of IEEE Pacific Rim Conference on Communications Computers and Signal Processing, 1:125–28. Victoria, BC, Canada: IEEE, 1993. https://doi.org/10.1109/PACRIM.1993.407206.
- Muda, Lindasalwa, Mumtaj Begam, and I. Elamvazuthi. “Voice Recognition Algorithms Using Mel Frequency Cepstral Coefficient (MFCC) and Dynamic Time Warping (DTW) Techniques.” Journal of Computing vol. 2, no. 3 (March 2010): 6.
Acknowledgments
Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) – Project-ID 416228727 – CRC 1410
Citation
If you want to cite this repo, you can use the BibTeX-entry generated by GitHub (see About => Cite this repository).
Sternkopf, J., & Taubert, S. (2024). mel-cepstral-distance (Version 0.0.3) [Computer software]. https://doi.org/10.5281/zenodo.10567255
FAQ
How were the default parameters set?
We based some of the parameters on the two mentioned references and set the other ones by ourselves depending on the parameter description of the underlying libraries:
hop-length
-> 256: Kubichek & Muda et al.window
-> hamming: Muda et al.n-mels
-> 20: Kubichek- Battenberg et al. (2019) computed the first 13 MFCCs
n-mfcc
-> 16: by usn-fft
-> 1024: by uscenter
-> False: by ushtk
-> False: by usnorm
-> None: by usdtw
-> True: by us- calculate the MCD-DTW, which is used as metric in works like:
Why is Python 3.12 not supported?
The dependency numba
is currently not available for Python 3.12.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mel-cepstral-distance-0.0.3.tar.gz
.
File metadata
- Download URL: mel-cepstral-distance-0.0.3.tar.gz
- Upload date:
- Size: 1.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eae9b24fa24f13558d51f3eea1865b8ccfd47e3e8894c702464515de1405e72f |
|
MD5 | 57c0f8950466f2711ad998027d28e312 |
|
BLAKE2b-256 | 8b10d977a96531e3e7384b3d3ae661d410782daf94eb252d076265c90a574d05 |
File details
Details for the file mel_cepstral_distance-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: mel_cepstral_distance-0.0.3-py3-none-any.whl
- Upload date:
- Size: 20.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec383a4f713abe96d20a1d5b316b1c04cd92611dcdc7b5b368349cb5dc5f89d9 |
|
MD5 | e7dce15e813dade34c04856379001920 |
|
BLAKE2b-256 | 4709ed5d3917346e3345b76a69ec6ddc699d5e254673f8c2d0701cd9c2915d89 |