Skip to main content

python-peass: Perceptual Evaluation methods for Audio Source Separation

Project description

python-peass

Test Suite PyPI version

This project was ported by Gemini 3.5 Flash from https://gitlab.inria.fr/bass-db/peass/-/tree/22c7fc4ef670f8bb6eea9ab4abea98323006b769/v2.0.1

An elegant, Pythonic, and fully-typed port of the PEASS v2.0.1 (Perceptual Evaluation methods for Audio Source Separation) toolkit [1].

This library replaces traditional energy ratios (SDR, SIR, SAR) with perceptually motivated objective scores— OPS, TPS, IPS, and APS—which are highly correlated with human evaluations [1].

Scientific Highlights

Traditional metrics evaluate separations via energy ratios [1]. However, human hearing relies heavily on non-linear auditory transduction and masking [2]. python-peass executes a multi-stage cognitive pipeline to assess quality:

  1. Subband Least-Squares Decomposition: Signals are divided into subbands using a complex-valued Hohmann Gammatone Filterbank [1, 3]. Overlapping temporal frames are projected onto estimated subspaces to isolate physical distortion artifacts [1].
  2. Inner Hair Cell Transduction: Approximates the shearing limits of physical hair bundles via half-wave rectification and 1 kHz membrane-limit lowpass filters [1, 2].
  3. Auditory Nerve Adaptation: Uses five stages of non-linear feedback loops modeling forward masking and metabolic neural depletion [2].
  4. Perceptual Assimilation: Models cognitive masking where noise below a target threshold is partially assimilated or masked [2].
  5. Score Prediction: Feeds weighted similarity percentiles into a multi-criteria trained sigmoidal neural network to output scores from 0 to 100 [1].

Architectural Layout & MATLAB Mapping

Unlike loose research scripts, this package organizes functions into explicit scientific modules:

Python Module Primary Classes / Functions Replaced MATLAB / C Files
peass.gammatone GammatoneFilter, GammatoneAnalyzer, GammatoneDelay, GammatoneMixer, GammatoneSynthesizer Gfb_Filter_new.m, Gfb_Analyzer_process.m, etc.
peass.auditory_model haircell_transduction, adaptation_loops, generate_internal_representation haircell.c (MEX), adapt.c (MEX), pemo_internal.m
peass.decomposition extract_distortion_components, least_squares_decompose_time_varying extractDistortionComponents.m, LSDecompose_tv.m
peass.metrics pemo_similarity_metric, calculate_energy_ratios, audio_quality_features pemo_metric.m, audioQualityFeatures.m
peass.predictor predict_peass_scores, my_mapping PEASS_ObjectiveMeasure.m, map2SubjScale.m

Installation

pip install python-peass

Quick Start Examples

1. Perceptual Quality Score Evaluation (Predictor Pipeline)

Evaluate estimated audio files saved on disk:

from peass import predict_peass_scores

original_files = [
    "audio/target_source.wav",
    "audio/interference_1.wav",
    "audio/interference_2.wav"
]
estimate_file = "audio/estimated_target.wav"

scores = predict_peass_scores(original_files, estimate_file)

print(f"Overall Perceptual Score (OPS): {scores['OPS']:.1f}/100")
print(f"Target Preservation Score (TPS): {scores['TPS']:.1f}/100")
print(f"Interference Rejection (IPS):   {scores['IPS']:.1f}/100")
print(f"Artifact-free Score (APS):      {scores['APS']:.1f}/100")

2. Exposing Physical Decompositions and Wav Files

If you wish to obtain the actual separated signal waveforms (True target, Target distortion, Interference, and Artifacts) alongside the predicted scores:

from peass import predict_peass_scores

original_files = ["audio/target.wav", "audio/noise.wav"]
estimate_file = "audio/estimate.wav"

# Setting return_decomposition=True triggers wave synthesis
results = predict_peass_scores(
    original_files,
    estimate_file,
    options={'destDir': './output_directory/'},
    return_decomposition=True
)

# 1. Print Scores
print(f"Overall Perceptual Score: {results['OPS']}")

# 2. Access Filepaths of newly generated wave files on disk
print(f"Decomposed Target saved at: {results['decomposition_files']['true_target']}")

# 3. Read raw numpy arrays directly from memory
target_distortion_array = results['decomposition_arrays']['target_distortion']

3. Running Independent Physical Decomposition (No ML Score Regressor)

You can also run the auditory Gammatone/least-squares decomposition engine by itself to generate isolated WAV files or raw NumPy arrays:

from peass import extract_distortion_components

# In-memory arrays
target_array = np.random.randn(16000, 1)
noise_array = np.random.randn(16000, 1)
estimate_array = target_array + 0.05 * noise_array

# Run subband least-squares decomposer
_, decomposed_arrays = extract_distortion_components(
    src_files=[target_array, noise_array],
    est_file=estimate_array,
    sampling_frequency=16000.0
)

true_target, target_distortion, interference, artifacts = decomposed_arrays

References

  1. V. Emiya, E. Vincent, N. Harlander, and V. Hohmann, "Subjective and objective quality assessment of audio source separation", IEEE Transactions on Audio, Speech, and Language Processing, 19(7):2046–2057, 2011.
  2. R. Huber and B. Kollmeier, "PEMO-Q — A New Method for Objective Audio Quality Assessment Using a Model of Auditory Perception", IEEE Transactions on Audio, Speech, and Language Processing, 14(6):1902–1911, 2006.
  3. V. Hohmann, "Frequency analysis and synthesis using a Gammatone filterbank", Acustica/Acta Acustica, 88(3):433–442, 2002.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_peass-2.0.1.1.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_peass-2.0.1.1-py3-none-any.whl (33.8 kB view details)

Uploaded Python 3

File details

Details for the file python_peass-2.0.1.1.tar.gz.

File metadata

  • Download URL: python_peass-2.0.1.1.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for python_peass-2.0.1.1.tar.gz
Algorithm Hash digest
SHA256 a858fc4c11f3d86e8e014781325070f16561ca4e4ce8b8c50d7271390656fdf1
MD5 6949e2b087a4293f5ec248f04ec0c6df
BLAKE2b-256 088e58c6488445983d2ad577d12eec7a0fc92a70c0297b517fdb74d2c52647bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_peass-2.0.1.1.tar.gz:

Publisher: ci.yml on averykhoo/python-peass

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file python_peass-2.0.1.1-py3-none-any.whl.

File metadata

  • Download URL: python_peass-2.0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 33.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for python_peass-2.0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dd992d70517a0fc4288875fe5f50d01e240c75557cc5be94cc5f146b0cb2d457
MD5 043c576a8c261b8d185ef771e44296e6
BLAKE2b-256 a0ffd2497ed44e971be6e7938e065b350e3f9ce1d9d1b1f7c8bbfbba3cc3bc01

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_peass-2.0.1.1-py3-none-any.whl:

Publisher: ci.yml on averykhoo/python-peass

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page