python-peass 2.0.1.1__tar.gz → 2.0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,206 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-peass
3
+ Version: 2.0.1.2
4
+ Summary: python-peass: Perceptual Evaluation methods for Audio Source Separation
5
+ Author-email: Avery Khoo <avery.khoo@gmail.com>
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Science/Research
10
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
19
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
20
+ License-File: LICENSE
21
+ Requires-Dist: numpy >= 1.19.0
22
+ Requires-Dist: scipy >= 1.6.0
23
+ Requires-Dist: soundfile >= 0.10.0
24
+ Requires-Dist: numba >= 0.56.0 ; extra == "numba"
25
+ Project-URL: Homepage, https://github.com/averykhoo/python-peass
26
+ Project-URL: Source, https://github.com/averykhoo/python-peass
27
+ Project-URL: Tracker, https://github.com/averykhoo/python-peass/issues
28
+ Provides-Extra: numba
29
+
30
+ # python-peass
31
+
32
+ [![Test Suite](https://github.com/averykhoo/python-peass/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/averykhoo/python-peass/actions)
33
+ [![PyPI version](https://img.shields.io/pypi/v/python-peass.svg)](https://pypi.org/project/python-peass/)
34
+
35
+ > This project was ported by Gemini 3.5 Flash from
36
+ > https://gitlab.inria.fr/bass-db/peass/-/tree/22c7fc4ef670f8bb6eea9ab4abea98323006b769/v2.0.1
37
+
38
+ A Python port of the **PEASS v2.0.1** (Perceptual Evaluation methods for Audio Source Separation) toolkit [1].
39
+
40
+ This package replaces traditional energy ratio metrics (SDR, SIR, SAR) with perceptually motivated objective scores—
41
+ **OPS, TPS, IPS, and APS**—which align closely with subjective human listening evaluations [1].
42
+
43
+ ## Scientific Highlights
44
+
45
+ Traditional evaluation metrics rely purely on linear energy ratios [1].
46
+ However, human hearing relies on non-linear auditory transduction, temporal masking, and cognitive thresholds [2].
47
+ `python-peass` executes a multi-stage cognitive simulation pipeline to assess separation quality:
48
+
49
+ 1. **Subband Least-Squares Decomposition:**
50
+ Signals are divided into subbands using a complex-valued Hohmann Gammatone Filterbank [1, 3].
51
+ Overlapping temporal frames are projected onto estimated subspaces to isolate physical target distortion,
52
+ interference, and artifact components [1].
53
+ 2. **Inner Hair Cell Transduction:**
54
+ Approximates the shearing limits of physical hair bundles via half-wave rectification and first-order 1 kHz
55
+ membrane-limit lowpass filters [1, 2].
56
+ 3. **Auditory Nerve Adaptation:**
57
+ Models physiological forward masking and metabolic neural depletion via five cascaded stages of non-linear feedback
58
+ loops [2].
59
+ 4. **Perceptual Assimilation:**
60
+ Models cognitive threshold masking where noise below a target reference threshold is partially assimilated or
61
+ masked [2].
62
+ 5. **Score Prediction:**
63
+ Feeds weighted similarity percentiles into a multi-criteria trained sigmoidal neural network to output scores scaled
64
+ from `0` to `100` [1].
65
+
66
+ ## Installation
67
+
68
+ For standard execution, you can install the package directly:
69
+
70
+ ```bash
71
+ pip install "python-peass[numba]"
72
+ ```
73
+
74
+ If you require high-speed execution (using optimized vector libraries like Intel MKL or Apple Accelerate), it is recommended to install NumPy and SciPy via Conda first, and then install the package:
75
+
76
+ ```bash
77
+ conda install --update numpy scipy
78
+ pip install "python-peass[numba]"
79
+ ```
80
+
81
+ ## Quick Start Examples
82
+
83
+ ### 1. Perceptual Quality Score Evaluation
84
+
85
+ Evaluate estimated audio files saved on disk:
86
+
87
+ ```python
88
+ from peass import predict_perceptual_evaluation_scores
89
+
90
+ original_files = [
91
+ "audio/target_source.wav",
92
+ "audio/interference_1.wav",
93
+ "audio/interference_2.wav"
94
+ ]
95
+ estimate_file = "audio/estimated_target.wav"
96
+
97
+ scores = predict_perceptual_evaluation_scores(original_files, estimate_file)
98
+
99
+ print(f"Overall Perceptual Score (OPS): {scores.overall_perceptual_score:.1f}/100")
100
+ print(f"Target Preservation Score (TPS): {scores.target_perceptual_score:.1f}/100")
101
+ print(f"Interference Rejection (IPS): {scores.interference_perceptual_score:.1f}/100")
102
+ print(f"Artifact-free Score (APS): {scores.artifact_perceptual_score:.1f}/100")
103
+ ```
104
+
105
+ ### 2. Score Evaluation with Waveform and File Expositions
106
+
107
+ To run the full perceptual scoring pipeline and simultaneously output the physically separated WAV files (True target,
108
+ Target distortion, Interference, and Artifacts) to a specific output folder:
109
+
110
+ ```python
111
+ from peass import predict_perceptual_evaluation_scores, DecompositionConfiguration
112
+
113
+ original_files = [
114
+ "audio/target_source.wav",
115
+ "audio/interferer.wav"
116
+ ]
117
+ estimate_file = "audio/estimated_target.wav"
118
+
119
+ # 1. Configure the output directory for file-writing
120
+ config = DecompositionConfiguration(destination_directory="./output_directory/")
121
+
122
+ # 2. Set return_decomposition=True to expose the physical waveforms and file paths
123
+ scores = predict_perceptual_evaluation_scores(
124
+ original_files,
125
+ estimate_file,
126
+ configuration=config,
127
+ return_decomposition=True
128
+ )
129
+
130
+ # 3. Print overall scores
131
+ print(f"Overall Perceptual Score (OPS): {scores.overall_perceptual_score:.1f}/100")
132
+
133
+ # 4. Access the file paths of the generated WAV files on disk
134
+ print(f"True target file saved at: {scores.decomposition_files.true_target}")
135
+ print(f"Interference file saved at: {scores.decomposition_files.interference}")
136
+ print(f"Artifacts file saved at: {scores.decomposition_files.artifacts}")
137
+
138
+ # 5. Read the raw NumPy arrays directly from memory
139
+ target_distortion_array = scores.decomposition_waveforms.target_distortion
140
+ ```
141
+
142
+ ### 3. Independent Subband Least-Squares Decomposition
143
+
144
+ You can run the auditory Gammatone/least-squares decomposition engine independently to obtain the isolated physical
145
+ sub-components:
146
+
147
+ ```python
148
+ import numpy as np
149
+ from peass import decompose_distortion_components
150
+
151
+ # In-memory arrays
152
+ target_array = np.random.randn(16000, 1)
153
+ noise_array = np.random.randn(16000, 1)
154
+ estimate_array = target_array + 0.05 * noise_array
155
+
156
+ # Run subband least-squares decomposer
157
+ result = decompose_distortion_components(
158
+ source_files=[target_array, noise_array],
159
+ estimate_file=estimate_array,
160
+ sampling_frequency_hz=16000.0
161
+ )
162
+
163
+ waveforms = result.waveforms
164
+ true_target, target_distortion, interference, artifacts = (
165
+ waveforms.true_target,
166
+ waveforms.target_distortion,
167
+ waveforms.interference,
168
+ waveforms.artifacts
169
+ )
170
+ ```
171
+
172
+ ---
173
+
174
+ ## Test Suite & CI/CD
175
+
176
+ The validation suite implements rigorous numerical, physical, and integration checks.
177
+ You will need to `pip install -r requirements.txt` to set up.
178
+
179
+ ### Regression Verification
180
+
181
+ We test our output waveforms directly against the original `.wav` reference waveforms generated by the official MATLAB
182
+ PEASS toolbox (located in `references/peass_master_22c7fc4e/v2.0.1/example/`).
183
+ Python's outputs must achieve a cross-correlation coefficient exceeding $0.95$ with the MATLAB reference to pass.
184
+
185
+ ### Parallel Execution
186
+
187
+ To run the test suite across multiple CPU cores using `pytest-xdist`, execute:
188
+
189
+ ```bash
190
+ pytest -n auto
191
+ ```
192
+
193
+ ---
194
+
195
+ ## References
196
+
197
+ 1. **V. Emiya, E. Vincent, N. Harlander, and V. Hohmann**,
198
+ *"Subjective and objective quality assessment of audio source separation"*,
199
+ IEEE Transactions on Audio, Speech, and Language Processing, 19(7):2046–2057, 2011.
200
+ 2. **R. Huber and B. Kollmeier**,
201
+ *"PEMO-Q — A New Method for Objective Audio Quality Assessment Using a Model of Auditory Perception"*,
202
+ IEEE Transactions on Audio, Speech, and Language Processing, 14(6):1902–1911, 2006.
203
+ 3. **V. Hohmann**,
204
+ *"Frequency analysis and synthesis using a Gammatone filterbank"*,
205
+ Acustica/Acta Acustica, 88(3):433–442, 2002.
206
+
@@ -0,0 +1,176 @@
1
+ # python-peass
2
+
3
+ [![Test Suite](https://github.com/averykhoo/python-peass/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/averykhoo/python-peass/actions)
4
+ [![PyPI version](https://img.shields.io/pypi/v/python-peass.svg)](https://pypi.org/project/python-peass/)
5
+
6
+ > This project was ported by Gemini 3.5 Flash from
7
+ > https://gitlab.inria.fr/bass-db/peass/-/tree/22c7fc4ef670f8bb6eea9ab4abea98323006b769/v2.0.1
8
+
9
+ A Python port of the **PEASS v2.0.1** (Perceptual Evaluation methods for Audio Source Separation) toolkit [1].
10
+
11
+ This package replaces traditional energy ratio metrics (SDR, SIR, SAR) with perceptually motivated objective scores—
12
+ **OPS, TPS, IPS, and APS**—which align closely with subjective human listening evaluations [1].
13
+
14
+ ## Scientific Highlights
15
+
16
+ Traditional evaluation metrics rely purely on linear energy ratios [1].
17
+ However, human hearing relies on non-linear auditory transduction, temporal masking, and cognitive thresholds [2].
18
+ `python-peass` executes a multi-stage cognitive simulation pipeline to assess separation quality:
19
+
20
+ 1. **Subband Least-Squares Decomposition:**
21
+ Signals are divided into subbands using a complex-valued Hohmann Gammatone Filterbank [1, 3].
22
+ Overlapping temporal frames are projected onto estimated subspaces to isolate physical target distortion,
23
+ interference, and artifact components [1].
24
+ 2. **Inner Hair Cell Transduction:**
25
+ Approximates the shearing limits of physical hair bundles via half-wave rectification and first-order 1 kHz
26
+ membrane-limit lowpass filters [1, 2].
27
+ 3. **Auditory Nerve Adaptation:**
28
+ Models physiological forward masking and metabolic neural depletion via five cascaded stages of non-linear feedback
29
+ loops [2].
30
+ 4. **Perceptual Assimilation:**
31
+ Models cognitive threshold masking where noise below a target reference threshold is partially assimilated or
32
+ masked [2].
33
+ 5. **Score Prediction:**
34
+ Feeds weighted similarity percentiles into a multi-criteria trained sigmoidal neural network to output scores scaled
35
+ from `0` to `100` [1].
36
+
37
+ ## Installation
38
+
39
+ For standard execution, you can install the package directly:
40
+
41
+ ```bash
42
+ pip install "python-peass[numba]"
43
+ ```
44
+
45
+ If you require high-speed execution (using optimized vector libraries like Intel MKL or Apple Accelerate), it is recommended to install NumPy and SciPy via Conda first, and then install the package:
46
+
47
+ ```bash
48
+ conda install --update numpy scipy
49
+ pip install "python-peass[numba]"
50
+ ```
51
+
52
+ ## Quick Start Examples
53
+
54
+ ### 1. Perceptual Quality Score Evaluation
55
+
56
+ Evaluate estimated audio files saved on disk:
57
+
58
+ ```python
59
+ from peass import predict_perceptual_evaluation_scores
60
+
61
+ original_files = [
62
+ "audio/target_source.wav",
63
+ "audio/interference_1.wav",
64
+ "audio/interference_2.wav"
65
+ ]
66
+ estimate_file = "audio/estimated_target.wav"
67
+
68
+ scores = predict_perceptual_evaluation_scores(original_files, estimate_file)
69
+
70
+ print(f"Overall Perceptual Score (OPS): {scores.overall_perceptual_score:.1f}/100")
71
+ print(f"Target Preservation Score (TPS): {scores.target_perceptual_score:.1f}/100")
72
+ print(f"Interference Rejection (IPS): {scores.interference_perceptual_score:.1f}/100")
73
+ print(f"Artifact-free Score (APS): {scores.artifact_perceptual_score:.1f}/100")
74
+ ```
75
+
76
+ ### 2. Score Evaluation with Waveform and File Expositions
77
+
78
+ To run the full perceptual scoring pipeline and simultaneously output the physically separated WAV files (True target,
79
+ Target distortion, Interference, and Artifacts) to a specific output folder:
80
+
81
+ ```python
82
+ from peass import predict_perceptual_evaluation_scores, DecompositionConfiguration
83
+
84
+ original_files = [
85
+ "audio/target_source.wav",
86
+ "audio/interferer.wav"
87
+ ]
88
+ estimate_file = "audio/estimated_target.wav"
89
+
90
+ # 1. Configure the output directory for file-writing
91
+ config = DecompositionConfiguration(destination_directory="./output_directory/")
92
+
93
+ # 2. Set return_decomposition=True to expose the physical waveforms and file paths
94
+ scores = predict_perceptual_evaluation_scores(
95
+ original_files,
96
+ estimate_file,
97
+ configuration=config,
98
+ return_decomposition=True
99
+ )
100
+
101
+ # 3. Print overall scores
102
+ print(f"Overall Perceptual Score (OPS): {scores.overall_perceptual_score:.1f}/100")
103
+
104
+ # 4. Access the file paths of the generated WAV files on disk
105
+ print(f"True target file saved at: {scores.decomposition_files.true_target}")
106
+ print(f"Interference file saved at: {scores.decomposition_files.interference}")
107
+ print(f"Artifacts file saved at: {scores.decomposition_files.artifacts}")
108
+
109
+ # 5. Read the raw NumPy arrays directly from memory
110
+ target_distortion_array = scores.decomposition_waveforms.target_distortion
111
+ ```
112
+
113
+ ### 3. Independent Subband Least-Squares Decomposition
114
+
115
+ You can run the auditory Gammatone/least-squares decomposition engine independently to obtain the isolated physical
116
+ sub-components:
117
+
118
+ ```python
119
+ import numpy as np
120
+ from peass import decompose_distortion_components
121
+
122
+ # In-memory arrays
123
+ target_array = np.random.randn(16000, 1)
124
+ noise_array = np.random.randn(16000, 1)
125
+ estimate_array = target_array + 0.05 * noise_array
126
+
127
+ # Run subband least-squares decomposer
128
+ result = decompose_distortion_components(
129
+ source_files=[target_array, noise_array],
130
+ estimate_file=estimate_array,
131
+ sampling_frequency_hz=16000.0
132
+ )
133
+
134
+ waveforms = result.waveforms
135
+ true_target, target_distortion, interference, artifacts = (
136
+ waveforms.true_target,
137
+ waveforms.target_distortion,
138
+ waveforms.interference,
139
+ waveforms.artifacts
140
+ )
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Test Suite & CI/CD
146
+
147
+ The validation suite implements rigorous numerical, physical, and integration checks.
148
+ You will need to `pip install -r requirements.txt` to set up.
149
+
150
+ ### Regression Verification
151
+
152
+ We test our output waveforms directly against the original `.wav` reference waveforms generated by the official MATLAB
153
+ PEASS toolbox (located in `references/peass_master_22c7fc4e/v2.0.1/example/`).
154
+ Python's outputs must achieve a cross-correlation coefficient exceeding $0.95$ with the MATLAB reference to pass.
155
+
156
+ ### Parallel Execution
157
+
158
+ To run the test suite across multiple CPU cores using `pytest-xdist`, execute:
159
+
160
+ ```bash
161
+ pytest -n auto
162
+ ```
163
+
164
+ ---
165
+
166
+ ## References
167
+
168
+ 1. **V. Emiya, E. Vincent, N. Harlander, and V. Hohmann**,
169
+ *"Subjective and objective quality assessment of audio source separation"*,
170
+ IEEE Transactions on Audio, Speech, and Language Processing, 19(7):2046–2057, 2011.
171
+ 2. **R. Huber and B. Kollmeier**,
172
+ *"PEMO-Q — A New Method for Objective Audio Quality Assessment Using a Model of Auditory Perception"*,
173
+ IEEE Transactions on Audio, Speech, and Language Processing, 14(6):1902–1911, 2006.
174
+ 3. **V. Hohmann**,
175
+ *"Frequency analysis and synthesis using a Gammatone filterbank"*,
176
+ Acustica/Acta Acustica, 88(3):433–442, 2002.
@@ -0,0 +1,30 @@
1
+ """
2
+ python-peass: Perceptual Evaluation methods for Audio Source Separation
3
+ A modern, Pythonic port of the PEASS v2.0.1 toolkit.
4
+ """
5
+
6
+ __version__ = "2.0.1.2" # matches peass version, with one more segment for me to edit
7
+
8
+ from .config import DecomposedFilePaths
9
+ from .config import DecomposedWaveforms
10
+ from .config import DecompositionConfiguration
11
+ from .config import DecompositionResult
12
+ from .config import ModulationProcessingType
13
+ from .config import PerceptualSeparationScores
14
+ from .decomposition import decompose_distortion_components
15
+ from .metrics import calculate_auditory_quality_features
16
+ from .metrics import calculate_bss_eval_energy_ratios
17
+ from .predictor import predict_perceptual_evaluation_scores
18
+
19
+ __all__ = [
20
+ "DecomposedFilePaths",
21
+ "DecomposedWaveforms",
22
+ "DecompositionConfiguration",
23
+ "DecompositionResult",
24
+ "ModulationProcessingType",
25
+ "PerceptualSeparationScores",
26
+ "predict_perceptual_evaluation_scores",
27
+ "decompose_distortion_components",
28
+ "calculate_bss_eval_energy_ratios",
29
+ "calculate_auditory_quality_features",
30
+ ]