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