Python implementation of the 2f-model for estimating subjective quality of separated audio signals
Project description
Seabass - Python Implementation of the 2f Model
Seabass is a Python implementation of the 2f-model developed by the Internaltional Audio Laboratories Erlangen. It is a model for estimating subjective quality of separated audio source signals, specifically the mean MUSHRA score. The part of this code, particularly the computation of the Model Output Variables are based on the MATLAB implementation, PQEvalAudio, by Peter Kabal. See here for more details about the 2f-model.
Installation
git clone this-repository
cd 2f-model
pip install -e .
Usage
The computation of MOVs requires that the audio signal are scaled to have amplitudes in the range
[-32768, 32767]. By default,seabasshandles this automatically when using the CLI mode orestimate_mean_mushra_score_file, but not always when usingestimate_mean_mushra_score.When reading from files,
soundfilereads the header and normalize it to floating point in the range [-1, 1).seabassthen scales them up by32768.
CLI
seabass --test-path /path/to/test-file.wav \
--ref-path /path/to/reference-file.wav \
--output-path /path/to/output.json
Python
Evaluating directly from files
from seabass.core.models.mms import estimate_mean_mushra_score_file
mms = estimate_mean_mushra_score_file(test_path, ref_path)
print(f"Estimated MMS: {mms:3.2f}")
Evaluating from loaded signals
When using loaded audio, make sure that your audio signals are either
- in the range
[-32768, 32767]and pass the argumentsignal_dtype='int16'to the function, or- in the range
[-1, 1)and pass the argumentsignal_dtype='double'to the function.If your audio signals are in the range
[-1, 1), they will be multiplied by32768to scale them to[-32768, 32768). If this is not what you want, you can scale them yourself before passing them to the function withsignal_dtype='int16'.
import soundfile as sf
from seabass.core.models.mms import estimate_mean_mushra_score
ref_signal, fs_r = sf.read(ref_path, always_2d=True)
test_signal, fs_t = sf.read(test_path, always_2d=True)
# soundfile returns (n_samples, n_channels) but seabass expectes (n_channels, n_samples)
ref_signal = ref_signal.T
test_signal = test_signal.T
assert fs_r == fs_t == 48000
# PEAQ only works with 48 kHz signals
# if your signals are not 48 kHz, resample them
mms = estimate_mean_mushra_score(test_signal, ref_signal)
print(f"Estimated MMS: {mms:3.2f}")
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file seabass_2f-0.1.0.tar.gz.
File metadata
- Download URL: seabass_2f-0.1.0.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
496c9c0637baddde0f3c27bec3e1055db15285ef49d8e9679c289e3e90d321bd
|
|
| MD5 |
9df5e38fd11cdc58ef2b9a7307b5052c
|
|
| BLAKE2b-256 |
6b25249dbf6486d1305b4f0a5f6bd0d98bcd4f5b16b99eca1d71b0ed706d3d17
|
Provenance
The following attestation bundles were made for seabass_2f-0.1.0.tar.gz:
Publisher:
pypi-publish.yml on kwatcharasupat/2f-model
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
seabass_2f-0.1.0.tar.gz -
Subject digest:
496c9c0637baddde0f3c27bec3e1055db15285ef49d8e9679c289e3e90d321bd - Sigstore transparency entry: 1525338665
- Sigstore integration time:
-
Permalink:
kwatcharasupat/2f-model@1d9b394eb1cd3c16988601aa7deb8db36a70fcfa -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/kwatcharasupat
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@1d9b394eb1cd3c16988601aa7deb8db36a70fcfa -
Trigger Event:
release
-
Statement type:
File details
Details for the file seabass_2f-0.1.0-py3-none-any.whl.
File metadata
- Download URL: seabass_2f-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8771c38c0ec684f36ec1dba1763a748ae57d5e258b7e8511676d01d5bc075aec
|
|
| MD5 |
897c859a10c5e4a76ff256fd648d97cb
|
|
| BLAKE2b-256 |
5052fe79add9db11092e9370329ce0eb2ce789589610025f32c633fd3dda072f
|
Provenance
The following attestation bundles were made for seabass_2f-0.1.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on kwatcharasupat/2f-model
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
seabass_2f-0.1.0-py3-none-any.whl -
Subject digest:
8771c38c0ec684f36ec1dba1763a748ae57d5e258b7e8511676d01d5bc075aec - Sigstore transparency entry: 1525338693
- Sigstore integration time:
-
Permalink:
kwatcharasupat/2f-model@1d9b394eb1cd3c16988601aa7deb8db36a70fcfa -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/kwatcharasupat
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@1d9b394eb1cd3c16988601aa7deb8db36a70fcfa -
Trigger Event:
release
-
Statement type: