python-peass 2.0.1__py3-none-any.whl
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.
- peass/__init__.py +18 -0
- peass/auditory_model.py +158 -0
- peass/decomposition.py +470 -0
- peass/gammatone.py +267 -0
- peass/metrics.py +147 -0
- peass/parameters/paramTask1.npz +0 -0
- peass/parameters/paramTask2.npz +0 -0
- peass/parameters/paramTask3.npz +0 -0
- peass/parameters/paramTask4.npz +0 -0
- peass/predictor.py +131 -0
- python_peass-2.0.1.dist-info/METADATA +165 -0
- python_peass-2.0.1.dist-info/RECORD +14 -0
- python_peass-2.0.1.dist-info/WHEEL +4 -0
- python_peass-2.0.1.dist-info/licenses/LICENSE +680 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-peass
|
|
3
|
+
Version: 2.0.1
|
|
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: Topic :: Scientific/Engineering :: Information Analysis
|
|
17
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: numpy >= 1.20.0
|
|
20
|
+
Requires-Dist: scipy >= 1.6.0
|
|
21
|
+
Requires-Dist: soundfile >= 0.10.0
|
|
22
|
+
Project-URL: Homepage, https://github.com/averykhoo/python-peass
|
|
23
|
+
Project-URL: Source, https://github.com/averykhoo/python-peass
|
|
24
|
+
Project-URL: Tracker, https://github.com/averykhoo/python-peass/issues
|
|
25
|
+
|
|
26
|
+
# python-peass
|
|
27
|
+
|
|
28
|
+
[](https://github.com/averykhoo/python-peass/actions)
|
|
29
|
+
[](https://pypi.org/project/python-peass/)
|
|
30
|
+
|
|
31
|
+
> This project was ported by Gemini 3.5 Flash from
|
|
32
|
+
> https://gitlab.inria.fr/bass-db/peass/-/tree/22c7fc4ef670f8bb6eea9ab4abea98323006b769/v2.0.1
|
|
33
|
+
|
|
34
|
+
An elegant, Pythonic, and fully-typed port of the **PEASS v2.0.1**
|
|
35
|
+
(Perceptual Evaluation methods for Audio Source Separation) toolkit [1].
|
|
36
|
+
|
|
37
|
+
This library replaces traditional energy ratios (SDR, SIR, SAR) with perceptually motivated objective scores—
|
|
38
|
+
**OPS, TPS, IPS, and APS**—which are highly correlated with human evaluations [1].
|
|
39
|
+
|
|
40
|
+
## Scientific Highlights
|
|
41
|
+
|
|
42
|
+
Traditional metrics evaluate separations via energy ratios [1].
|
|
43
|
+
However, human hearing relies heavily on non-linear auditory transduction and masking [2].
|
|
44
|
+
`python-peass` executes a multi-stage cognitive pipeline to assess quality:
|
|
45
|
+
|
|
46
|
+
1. **Subband Least-Squares Decomposition:**
|
|
47
|
+
Signals are divided into subbands using a complex-valued Hohmann Gammatone Filterbank [1, 3].
|
|
48
|
+
Overlapping temporal frames are projected onto estimated subspaces to isolate physical distortion artifacts [1].
|
|
49
|
+
2. **Inner Hair Cell Transduction:**
|
|
50
|
+
Approximates the shearing limits of physical hair bundles via half-wave rectification
|
|
51
|
+
and 1 kHz membrane-limit lowpass filters [1, 2].
|
|
52
|
+
3. **Auditory Nerve Adaptation:**
|
|
53
|
+
Uses five stages of non-linear feedback loops modeling forward masking and metabolic neural depletion [2].
|
|
54
|
+
4. **Perceptual Assimilation:**
|
|
55
|
+
Models cognitive masking where noise below a target threshold is partially assimilated or masked [2].
|
|
56
|
+
5. **Score Prediction:**
|
|
57
|
+
Feeds weighted similarity percentiles into a multi-criteria trained sigmoidal neural network
|
|
58
|
+
to output scores from `0` to `100` [1].
|
|
59
|
+
|
|
60
|
+
## Architectural Layout & MATLAB Mapping
|
|
61
|
+
|
|
62
|
+
Unlike loose research scripts, this package organizes functions into explicit scientific modules:
|
|
63
|
+
|
|
64
|
+
| Python Module | Primary Classes / Functions | Replaced MATLAB / C Files |
|
|
65
|
+
|:-----------------------|:---------------------------------------------------------------------------------------------------|:-------------------------------------------------------|
|
|
66
|
+
| `peass.gammatone` | `GammatoneFilter`, `GammatoneAnalyzer`, `GammatoneDelay`, `GammatoneMixer`, `GammatoneSynthesizer` | `Gfb_Filter_new.m`, `Gfb_Analyzer_process.m`, etc. |
|
|
67
|
+
| `peass.auditory_model` | `haircell_transduction`, `adaptation_loops`, `generate_internal_representation` | `haircell.c` (MEX), `adapt.c` (MEX), `pemo_internal.m` |
|
|
68
|
+
| `peass.decomposition` | `extract_distortion_components`, `least_squares_decompose_time_varying` | `extractDistortionComponents.m`, `LSDecompose_tv.m` |
|
|
69
|
+
| `peass.metrics` | `pemo_similarity_metric`, `calculate_energy_ratios`, `audio_quality_features` | `pemo_metric.m`, `audioQualityFeatures.m` |
|
|
70
|
+
| `peass.predictor` | `predict_peass_scores`, `my_mapping` | `PEASS_ObjectiveMeasure.m`, `map2SubjScale.m` |
|
|
71
|
+
|
|
72
|
+
## Installation
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install python-peass
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Quick Start Examples
|
|
79
|
+
|
|
80
|
+
### 1. Perceptual Quality Score Evaluation (Predictor Pipeline)
|
|
81
|
+
|
|
82
|
+
Evaluate estimated audio files saved on disk:
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from peass import predict_peass_scores
|
|
86
|
+
|
|
87
|
+
original_files = [
|
|
88
|
+
"audio/target_source.wav",
|
|
89
|
+
"audio/interference_1.wav",
|
|
90
|
+
"audio/interference_2.wav"
|
|
91
|
+
]
|
|
92
|
+
estimate_file = "audio/estimated_target.wav"
|
|
93
|
+
|
|
94
|
+
scores = predict_peass_scores(original_files, estimate_file)
|
|
95
|
+
|
|
96
|
+
print(f"Overall Perceptual Score (OPS): {scores['OPS']:.1f}/100")
|
|
97
|
+
print(f"Target Preservation Score (TPS): {scores['TPS']:.1f}/100")
|
|
98
|
+
print(f"Interference Rejection (IPS): {scores['IPS']:.1f}/100")
|
|
99
|
+
print(f"Artifact-free Score (APS): {scores['APS']:.1f}/100")
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 2. Exposing Physical Decompositions and Wav Files
|
|
103
|
+
|
|
104
|
+
If you wish to obtain the actual separated signal waveforms
|
|
105
|
+
(True target, Target distortion, Interference, and Artifacts) alongside the predicted scores:
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from peass import predict_peass_scores
|
|
109
|
+
|
|
110
|
+
original_files = ["audio/target.wav", "audio/noise.wav"]
|
|
111
|
+
estimate_file = "audio/estimate.wav"
|
|
112
|
+
|
|
113
|
+
# Setting return_decomposition=True triggers wave synthesis
|
|
114
|
+
results = predict_peass_scores(
|
|
115
|
+
original_files,
|
|
116
|
+
estimate_file,
|
|
117
|
+
options={'destDir': './output_directory/'},
|
|
118
|
+
return_decomposition=True
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
# 1. Print Scores
|
|
122
|
+
print(f"Overall Perceptual Score: {results['OPS']}")
|
|
123
|
+
|
|
124
|
+
# 2. Access Filepaths of newly generated wave files on disk
|
|
125
|
+
print(f"Decomposed Target saved at: {results['decomposition_files']['true_target']}")
|
|
126
|
+
|
|
127
|
+
# 3. Read raw numpy arrays directly from memory
|
|
128
|
+
target_distortion_array = results['decomposition_arrays']['target_distortion']
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 3. Running Independent Physical Decomposition (No ML Score Regressor)
|
|
132
|
+
|
|
133
|
+
You can also run the auditory Gammatone/least-squares decomposition engine by itself
|
|
134
|
+
to generate isolated WAV files or raw NumPy arrays:
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
from peass import extract_distortion_components
|
|
138
|
+
|
|
139
|
+
# In-memory arrays
|
|
140
|
+
target_array = np.random.randn(16000, 1)
|
|
141
|
+
noise_array = np.random.randn(16000, 1)
|
|
142
|
+
estimate_array = target_array + 0.05 * noise_array
|
|
143
|
+
|
|
144
|
+
# Run subband least-squares decomposer
|
|
145
|
+
_, decomposed_arrays = extract_distortion_components(
|
|
146
|
+
src_files=[target_array, noise_array],
|
|
147
|
+
est_file=estimate_array,
|
|
148
|
+
sampling_frequency=16000.0
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
true_target, target_distortion, interference, artifacts = decomposed_arrays
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## References
|
|
155
|
+
|
|
156
|
+
1. **V. Emiya, E. Vincent, N. Harlander, and V. Hohmann**,
|
|
157
|
+
*"Subjective and objective quality assessment of audio source separation"*,
|
|
158
|
+
IEEE Transactions on Audio, Speech, and Language Processing, 19(7):2046–2057, 2011.
|
|
159
|
+
2. **R. Huber and B. Kollmeier**,
|
|
160
|
+
*"PEMO-Q — A New Method for Objective Audio Quality Assessment Using a Model of Auditory Perception"*,
|
|
161
|
+
IEEE Transactions on Audio, Speech, and Language Processing, 14(6):1902–1911, 2006.
|
|
162
|
+
3. **V. Hohmann**,
|
|
163
|
+
*"Frequency analysis and synthesis using a Gammatone filterbank"*,
|
|
164
|
+
Acustica/Acta Acustica, 88(3):433–442, 2002.
|
|
165
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
peass/__init__.py,sha256=KN3-a6gDQi_yxHbetjh0Mp9GvWEnEmzXDbUAL7QXjEU,492
|
|
2
|
+
peass/auditory_model.py,sha256=6GUdMPuwSHVTX1DUe8BMLUWd3s0RWQLtCLIzDUUST6Y,6461
|
|
3
|
+
peass/decomposition.py,sha256=RmVLR_1OcVqM2S-97dO1zBjR4L3pPzwBxTqJUeFNtUs,19155
|
|
4
|
+
peass/gammatone.py,sha256=I_-QUpVQlXYOXLaCUIN7IcVZ-HemtkRJngeY5yk3Tbg,10075
|
|
5
|
+
peass/metrics.py,sha256=8ObtvqlNYGEES-IAyNcfHVtCClrvAO3NqNrrGPxLf6c,5657
|
|
6
|
+
peass/predictor.py,sha256=p7h0CBBbFiwunEepTh-Kytq9b8qQtKkhO6a9VHNvXQc,4631
|
|
7
|
+
peass/parameters/paramTask1.npz,sha256=aXM19LDXudwXX0XTmHodT1AYwTiJZbsTXitBUcJCdCg,1190
|
|
8
|
+
peass/parameters/paramTask2.npz,sha256=Ij4wsWKOe-3BmGHrgSfA2aQTl8LNdqt2HU_9H5l1ZuY,1174
|
|
9
|
+
peass/parameters/paramTask3.npz,sha256=R6uNJoqxg4wlpd7u3Gr-lKSZZAOJgxGDRUxk1Gduotc,1215
|
|
10
|
+
peass/parameters/paramTask4.npz,sha256=ZqyMwkg6LXWuRZdGPOGFe6bqC1ZIh6oH53TJBbkOmrg,1122
|
|
11
|
+
python_peass-2.0.1.dist-info/licenses/LICENSE,sha256=8Z7Wl1ywDvPVNYHAk9FvP0l3YPBZqM1wtjFcoOBvuWQ,35525
|
|
12
|
+
python_peass-2.0.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
13
|
+
python_peass-2.0.1.dist-info/METADATA,sha256=4GTnwwJsfuvr3JpBOvKjuZ1c36ScLoor8JWsxURPOvM,7416
|
|
14
|
+
python_peass-2.0.1.dist-info/RECORD,,
|