analyzeAudio 0.2.0__tar.gz → 0.3.0__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.
- {analyzeaudio-0.2.0 → analyzeaudio-0.3.0}/PKG-INFO +327 -151
- {analyzeaudio-0.2.0 → analyzeaudio-0.3.0}/README.md +324 -150
- analyzeaudio-0.3.0/analyzeAudio/__init__.py +28 -0
- {analyzeaudio-0.2.0 → analyzeaudio-0.3.0}/analyzeAudio/_beDRY.py +3 -0
- {analyzeaudio-0.2.0 → analyzeaudio-0.3.0}/analyzeAudio/_misfit.py +6 -9
- analyzeaudio-0.3.0/analyzeAudio/_theSSOT.py +5 -0
- analyzeaudio-0.3.0/analyzeAudio/_theTypes.py +61 -0
- {analyzeaudio-0.2.0 → analyzeaudio-0.3.0}/analyzeAudio/analyze.py +32 -41
- analyzeaudio-0.3.0/analyzeAudio/analyzersUseFilename/__init__.py +49 -0
- analyzeaudio-0.3.0/analyzeAudio/analyzersUseFilename/_aspectralstats.py +698 -0
- analyzeaudio-0.3.0/analyzeAudio/analyzersUseFilename/_astats.py +1140 -0
- analyzeaudio-0.3.0/analyzeAudio/analyzersUseFilename/_contests.py +235 -0
- analyzeaudio-0.3.0/analyzeAudio/analyzersUseFilename/_ebur128.py +396 -0
- analyzeaudio-0.2.0/analyzeAudio/pythonator.py → analyzeaudio-0.3.0/analyzeAudio/analyzersUseFilename/_pythonator.py +1 -1
- analyzeaudio-0.3.0/analyzeAudio/analyzersUseFilename/_wideRange.py +86 -0
- {analyzeaudio-0.2.0 → analyzeaudio-0.3.0}/analyzeAudio/analyzersUseSpectrogram.py +127 -117
- analyzeaudio-0.3.0/analyzeAudio/analyzersUseTensor.py +106 -0
- {analyzeaudio-0.2.0 → analyzeaudio-0.3.0}/analyzeAudio/analyzersUseWaveform.py +146 -138
- analyzeaudio-0.3.0/analyzeAudio/contestsSpectrogram.py +197 -0
- analyzeaudio-0.2.0/analyzeAudio/analyzersUseTensor.py → analyzeaudio-0.3.0/analyzeAudio/contestsTensor.py +97 -308
- analyzeaudio-0.2.0/analyzeAudio/analyzersUseTensorSpectrogram.py → analyzeaudio-0.3.0/analyzeAudio/contestsTensorSpectrogram.py +20 -41
- {analyzeaudio-0.2.0 → analyzeaudio-0.3.0}/analyzeAudio/ffmpeg.py +0 -1
- analyzeaudio-0.2.0/analyzeAudio/audioAspectsRegistry.py → analyzeaudio-0.3.0/analyzeAudio/registry.py +96 -6
- {analyzeaudio-0.2.0 → analyzeaudio-0.3.0}/analyzeAudio.egg-info/PKG-INFO +327 -151
- analyzeaudio-0.3.0/analyzeAudio.egg-info/SOURCES.txt +43 -0
- analyzeaudio-0.3.0/analyzeAudio.egg-info/entry_points.txt +4 -0
- {analyzeaudio-0.2.0 → analyzeaudio-0.3.0}/analyzeAudio.egg-info/requires.txt +2 -0
- {analyzeaudio-0.2.0 → analyzeaudio-0.3.0}/pyproject.toml +10 -11
- analyzeaudio-0.3.0/tests/__init__.py +5 -0
- analyzeaudio-0.3.0/tests/_theTypes.py +27 -0
- analyzeaudio-0.3.0/tests/conftest.py +53 -0
- analyzeaudio-0.3.0/tests/dataSamples/SpeakSoftly_BrokenMan60sec/expected.py +105 -0
- analyzeaudio-0.3.0/tests/dataSamples/__init__.py +0 -0
- analyzeaudio-0.3.0/tests/dataSamples/expected.py +1738 -0
- analyzeaudio-0.3.0/tests/test_analyzersUseFilename.py +239 -0
- analyzeaudio-0.3.0/tests/test_analyzersUseSpectrogram.py +45 -0
- analyzeaudio-0.3.0/tests/test_analyzersUseTensor.py +3 -0
- analyzeaudio-0.3.0/tests/test_analyzersUseTensorSpectrogram.py +0 -0
- analyzeaudio-0.3.0/tests/test_analyzersUseWaveform.py +40 -0
- analyzeaudio-0.2.0/analyzeAudio/__init__.py +0 -26
- analyzeaudio-0.2.0/analyzeAudio/_theTypes.py +0 -20
- analyzeaudio-0.2.0/analyzeAudio/analyzersUseFilename.py +0 -2121
- analyzeaudio-0.2.0/analyzeAudio.egg-info/SOURCES.txt +0 -30
- analyzeaudio-0.2.0/analyzeAudio.egg-info/entry_points.txt +0 -2
- analyzeaudio-0.2.0/tests/conftest.py +0 -54
- analyzeaudio-0.2.0/tests/test_analyzersUseFilename.py +0 -379
- analyzeaudio-0.2.0/tests/test_analyzersUseSpectrogram.py +0 -87
- analyzeaudio-0.2.0/tests/test_analyzersUseTensor.py +0 -192
- analyzeaudio-0.2.0/tests/test_analyzersUseTensorSpectrogram.py +0 -59
- analyzeaudio-0.2.0/tests/test_analyzersUseWaveform.py +0 -84
- {analyzeaudio-0.2.0 → analyzeaudio-0.3.0}/LICENSE +0 -0
- {analyzeaudio-0.2.0 → analyzeaudio-0.3.0}/analyzeAudio/py.typed +0 -0
- {analyzeaudio-0.2.0 → analyzeaudio-0.3.0}/analyzeAudio.egg-info/dependency_links.txt +0 -0
- {analyzeaudio-0.2.0 → analyzeaudio-0.3.0}/analyzeAudio.egg-info/top_level.txt +0 -0
- {analyzeaudio-0.2.0 → analyzeaudio-0.3.0}/setup.cfg +0 -0
- {analyzeaudio-0.2.0/tests → analyzeaudio-0.3.0/tests/dataSamples/SpeakSoftly_BrokenMan60sec}/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: analyzeAudio
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Measure one or more aspects of one or more audio files.
|
|
5
5
|
Author-email: Hunter Hogan <HunterHogan@pm.me>
|
|
6
6
|
License-Expression: CC-BY-NC-4.0
|
|
@@ -34,6 +34,8 @@ Requires-Python: >=3.10
|
|
|
34
34
|
Description-Content-Type: text/markdown
|
|
35
35
|
License-File: LICENSE
|
|
36
36
|
Requires-Dist: auraloss
|
|
37
|
+
Requires-Dist: hunterHearsPy
|
|
38
|
+
Requires-Dist: hunterMakesPy>=0.7.0
|
|
37
39
|
Requires-Dist: librosa
|
|
38
40
|
Requires-Dist: numpy
|
|
39
41
|
Requires-Dist: scipy
|
|
@@ -57,212 +59,386 @@ Measure one or more aspects of one or more audio files.
|
|
|
57
59
|
|
|
58
60
|
Some options to [download FFmpeg and FFprobe](https://www.ffmpeg.org/download.html) at ffmpeg.org.
|
|
59
61
|
|
|
62
|
+
### Install FFmpeg on Google Colab
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from analyzeAudio.ffmpeg import verifyFFmpegColab
|
|
66
|
+
verifyFFmpegColab()
|
|
67
|
+
```
|
|
68
|
+
|
|
60
69
|
[](https://pypi.org/project/analyzeAudio/)
|
|
61
70
|
[](https://pypi.org/project/analyzeAudio/)
|
|
62
71
|
|
|
63
|
-
##
|
|
72
|
+
## What is in the package
|
|
73
|
+
|
|
74
|
+
`analyzeAudio` provides two user-facing kinds of audio analysis.
|
|
75
|
+
|
|
76
|
+
- Audio aspects measure one audio file.
|
|
77
|
+
- Audio contests compare two audio files, waveforms, tensors, or spectrograms.
|
|
78
|
+
|
|
79
|
+
The main user workflows are:
|
|
80
|
+
|
|
81
|
+
| What you want | Use |
|
|
82
|
+
| -------------------------------------------------------- | ----------------------------------------------- |
|
|
83
|
+
| One value for each selected measurement on one file | `analyzeAudioFile` |
|
|
84
|
+
| The same selected measurements for many files | `analyzeAudioListPathFilenames` |
|
|
85
|
+
| A TSV, CSV, or other delimited output file | `dataTabularTOpathFilenameDelimited` |
|
|
86
|
+
| One specific measurement or detailed frame data | Import a direct analyzer function |
|
|
87
|
+
| One comparison score between two files | Import a filename contest function |
|
|
88
|
+
| One comparison score between two tensors or spectrograms | Import a tensor or spectrogram contest function |
|
|
89
|
+
|
|
90
|
+
### One-file measurements
|
|
91
|
+
|
|
92
|
+
Use these names with `analyzeAudioFile` or
|
|
93
|
+
`analyzeAudioListPathFilenames`. Names are case-sensitive.
|
|
94
|
+
|
|
95
|
+
Loudness and true peak:
|
|
96
|
+
|
|
97
|
+
| Name | What it measures |
|
|
98
|
+
| ------------------------- | ------------------------------- |
|
|
99
|
+
| `LUFS integrated` | Whole-file integrated loudness. |
|
|
100
|
+
| `LUFS momentary maximum` | Maximum momentary loudness. |
|
|
101
|
+
| `LUFS short-term maximum` | Maximum short-term loudness. |
|
|
102
|
+
| `LUFS loudness range` | Loudness range. |
|
|
103
|
+
| `LUFS low` | Low loudness range boundary. |
|
|
104
|
+
| `LUFS high` | High loudness range boundary. |
|
|
105
|
+
| `true_peak maximum` | Maximum true peak level. |
|
|
106
|
+
|
|
107
|
+
Signal level, dynamics, and samples:
|
|
108
|
+
|
|
109
|
+
| Name | What it measures |
|
|
110
|
+
| ----------------------------- | ------------------------------------------------ |
|
|
111
|
+
| `RMS_level overall` | Overall RMS level. |
|
|
112
|
+
| `RMS_peak overall` | Overall RMS peak. |
|
|
113
|
+
| `RMS_trough overall` | Overall RMS trough. |
|
|
114
|
+
| `RMS_difference overall` | Overall RMS difference between adjacent samples. |
|
|
115
|
+
| `Peak_level overall` | Overall peak level. |
|
|
116
|
+
| `Peak_count total` | Total detected peak count. |
|
|
117
|
+
| `Abs_Peak_count total` | Total absolute peak count. |
|
|
118
|
+
| `Crest_factor mean` | Mean crest factor. |
|
|
119
|
+
| `Dynamic_range overall` | Overall dynamic range. |
|
|
120
|
+
| `DC_offset mean` | Mean DC offset. |
|
|
121
|
+
| `Bit_depth mean` | Mean detected bit depth. |
|
|
122
|
+
| `Entropy mean` | Mean signal entropy. |
|
|
123
|
+
| `Flat_factor mean` | Mean flat factor. |
|
|
124
|
+
| `Max_difference overall` | Maximum sample difference. |
|
|
125
|
+
| `Max_level overall` | Maximum sample level. |
|
|
126
|
+
| `Mean_difference mean` | Mean adjacent-sample difference. |
|
|
127
|
+
| `Min_difference overall` | Minimum sample difference. |
|
|
128
|
+
| `Min_level overall` | Minimum sample level. |
|
|
129
|
+
| `Noise_floor overall` | Overall noise floor. |
|
|
130
|
+
| `Noise_floor_count total` | Total noise-floor count. |
|
|
131
|
+
| `Number_of_samples total` | Total samples. |
|
|
132
|
+
| `Zero_crossings total` | Total zero crossings. |
|
|
133
|
+
| `Zero_crossings_rate overall` | Overall zero-crossing rate. |
|
|
134
|
+
|
|
135
|
+
Spectral measurements:
|
|
136
|
+
|
|
137
|
+
| Name | What it measures |
|
|
138
|
+
| ----------------------------- | ---------------------------------------------------- |
|
|
139
|
+
| `Power spectral density mean` | Mean power spectral density. |
|
|
140
|
+
| `Spectral centroid mean` | Mean spectral center of mass from filename analysis. |
|
|
141
|
+
| `Spectral crest mean` | Mean spectral crest. |
|
|
142
|
+
| `Spectral decrease mean` | Mean spectral decrease. |
|
|
143
|
+
| `Spectral entropy mean` | Mean spectral entropy. |
|
|
144
|
+
| `Spectral flatness mean` | Mean spectral flatness from filename analysis. |
|
|
145
|
+
| `Spectral flux mean` | Mean spectral flux. |
|
|
146
|
+
| `Spectral kurtosis mean` | Mean spectral kurtosis. |
|
|
147
|
+
| `Spectral rolloff mean` | Mean spectral rolloff. |
|
|
148
|
+
| `Spectral skewness mean` | Mean spectral skewness. |
|
|
149
|
+
| `Spectral slope mean` | Mean spectral slope. |
|
|
150
|
+
| `Spectral spread mean` | Mean spectral spread. |
|
|
151
|
+
| `Spectral variance mean` | Mean spectral variance. |
|
|
152
|
+
| `Spectral Bandwidth mean` | Mean librosa spectral bandwidth. |
|
|
153
|
+
| `Spectral Centroid mean` | Mean librosa spectral centroid. |
|
|
154
|
+
| `Spectral Contrast mean` | Mean librosa spectral contrast. |
|
|
155
|
+
| `Spectral Flatness mean` | Mean librosa spectral flatness ratio. |
|
|
156
|
+
| `Spectral Flatness dB mean` | Mean librosa spectral flatness in decibels. |
|
|
157
|
+
| `Chromagram mean` | Mean chroma energy across pitch classes. |
|
|
158
|
+
|
|
159
|
+
Waveform, rhythm, and speech measurements:
|
|
160
|
+
|
|
161
|
+
| Name | What it measures |
|
|
162
|
+
| ------------------------- | ----------------------------------------------------- |
|
|
163
|
+
| `RMS Waveform mean` | Mean waveform RMS amplitude. |
|
|
164
|
+
| `RMS Waveform dB mean` | Mean waveform RMS level in decibels. |
|
|
165
|
+
| `Tempogram mean` | Mean tempogram value. |
|
|
166
|
+
| `Tempo mean` | Mean estimated tempo. |
|
|
167
|
+
| `Zero Crossing Rate mean` | Mean waveform zero-crossing rate. |
|
|
168
|
+
| `SRMR mean` | Mean speech-to-reverberation modulation energy ratio. |
|
|
169
|
+
|
|
170
|
+
Some names intentionally differ only by capitalization or wording. For example,
|
|
171
|
+
`Spectral flatness mean` and `Spectral Flatness mean` are different
|
|
172
|
+
measurements. Use the exact name from the table.
|
|
173
|
+
|
|
174
|
+
### Measure one file
|
|
64
175
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
for named measurements from audio paths. The lower-level modules are there when you already have
|
|
68
|
-
decoded audio in memory, want the full array or tensor instead of one summary float, or want to
|
|
69
|
-
call direct comparison and loss analyzers yourself.
|
|
176
|
+
```python
|
|
177
|
+
from analyzeAudio import analyzeAudioFile
|
|
70
178
|
|
|
71
|
-
|
|
179
|
+
listAspectNames = [
|
|
180
|
+
"LUFS integrated",
|
|
181
|
+
"true_peak maximum",
|
|
182
|
+
"RMS_level overall",
|
|
183
|
+
"Spectral Flatness mean",
|
|
184
|
+
"Zero Crossing Rate mean",
|
|
185
|
+
]
|
|
72
186
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
| `getListAvailableAudioAspects()` | Return the sorted list of registered aspect names. |
|
|
78
|
-
| `audioAspects` | Registry of `aspect name -> analyzer callable + required parameter names`. |
|
|
79
|
-
| `truncateTensors(listTensors)` | Trim multiple tensors to the same trailing length before direct comparison. |
|
|
80
|
-
| `dataTabularTOpathFilenameDelimited(...)` | Write batch results to a delimited text file. |
|
|
187
|
+
listValues = analyzeAudioFile("voice.wav", listAspectNames)
|
|
188
|
+
measurements = dict(zip(listAspectNames, listValues, strict=True))
|
|
189
|
+
print(measurements)
|
|
190
|
+
```
|
|
81
191
|
|
|
82
|
-
|
|
83
|
-
|
|
192
|
+
`analyzeAudioFile` returns one value for each requested name, in the same order.
|
|
193
|
+
If a requested name is unavailable, that value is `"not found"`.
|
|
84
194
|
|
|
85
|
-
###
|
|
195
|
+
### Measure many files
|
|
86
196
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
197
|
+
```python
|
|
198
|
+
from pathlib import Path
|
|
199
|
+
from analyzeAudio import analyzeAudioListPathFilenames
|
|
200
|
+
|
|
201
|
+
listPathFilenames = sorted(Path("audio").glob("*.wav"))
|
|
202
|
+
listAspectNames = [
|
|
203
|
+
"LUFS integrated",
|
|
204
|
+
"LUFS loudness range",
|
|
205
|
+
"true_peak maximum",
|
|
206
|
+
]
|
|
207
|
+
|
|
208
|
+
rows = analyzeAudioListPathFilenames(
|
|
209
|
+
listPathFilenames,
|
|
210
|
+
listAspectNames,
|
|
211
|
+
CPUlimit=4,
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
for row in rows:
|
|
215
|
+
print(row)
|
|
216
|
+
```
|
|
94
217
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
expect magnitude spectrogram tensors.
|
|
218
|
+
Each row starts with the analyzed filename, followed by the requested values.
|
|
219
|
+
Rows are returned as files finish, so row order can differ from input order.
|
|
98
220
|
|
|
99
|
-
###
|
|
221
|
+
### Save measurements
|
|
100
222
|
|
|
101
223
|
```python
|
|
102
|
-
from analyzeAudio import
|
|
224
|
+
from analyzeAudio import (
|
|
225
|
+
analyzeAudioListPathFilenames,
|
|
226
|
+
dataTabularTOpathFilenameDelimited,
|
|
227
|
+
)
|
|
103
228
|
|
|
104
|
-
listAspectNames = [
|
|
105
|
-
|
|
106
|
-
'RMS peak',
|
|
107
|
-
'SRMR mean',
|
|
108
|
-
'Spectral Flatness mean',
|
|
109
|
-
]
|
|
229
|
+
listAspectNames = ["LUFS integrated", "true_peak maximum"]
|
|
230
|
+
rows = analyzeAudioListPathFilenames(["one.wav", "two.wav"], listAspectNames)
|
|
110
231
|
|
|
111
|
-
|
|
112
|
-
|
|
232
|
+
dataTabularTOpathFilenameDelimited(
|
|
233
|
+
"measurements.tsv",
|
|
234
|
+
rows,
|
|
235
|
+
["pathFilename", *listAspectNames],
|
|
236
|
+
)
|
|
113
237
|
```
|
|
114
238
|
|
|
115
|
-
|
|
116
|
-
registered analyzers reuse those representations. Under the hood that means one call can support
|
|
117
|
-
measurements that need the raw waveform, `sampleRate`, a `torch.Tensor` waveform, a complex STFT,
|
|
118
|
-
spectrogram magnitude, or spectrogram power.
|
|
239
|
+
For CSV output, use a comma delimiter:
|
|
119
240
|
|
|
120
|
-
|
|
121
|
-
|
|
241
|
+
```python
|
|
242
|
+
dataTabularTOpathFilenameDelimited(
|
|
243
|
+
"measurements.csv",
|
|
244
|
+
rows,
|
|
245
|
+
["pathFilename", *listAspectNames],
|
|
246
|
+
delimiterOutput=",",
|
|
247
|
+
)
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Get detailed arrays
|
|
251
|
+
|
|
252
|
+
Summary names usually return one number. Direct analyzer functions without
|
|
253
|
+
summary words usually return the per-frame, per-channel, or per-band values.
|
|
254
|
+
|
|
255
|
+
```python
|
|
256
|
+
from analyzeAudio.analyzersUseFilename import (
|
|
257
|
+
analyzeLUFSIntegratedOverall,
|
|
258
|
+
analyzeLUFSMomentary,
|
|
259
|
+
)
|
|
122
260
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
261
|
+
integrated = analyzeLUFSIntegratedOverall("voice.wav")
|
|
262
|
+
momentaryFrames = analyzeLUFSMomentary("voice.wav")
|
|
263
|
+
```
|
|
126
264
|
|
|
127
|
-
|
|
128
|
-
include `SI-SDR mean`, `LogWMSE`, `L1SNRDB`, and `SpectralConvergenceLoss`. For those, inspect the
|
|
129
|
-
registry and call the analyzer directly.
|
|
265
|
+
### Use audio already loaded in Python
|
|
130
266
|
|
|
131
|
-
|
|
267
|
+
Waveform analyzers accept waveform samples shaped as channels by samples.
|
|
132
268
|
|
|
133
269
|
```python
|
|
134
|
-
|
|
270
|
+
import numpy
|
|
271
|
+
import soundfile
|
|
272
|
+
from analyzeAudio.analyzersUseWaveform import (
|
|
273
|
+
analyzeRMSWaveformMean,
|
|
274
|
+
analyzeTempoMean,
|
|
275
|
+
analyzeZeroCrossingRateMean,
|
|
276
|
+
)
|
|
135
277
|
|
|
136
|
-
|
|
137
|
-
|
|
278
|
+
with soundfile.SoundFile("voice.wav") as audioFile:
|
|
279
|
+
sampleRate = audioFile.samplerate
|
|
280
|
+
waveform = audioFile.read(dtype="float32", always_2d=True).astype(numpy.float32).T
|
|
138
281
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
282
|
+
rms = analyzeRMSWaveformMean(waveform)
|
|
283
|
+
tempo = analyzeTempoMean(waveform, sampleRate)
|
|
284
|
+
zeroCrossingRate = analyzeZeroCrossingRateMean(waveform)
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Spectrogram analyzers accept magnitude or power spectrograms.
|
|
288
|
+
|
|
289
|
+
```python
|
|
290
|
+
import librosa
|
|
291
|
+
import numpy
|
|
292
|
+
from analyzeAudio.analyzersUseSpectrogram import (
|
|
293
|
+
analyzeChromagramMean,
|
|
294
|
+
analyzeSpectralCentroidMean,
|
|
143
295
|
)
|
|
296
|
+
|
|
297
|
+
spectrogram = librosa.stft(waveform)
|
|
298
|
+
spectrogramMagnitude = numpy.absolute(spectrogram)
|
|
299
|
+
spectrogramPower = spectrogramMagnitude**2
|
|
300
|
+
|
|
301
|
+
spectralCentroid = analyzeSpectralCentroidMean(spectrogramMagnitude)
|
|
302
|
+
chromagram = analyzeChromagramMean(spectrogramPower, sampleRate)
|
|
144
303
|
```
|
|
145
304
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
305
|
+
### Two-input comparisons
|
|
306
|
+
|
|
307
|
+
Filename contests compare two audio files:
|
|
149
308
|
|
|
150
|
-
|
|
309
|
+
| Function | What it compares |
|
|
310
|
+
| -------------------- | ------------------------------------------------ |
|
|
311
|
+
| `analyzePSNRmean` | Mean peak signal-to-noise ratio. |
|
|
312
|
+
| `analyzeSDRmean` | Mean signal-to-distortion ratio. |
|
|
313
|
+
| `analyzeSI_SDRmean` | Mean scale-invariant signal-to-distortion ratio. |
|
|
314
|
+
| `analyzeKPSNRmean` | Bounded score from PSNR. |
|
|
315
|
+
| `analyzeKSDRmean` | Bounded score from SDR. |
|
|
316
|
+
| `analyzeKSI_SDRmean` | Bounded score from SI-SDR. |
|
|
151
317
|
|
|
152
318
|
```python
|
|
153
|
-
from analyzeAudio import
|
|
319
|
+
from analyzeAudio.analyzersUseFilename import (
|
|
320
|
+
analyzePSNRmean,
|
|
321
|
+
analyzeSDRmean,
|
|
322
|
+
analyzeSI_SDRmean,
|
|
323
|
+
)
|
|
154
324
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
print(audioAspects['SI-SDR mean']['analyzerParameters'])
|
|
158
|
-
print(audioAspects['LogWMSE']['analyzerParameters'])
|
|
325
|
+
pathReference = "reference.wav"
|
|
326
|
+
pathEstimate = "estimate.wav"
|
|
159
327
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
328
|
+
psnr = analyzePSNRmean(pathReference, pathEstimate)
|
|
329
|
+
sdr = analyzeSDRmean(pathReference, pathEstimate)
|
|
330
|
+
si_sdr = analyzeSI_SDRmean(pathReference, pathEstimate)
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
Tensor waveform contests usually compare two PyTorch waveform tensors:
|
|
334
|
+
|
|
335
|
+
| Function | What it compares |
|
|
336
|
+
| --------------------------------- | --------------------------------------------------------------------------------------- |
|
|
337
|
+
| `analyzeL1SNRMean` | Mean L1 signal-to-noise ratio. |
|
|
338
|
+
| `analyzeL1SNRDBMean` | Mean L1 signal-to-noise ratio in decibels. |
|
|
339
|
+
| `analyzeMultiL1SNRDBMean` | Multi-source L1 SNR in decibels. |
|
|
340
|
+
| `analyzeSTFTL1SNRDBMean` | STFT-domain L1 SNR in decibels. |
|
|
341
|
+
| `analyzeLogWMSEMean` | Mean log weighted MSE audio-quality score for reference, estimate, and mixture tensors. |
|
|
342
|
+
| `analyzeDCLoss` | DC loss. |
|
|
343
|
+
| `analyzeESRLoss` | Error-to-signal ratio loss. |
|
|
344
|
+
| `analyzeLogCoshLoss` | Log-cosh loss. |
|
|
345
|
+
| `analyzeSNRLoss` | Signal-to-noise ratio loss. |
|
|
346
|
+
| `analyzeSISDRLoss` | Scale-invariant SDR loss. |
|
|
347
|
+
| `analyzeSDSDRLoss` | Scale-dependent SDR loss. |
|
|
348
|
+
| `analyzeSTFTLoss` | STFT loss. |
|
|
349
|
+
| `analyzeMelSTFTLoss` | Mel-STFT loss. |
|
|
350
|
+
| `analyzeChromaSTFTLoss` | Chroma-STFT loss. |
|
|
351
|
+
| `analyzeMultiResolutionSTFTLoss` | Multi-resolution STFT loss. |
|
|
352
|
+
| `analyzeRandomResolutionSTFTLoss` | Random-resolution STFT loss. |
|
|
353
|
+
| `analyzeSumAndDifferenceSTFTLoss` | Sum-and-difference STFT loss. |
|
|
354
|
+
|
|
355
|
+
```python
|
|
356
|
+
from analyzeAudio.contestsTensor import (
|
|
357
|
+
analyzeL1SNRDBMean,
|
|
358
|
+
analyzeMultiResolutionSTFTLoss,
|
|
163
359
|
)
|
|
360
|
+
|
|
361
|
+
l1snrdb = analyzeL1SNRDBMean(tensorReference, tensorEstimate)
|
|
362
|
+
mrstft = analyzeMultiResolutionSTFTLoss(tensorReference, tensorEstimate)
|
|
164
363
|
```
|
|
165
364
|
|
|
166
|
-
|
|
167
|
-
expects one audio path, two audio paths, waveform tensors, a reference-estimate-mixture triple, or
|
|
168
|
-
spectrogram magnitudes.
|
|
169
|
-
|
|
170
|
-
That is the quickest way to discover whether a name is meant for the high-level single-audio API or
|
|
171
|
-
for direct invocation.
|
|
172
|
-
|
|
173
|
-
### Use the lower-level modules when you want the actual analyzer instead of one registry float
|
|
174
|
-
|
|
175
|
-
These are the actual analyzers, organized by the representation they consume.
|
|
176
|
-
|
|
177
|
-
- `analyzeAudio.analyzersUseFilename`
|
|
178
|
-
- paired-path comparison metrics: `getPSNRmean`, `getSDRmean`, `getSI_SDRmean`
|
|
179
|
-
- framewise spectral arrays with matching mean wrappers: `analyzeSpectralCentroid`,
|
|
180
|
-
`analyzeSpectralCrest`, `analyzeSpectralDecrease`, `analyzeSpectralEntropy`,
|
|
181
|
-
`analyzeSpectralFlatness`, `analyzeSpectralFlux`, `analyzeSpectralKurtosis`,
|
|
182
|
-
`analyzeSpectralMean`, `analyzeSpectralRolloff`, `analyzeSpectralSkewness`,
|
|
183
|
-
`analyzeSpectralSlope`, `analyzeSpectralSpread`, `analyzeSpectralVariance`
|
|
184
|
-
- file-level FFprobe `astats` scalars: `analyzeZero_crossings`, `analyzeZero_crossings_rate`,
|
|
185
|
-
`analyzeDCoffset`, `analyzeDynamicRange`, `analyzeSignalEntropy`, `analyzeNumber_of_samples`,
|
|
186
|
-
`analyzePeak_level`, `analyzeRMS_level`, `analyzeCrest_factor`, `analyzeRMS_peak`,
|
|
187
|
-
`analyzeAbs_Peak_count`, `analyzeBit_depth`, `analyzeFlat_factor`, `analyzeMax_difference`,
|
|
188
|
-
`analyzeMax_level`, `analyzeMean_difference`, `analyzeMin_difference`, `analyzeMin_level`,
|
|
189
|
-
`analyzeNoise_floor`, `analyzeNoise_floor_count`, `analyzePeak_count`,
|
|
190
|
-
`analyzeRMS_difference`, `analyzeRMS_trough`
|
|
191
|
-
- loudness and true-peak arrays plus scalar summaries: `analyzeTruePeak`,
|
|
192
|
-
`analyzeLUFSMomentary`, `analyzeLUFSShortTerm`, `analyzeLUFSIntegrated`, `analyzeLRA`,
|
|
193
|
-
`analyzeLUFSlow`, `analyzeLUFShigh`, plus the matching `...Overall` scalar functions
|
|
194
|
-
- `analyzeAudio.analyzersUseWaveform`
|
|
195
|
-
- raw arrays: `analyzeTempogram`, `analyzeRMS`, `analyzeTempo`, `analyzeZeroCrossingRate`
|
|
196
|
-
- mean summaries: `analyzeTempogramMean`, `analyzeRMSMean`, `analyzeTempoMean`,
|
|
197
|
-
`analyzeZeroCrossingRateMean`
|
|
198
|
-
- `analyzeAudio.analyzersUseSpectrogram`
|
|
199
|
-
- raw arrays: `analyzeChromagram`, `analyzeSpectralContrast`, `analyzeSpectralBandwidth`,
|
|
200
|
-
`analyzeSpectralCentroid`, `analyzeSpectralFlatness`
|
|
201
|
-
- mean summaries: `analyzeChromagramMean`, `analyzeSpectralContrastMean`,
|
|
202
|
-
`analyzeSpectralBandwidthMean`, `analyzeSpectralCentroidMean`,
|
|
203
|
-
`analyzeSpectralFlatnessMean`
|
|
204
|
-
- `analyzeAudio.analyzersUseTensor`
|
|
205
|
-
- reverberation and intelligibility: `analyzeSRMR`, `analyzeSRMRMean`
|
|
206
|
-
- reference-estimate-mixture scoring: `analyzeLogWMSEMean`
|
|
207
|
-
- source-separation scores: `analyzeL1SNRMean`, `analyzeL1SNRDBMean`,
|
|
208
|
-
`analyzeMultiL1SNRDBMean`, `analyzeSTFTL1SNRDBMean`
|
|
209
|
-
- waveform-domain and STFT-domain loss analyzers: `analyzeDCLoss`, `analyzeESRLoss`,
|
|
210
|
-
`analyzeLogCoshLoss`, `analyzeSNRLoss`, `analyzeSISDRLoss`, `analyzeSDSDRLoss`,
|
|
211
|
-
`analyzeSTFTLoss`, `analyzeMelSTFTLoss`, `analyzeChromaSTFTLoss`,
|
|
212
|
-
`analyzeMultiResolutionSTFTLoss`, `analyzeRandomResolutionSTFTLoss`,
|
|
213
|
-
`analyzeSumAndDifferenceSTFTLoss`
|
|
214
|
-
- `analyzeAudio.analyzersUseTensorSpectrogram`
|
|
215
|
-
- magnitude-spectrogram comparison analyzers: `analyzeSpectralConvergenceLoss`,
|
|
216
|
-
`analyzeSTFTMagnitudeLoss`, `analyzeL1FrequencyLoss`
|
|
217
|
-
- `analyzeAudio.ffmpeg`
|
|
218
|
-
- environment check for Colab-style sessions: `verifyFFmpegColab`
|
|
219
|
-
|
|
220
|
-
Several concept names exist in more than one module. That is intentional. For example,
|
|
221
|
-
`Spectral flatness mean` comes from the filename-based FFprobe route, while `Spectral Flatness mean`
|
|
222
|
-
comes from the spectrogram route. Similar names do not necessarily mean duplicate implementations.
|
|
365
|
+
`analyzeLogWMSEMean` also needs the original mixture and sample rate:
|
|
223
366
|
|
|
224
367
|
```python
|
|
225
|
-
import
|
|
226
|
-
|
|
368
|
+
from analyzeAudio.contestsTensor import analyzeLogWMSEMean
|
|
369
|
+
|
|
370
|
+
logwmse = analyzeLogWMSEMean(
|
|
371
|
+
tensorReference,
|
|
372
|
+
tensorEstimate,
|
|
373
|
+
tensorMixture,
|
|
374
|
+
sampleRate,
|
|
375
|
+
)
|
|
376
|
+
```
|
|
227
377
|
|
|
228
|
-
|
|
378
|
+
Tensor spectrogram contests compare two PyTorch magnitude spectrogram tensors:
|
|
229
379
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
380
|
+
| Function | What it compares |
|
|
381
|
+
| -------------------------------- | -------------------------- |
|
|
382
|
+
| `analyzeSpectralConvergenceLoss` | Spectral convergence loss. |
|
|
383
|
+
| `analyzeSTFTMagnitudeLoss` | STFT magnitude loss. |
|
|
384
|
+
| `analyzeL1FrequencyLoss` | L1 frequency score. |
|
|
385
|
+
|
|
386
|
+
```python
|
|
387
|
+
from analyzeAudio.contestsTensorSpectrogram import (
|
|
388
|
+
analyzeSpectralConvergenceLoss,
|
|
389
|
+
analyzeSTFTMagnitudeLoss,
|
|
390
|
+
)
|
|
233
391
|
|
|
234
|
-
|
|
392
|
+
spectralConvergence = analyzeSpectralConvergenceLoss(
|
|
393
|
+
tensorSpectrogramMagnitudeReference,
|
|
394
|
+
tensorSpectrogramMagnitudeEstimate,
|
|
395
|
+
)
|
|
396
|
+
stftMagnitude = analyzeSTFTMagnitudeLoss(
|
|
397
|
+
tensorSpectrogramMagnitudeReference,
|
|
398
|
+
tensorSpectrogramMagnitudeEstimate,
|
|
399
|
+
)
|
|
235
400
|
```
|
|
236
401
|
|
|
402
|
+
NumPy spectrogram helpers compare two magnitude spectrograms:
|
|
403
|
+
|
|
404
|
+
| Function | What it returns |
|
|
405
|
+
| --------------------------- | -------------------------------------------------- |
|
|
406
|
+
| `analyzeBleedFullMelDB` | Arrays of added and missing mel-scaled dB content. |
|
|
407
|
+
| `analyzeBleedFullMelDBMean` | Two scores: `bleed` and `full`. |
|
|
408
|
+
|
|
237
409
|
```python
|
|
238
|
-
from analyzeAudio.
|
|
239
|
-
from analyzeAudio.analyzersUseTensorSpectrogram import analyzeSpectralConvergenceLoss
|
|
410
|
+
from analyzeAudio.contestsSpectrogram import analyzeBleedFullMelDBMean
|
|
240
411
|
|
|
241
|
-
|
|
242
|
-
|
|
412
|
+
bleedFull = analyzeBleedFullMelDBMean(
|
|
413
|
+
spectrogramMagnitudeReference,
|
|
414
|
+
spectrogramMagnitudeEstimate,
|
|
415
|
+
)
|
|
416
|
+
print(bleedFull.bleed, bleedFull.full)
|
|
243
417
|
```
|
|
244
418
|
|
|
245
|
-
###
|
|
419
|
+
### Exact-name checks
|
|
246
420
|
|
|
247
|
-
|
|
248
|
-
|
|
421
|
+
The tables above describe what is in the package. These helpers are available
|
|
422
|
+
when you want a copyable list from the installed version:
|
|
249
423
|
|
|
250
424
|
```python
|
|
251
|
-
from analyzeAudio import
|
|
425
|
+
from analyzeAudio import getListAvailableAudioAspects, getListAvailableAudioContests
|
|
252
426
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
tensorAudioEstimate,
|
|
256
|
-
])
|
|
427
|
+
print(getListAvailableAudioAspects())
|
|
428
|
+
print(getListAvailableAudioContests())
|
|
257
429
|
```
|
|
258
430
|
|
|
259
|
-
|
|
431
|
+
The terminal commands are:
|
|
260
432
|
|
|
261
|
-
```
|
|
262
|
-
|
|
433
|
+
```powershell
|
|
434
|
+
whatAspects
|
|
435
|
+
whatContests
|
|
263
436
|
```
|
|
264
437
|
|
|
265
|
-
|
|
438
|
+
## Wishlist
|
|
439
|
+
|
|
440
|
+
- [] Install FFmpeg in GitHub Actions for testing.
|
|
441
|
+
- [] Overhaul the semiotic system.
|
|
266
442
|
|
|
267
443
|
## Reference materials
|
|
268
444
|
|