analyzeAudio 0.3.0__tar.gz → 0.5.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.
Files changed (57) hide show
  1. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/PKG-INFO +19 -6
  2. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/README.md +13 -4
  3. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/__init__.py +1 -1
  4. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/_beDRY.py +6 -0
  5. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/_theTypes.py +1 -2
  6. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/analyze.py +2 -1
  7. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/analyzersUseFilename/__init__.py +13 -16
  8. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/analyzersUseFilename/_aspectralstats.py +41 -40
  9. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/analyzersUseFilename/_ebur128.py +20 -4
  10. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/analyzersUseFilename/_wideRange.py +11 -6
  11. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/analyzersUseSpectrogram.py +128 -41
  12. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/analyzersUseTensor.py +50 -2
  13. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/contestsSpectrogram.py +45 -7
  14. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/contestsTensor.py +141 -84
  15. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/contestsTensorSpectrogram.py +54 -19
  16. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/registry.py +6 -8
  17. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio.egg-info/PKG-INFO +19 -6
  18. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio.egg-info/SOURCES.txt +4 -2
  19. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio.egg-info/requires.txt +2 -1
  20. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio.egg-info/top_level.txt +0 -1
  21. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/pyproject.toml +7 -4
  22. analyzeaudio-0.5.0/tests/__init__.py +14 -0
  23. analyzeaudio-0.5.0/tests/_theSSOT.py +21 -0
  24. analyzeaudio-0.5.0/tests/_theTypes.py +80 -0
  25. analyzeaudio-0.5.0/tests/conftest.py +165 -0
  26. analyzeaudio-0.5.0/tests/dataSamples/SpeakSoftly_BrokenMan60sec/expected.py +250 -0
  27. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/tests/dataSamples/expected.py +113 -14
  28. analyzeaudio-0.5.0/tests/test_analyzersUseFilename.py +239 -0
  29. analyzeaudio-0.5.0/tests/test_analyzersUseSpectrogram.py +44 -0
  30. analyzeaudio-0.5.0/tests/test_analyzersUseTensor.py +35 -0
  31. analyzeaudio-0.5.0/tests/test_analyzersUseWaveform.py +40 -0
  32. analyzeaudio-0.5.0/tests/test_contestsSpectrogram.py +38 -0
  33. analyzeaudio-0.5.0/tests/test_contestsTensor.py +113 -0
  34. analyzeaudio-0.5.0/tests/test_contestsTensorSpectrogram.py +88 -0
  35. analyzeaudio-0.3.0/analyzeAudio/analyzersUseFilename/_contests.py +0 -235
  36. analyzeaudio-0.3.0/tests/__init__.py +0 -5
  37. analyzeaudio-0.3.0/tests/_theTypes.py +0 -27
  38. analyzeaudio-0.3.0/tests/conftest.py +0 -53
  39. analyzeaudio-0.3.0/tests/dataSamples/SpeakSoftly_BrokenMan60sec/expected.py +0 -105
  40. analyzeaudio-0.3.0/tests/test_analyzersUseFilename.py +0 -239
  41. analyzeaudio-0.3.0/tests/test_analyzersUseSpectrogram.py +0 -45
  42. analyzeaudio-0.3.0/tests/test_analyzersUseTensor.py +0 -3
  43. analyzeaudio-0.3.0/tests/test_analyzersUseTensorSpectrogram.py +0 -0
  44. analyzeaudio-0.3.0/tests/test_analyzersUseWaveform.py +0 -40
  45. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/LICENSE +0 -0
  46. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/_misfit.py +0 -0
  47. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/_theSSOT.py +0 -0
  48. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/analyzersUseFilename/_astats.py +0 -0
  49. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/analyzersUseFilename/_pythonator.py +0 -0
  50. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/analyzersUseWaveform.py +0 -0
  51. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/ffmpeg.py +0 -0
  52. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio/py.typed +0 -0
  53. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio.egg-info/dependency_links.txt +0 -0
  54. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/analyzeAudio.egg-info/entry_points.txt +0 -0
  55. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/setup.cfg +0 -0
  56. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/tests/dataSamples/SpeakSoftly_BrokenMan60sec/__init__.py +0 -0
  57. {analyzeaudio-0.3.0 → analyzeaudio-0.5.0}/tests/dataSamples/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: analyzeAudio
3
- Version: 0.3.0
3
+ Version: 0.5.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
@@ -23,6 +23,9 @@ Classifier: Operating System :: OS Independent
23
23
  Classifier: Programming Language :: Python
24
24
  Classifier: Programming Language :: Python :: 3
25
25
  Classifier: Programming Language :: Python :: 3.10
26
+ Classifier: Programming Language :: Python :: 3.11
27
+ Classifier: Programming Language :: Python :: 3.12
28
+ Classifier: Programming Language :: Python :: 3.13
26
29
  Classifier: Programming Language :: Python :: 3.14
27
30
  Classifier: Topic :: Multimedia :: Sound/Audio
28
31
  Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
@@ -34,7 +37,7 @@ Requires-Python: >=3.10
34
37
  Description-Content-Type: text/markdown
35
38
  License-File: LICENSE
36
39
  Requires-Dist: auraloss
37
- Requires-Dist: hunterHearsPy
40
+ Requires-Dist: hunterHearsPy>=1.0.3
38
41
  Requires-Dist: hunterMakesPy>=0.7.0
39
42
  Requires-Dist: librosa
40
43
  Requires-Dist: numpy
@@ -49,6 +52,7 @@ Requires-Dist: pytest-cov; extra == "development"
49
52
  Requires-Dist: scipy-stubs; extra == "development"
50
53
  Provides-Extra: testing
51
54
  Requires-Dist: pytest; extra == "testing"
55
+ Requires-Dist: pytest-xdist; extra == "testing"
52
56
  Dynamic: license-file
53
57
 
54
58
  # analyzeAudio
@@ -198,7 +202,7 @@ If a requested name is unavailable, that value is `"not found"`.
198
202
  from pathlib import Path
199
203
  from analyzeAudio import analyzeAudioListPathFilenames
200
204
 
201
- listPathFilenames = sorted(Path("audio").glob("*.wav"))
205
+ listPathFilenames = tuple(Path("audio").glob("*.wav"))
202
206
  listAspectNames = [
203
207
  "LUFS integrated",
204
208
  "LUFS loudness range",
@@ -435,10 +439,20 @@ whatAspects
435
439
  whatContests
436
440
  ```
437
441
 
442
+ ## API standardization
443
+
444
+ A top priority for this package is a public API that is as standardized as
445
+ possible across filename, waveform, spectrogram, tensor, and contest analyzers.
446
+ The package wraps libraries with very different calling conventions, but analyzer
447
+ function signatures should model this package's dispatcher inputs, not every
448
+ underlying library option.
449
+
438
450
  ## Wishlist
439
451
 
440
- - [] Install FFmpeg in GitHub Actions for testing.
441
- - [] Overhaul the semiotic system.
452
+ - [ ] Overhaul the semiotic system.
453
+ - [ ] Install FFmpeg in GitHub Actions for testing.
454
+ - [ ] Improve speed
455
+ - [ ] Sophisticated caching of large objects and un-hashable objects.
442
456
 
443
457
  ## Reference materials
444
458
 
@@ -588,7 +602,6 @@ whatContests
588
602
  - Free author PDF: [Jonathan Le Roux](https://www.jonathanleroux.org/pdf/LeRoux2019ICASSP05sdr.pdf)
589
603
  - Implementations:
590
604
  - [Lightning-AI/torchmetrics](https://github.com/Lightning-AI/torchmetrics)
591
- - [FFprobe `asisdr` filter](https://ffmpeg.org/ffprobe-all.html#asisdr)
592
605
 
593
606
  ### Loudness Metering: EBU Mode Metering to Supplement Loudness Normalisation
594
607
 
@@ -145,7 +145,7 @@ If a requested name is unavailable, that value is `"not found"`.
145
145
  from pathlib import Path
146
146
  from analyzeAudio import analyzeAudioListPathFilenames
147
147
 
148
- listPathFilenames = sorted(Path("audio").glob("*.wav"))
148
+ listPathFilenames = tuple(Path("audio").glob("*.wav"))
149
149
  listAspectNames = [
150
150
  "LUFS integrated",
151
151
  "LUFS loudness range",
@@ -382,10 +382,20 @@ whatAspects
382
382
  whatContests
383
383
  ```
384
384
 
385
+ ## API standardization
386
+
387
+ A top priority for this package is a public API that is as standardized as
388
+ possible across filename, waveform, spectrogram, tensor, and contest analyzers.
389
+ The package wraps libraries with very different calling conventions, but analyzer
390
+ function signatures should model this package's dispatcher inputs, not every
391
+ underlying library option.
392
+
385
393
  ## Wishlist
386
394
 
387
- - [] Install FFmpeg in GitHub Actions for testing.
388
- - [] Overhaul the semiotic system.
395
+ - [ ] Overhaul the semiotic system.
396
+ - [ ] Install FFmpeg in GitHub Actions for testing.
397
+ - [ ] Improve speed
398
+ - [ ] Sophisticated caching of large objects and un-hashable objects.
389
399
 
390
400
  ## Reference materials
391
401
 
@@ -535,7 +545,6 @@ whatContests
535
545
  - Free author PDF: [Jonathan Le Roux](https://www.jonathanleroux.org/pdf/LeRoux2019ICASSP05sdr.pdf)
536
546
  - Implementations:
537
547
  - [Lightning-AI/torchmetrics](https://github.com/Lightning-AI/torchmetrics)
538
- - [FFprobe `asisdr` filter](https://ffmpeg.org/ffprobe-all.html#asisdr)
539
548
 
540
549
  ### Loudness Metering: EBU Mode Metering to Supplement Loudness Normalisation
541
550
 
@@ -10,7 +10,7 @@ from analyzeAudio._theTypes import (
10
10
  ArrayAspectSpectrogramFramewise as ArrayAspectSpectrogramFramewise, ArrayAspectWaveformFramewise as ArrayAspectWaveformFramewise,
11
11
  ArrayChannelData as ArrayChannelData, ArrayOverallData as ArrayOverallData, Audio as Audio,
12
12
  AuralossChromaSTFTLoss as AuralossChromaSTFTLoss, BleedFull as BleedFull, BleedFullArray as BleedFullArray,
13
- ParametersMelSpectrogram as ParametersMelSpectrogram, parameterSpecifications as parameterSpecifications, Spectrogram as Spectrogram,
13
+ ParametersMelSpectrogram as ParametersMelSpectrogram, parameterSpecifications as parameterSpecifications,
14
14
  SpectrogramMagnitude as SpectrogramMagnitude, SpectrogramPower as SpectrogramPower, typeReturned as typeReturned)
15
15
 
16
16
  # isort: split
@@ -1,6 +1,8 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from operator import neg
3
4
  from typing import TYPE_CHECKING
5
+ import math
4
6
 
5
7
  if TYPE_CHECKING:
6
8
  from collections.abc import Sequence
@@ -23,5 +25,9 @@ def truncateTensors(listTensors: Sequence[Tensor]) -> tuple[Tensor, ...]:
23
25
  truncate: int = min(tensor.shape[-1] for tensor in listTensors)
24
26
  return tuple(tensor[..., 0:truncate] for tensor in listTensors)
25
27
 
28
+ def KValue(unscaled: float, K: float = 10.0) -> float:
29
+ unscaled = max(min(unscaled, K), neg(K) + 1e-6)
30
+ return 100.0 * math.log1p(unscaled + K) / math.log1p(2 * K)
31
+
26
32
  # TODO create DRY `return 20 * numpy.log10(arrayRMS, where=(arrayRMS != 0), out=None)`
27
33
  # If possible, one function for in-place and copy variants.
@@ -1,6 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
- from numpy import complexfloating, dtype, float64, floating, ndarray
3
+ from numpy import dtype, float64, floating, ndarray
4
4
  from typing import Any, Literal, NamedTuple, ParamSpec, Protocol, TYPE_CHECKING, TypedDict, TypeVar
5
5
 
6
6
  if TYPE_CHECKING:
@@ -41,7 +41,6 @@ class ParametersMelSpectrogram(TypedDict, total=False):
41
41
 
42
42
  Audio: TypeAlias = ndarray[tuple[int, ...], dtype[floating[Any]]]
43
43
  ArrayAspect: TypeAlias = ndarray[tuple[int, ...], dtype[floating[Any]]]
44
- Spectrogram: TypeAlias = ndarray[tuple[int, int, int], dtype[complexfloating[Any, Any]]]
45
44
  SpectrogramMagnitude: TypeAlias = ndarray[tuple[int, int, int], dtype[floating[Any]]]
46
45
  SpectrogramPower: TypeAlias = ndarray[tuple[int, int, int], dtype[floating[Any]]]
47
46
  ArrayAspectSpectrogramFramewise: TypeAlias = ndarray[tuple[int, Literal[1], int], dtype[floating[Any]]]
@@ -31,9 +31,10 @@ import soundfile
31
31
  import torch
32
32
 
33
33
  if TYPE_CHECKING:
34
- from analyzeAudio import Audio, Spectrogram, SpectrogramMagnitude, SpectrogramPower
34
+ from analyzeAudio import Audio, SpectrogramMagnitude, SpectrogramPower
35
35
  from collections.abc import Sequence
36
36
  from concurrent.futures import Future
37
+ from hunterHearsPy import Spectrogram
37
38
  from os import PathLike
38
39
  from torch import Tensor
39
40
  from typing import Any
@@ -2,19 +2,19 @@
2
2
  from __future__ import annotations
3
3
 
4
4
  from analyzeAudio.analyzersUseFilename._aspectralstats import (
5
- analyzeSpectralCentroid as analyzeSpectralCentroid, analyzeSpectralCentroidMean as analyzeSpectralCentroidMean,
6
- analyzeSpectralCrest as analyzeSpectralCrest, analyzeSpectralCrestMean as analyzeSpectralCrestMean,
7
- analyzeSpectralDecrease as analyzeSpectralDecrease, analyzeSpectralDecreaseMean as analyzeSpectralDecreaseMean,
8
- analyzeSpectralEntropy as analyzeSpectralEntropy, analyzeSpectralEntropyMean as analyzeSpectralEntropyMean,
9
- analyzeSpectralFlatness as analyzeSpectralFlatness, analyzeSpectralFlatnessMean as analyzeSpectralFlatnessMean,
10
- analyzeSpectralFlux as analyzeSpectralFlux, analyzeSpectralFluxMean as analyzeSpectralFluxMean,
11
- analyzeSpectralKurtosis as analyzeSpectralKurtosis, analyzeSpectralKurtosisMean as analyzeSpectralKurtosisMean,
12
- analyzeSpectralMean as analyzeSpectralMean, analyzeSpectralMeanMean as analyzeSpectralMeanMean,
13
- analyzeSpectralRolloff as analyzeSpectralRolloff, analyzeSpectralRolloffMean as analyzeSpectralRolloffMean,
14
- analyzeSpectralSkewness as analyzeSpectralSkewness, analyzeSpectralSkewnessMean as analyzeSpectralSkewnessMean,
15
- analyzeSpectralSlope as analyzeSpectralSlope, analyzeSpectralSlopeMean as analyzeSpectralSlopeMean,
16
- analyzeSpectralSpread as analyzeSpectralSpread, analyzeSpectralSpreadMean as analyzeSpectralSpreadMean,
17
- analyzeSpectralVariance as analyzeSpectralVariance, analyzeSpectralVarianceMean as analyzeSpectralVarianceMean)
5
+ analyzeSpectral_centroid as analyzeSpectral_centroid, analyzeSpectral_centroid_mean as analyzeSpectral_centroid_mean,
6
+ analyzeSpectral_crest as analyzeSpectral_crest, analyzeSpectral_crest_mean as analyzeSpectral_crest_mean,
7
+ analyzeSpectral_decrease as analyzeSpectral_decrease, analyzeSpectral_decrease_mean as analyzeSpectral_decrease_mean,
8
+ analyzeSpectral_entropy as analyzeSpectral_entropy, analyzeSpectral_entropy_mean as analyzeSpectral_entropy_mean,
9
+ analyzeSpectral_flatness as analyzeSpectral_flatness, analyzeSpectral_flatness_mean as analyzeSpectral_flatness_mean,
10
+ analyzeSpectral_flux as analyzeSpectral_flux, analyzeSpectral_flux_mean as analyzeSpectral_flux_mean,
11
+ analyzeSpectral_kurtosis as analyzeSpectral_kurtosis, analyzeSpectral_kurtosis_mean as analyzeSpectral_kurtosis_mean,
12
+ analyzeSpectral_mean as analyzeSpectral_mean, analyzeSpectral_mean_mean as analyzeSpectral_mean_mean,
13
+ analyzeSpectral_rolloff as analyzeSpectral_rolloff, analyzeSpectral_rolloff_mean as analyzeSpectral_rolloff_mean,
14
+ analyzeSpectral_skewness as analyzeSpectral_skewness, analyzeSpectral_skewness_mean as analyzeSpectral_skewness_mean,
15
+ analyzeSpectral_slope as analyzeSpectral_slope, analyzeSpectral_slope_mean as analyzeSpectral_slope_mean,
16
+ analyzeSpectral_spread as analyzeSpectral_spread, analyzeSpectral_spread_mean as analyzeSpectral_spread_mean,
17
+ analyzeSpectral_variance as analyzeSpectral_variance, analyzeSpectral_variance_mean as analyzeSpectral_variance_mean)
18
18
  from analyzeAudio.analyzersUseFilename._astats import (
19
19
  analyzeAbs_Peak_count as analyzeAbs_Peak_count, analyzeAbs_Peak_countTotal as analyzeAbs_Peak_countTotal,
20
20
  analyzeBit_depth as analyzeBit_depth, analyzeBit_depthMean as analyzeBit_depthMean, analyzeCrest_factor as analyzeCrest_factor,
@@ -36,9 +36,6 @@ from analyzeAudio.analyzersUseFilename._astats import (
36
36
  analyzeRMS_trough as analyzeRMS_trough, analyzeRMS_troughOverall as analyzeRMS_troughOverall,
37
37
  analyzeZero_crossings as analyzeZero_crossings, analyzeZero_crossings_rate as analyzeZero_crossings_rate,
38
38
  analyzeZero_crossings_rateOverall as analyzeZero_crossings_rateOverall, analyzeZero_crossingsTotal as analyzeZero_crossingsTotal)
39
- from analyzeAudio.analyzersUseFilename._contests import (
40
- analyzeKPSNRmean as analyzeKPSNRmean, analyzeKSDRmean as analyzeKSDRmean, analyzeKSI_SDRmean as analyzeKSI_SDRmean,
41
- analyzePSNRmean as analyzePSNRmean, analyzeSDRmean as analyzeSDRmean, analyzeSI_SDRmean as analyzeSI_SDRmean)
42
39
  from analyzeAudio.analyzersUseFilename._ebur128 import (
43
40
  analyzeLRA as analyzeLRA, analyzeLRAOverall as analyzeLRAOverall, analyzeLUFShigh as analyzeLUFShigh,
44
41
  analyzeLUFShighOverall as analyzeLUFShighOverall, analyzeLUFSIntegrated as analyzeLUFSIntegrated,
@@ -5,18 +5,19 @@ from __future__ import annotations
5
5
 
6
6
  from analyzeAudio.analyzersUseFilename._wideRange import ffprobeAllInclusiveCache
7
7
  from analyzeAudio.registry import registrationAudioAspect
8
- from typing import Any, TYPE_CHECKING
8
+ from typing import TYPE_CHECKING
9
9
  import numpy
10
10
 
11
11
  if TYPE_CHECKING:
12
12
  from analyzeAudio import ArrayChannelData, ArrayOverallData
13
13
  from collections.abc import Callable
14
14
  from os import PathLike
15
+ from typing import Any
15
16
 
16
17
  arrayChannelDataEmpty: ArrayChannelData = numpy.array([], dtype=numpy.float64).reshape(0, 0)
17
18
  arrayOverallDataEmpty: ArrayOverallData = numpy.array([], dtype=numpy.float64).reshape(0)
18
19
 
19
- def analyzeSpectralCentroid(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
20
+ def analyzeSpectral_centroid(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
20
21
  """Compute the spectral centroid trajectory of an audio file.
21
22
 
22
23
  (AI generated docstring)
@@ -54,7 +55,7 @@ def analyzeSpectralCentroid(pathFilename: str | PathLike[Any]) -> ArrayChannelDa
54
55
  return ffprobeAllInclusiveCache(pathFilename).get('centroid', arrayChannelDataEmpty)
55
56
 
56
57
  @registrationAudioAspect('Spectral centroid mean')
57
- def analyzeSpectralCentroidMean(pathFilename: str | PathLike[Any]) -> float:
58
+ def analyzeSpectral_centroid_mean(pathFilename: str | PathLike[Any]) -> float:
58
59
  """Aspect 'Spectral centroid mean': mean framewise spectral centroid.
59
60
 
60
61
  Returns
@@ -63,10 +64,10 @@ def analyzeSpectralCentroidMean(pathFilename: str | PathLike[Any]) -> float:
63
64
  Mean value of the framewise spectral centroid.
64
65
 
65
66
  """
66
- theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectralCentroid
67
+ theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectral_centroid
67
68
  return numpy.mean(theArrayCallable(pathFilename)).astype(float)
68
69
 
69
- def analyzeSpectralCrest(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
70
+ def analyzeSpectral_crest(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
70
71
  """Compute the spectral crest of an audio file.
71
72
 
72
73
  (AI generated docstring)
@@ -105,7 +106,7 @@ def analyzeSpectralCrest(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
105
106
  return ffprobeAllInclusiveCache(pathFilename).get('crest', arrayChannelDataEmpty)
106
107
 
107
108
  @registrationAudioAspect('Spectral crest mean')
108
- def analyzeSpectralCrestMean(pathFilename: str | PathLike[Any]) -> float:
109
+ def analyzeSpectral_crest_mean(pathFilename: str | PathLike[Any]) -> float:
109
110
  """Aspect 'Spectral crest mean': mean framewise spectral crest.
110
111
 
111
112
  Returns
@@ -114,10 +115,10 @@ def analyzeSpectralCrestMean(pathFilename: str | PathLike[Any]) -> float:
114
115
  Mean value of the framewise spectral crest.
115
116
 
116
117
  """
117
- theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectralCrest
118
+ theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectral_crest
118
119
  return numpy.mean(theArrayCallable(pathFilename)).astype(float)
119
120
 
120
- def analyzeSpectralDecrease(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
121
+ def analyzeSpectral_decrease(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
121
122
  """Compute the spectral decrease trajectory of an audio file.
122
123
 
123
124
  (AI generated docstring)
@@ -155,7 +156,7 @@ def analyzeSpectralDecrease(pathFilename: str | PathLike[Any]) -> ArrayChannelDa
155
156
  return ffprobeAllInclusiveCache(pathFilename).get('decrease', arrayChannelDataEmpty)
156
157
 
157
158
  @registrationAudioAspect('Spectral decrease mean')
158
- def analyzeSpectralDecreaseMean(pathFilename: str | PathLike[Any]) -> float:
159
+ def analyzeSpectral_decrease_mean(pathFilename: str | PathLike[Any]) -> float:
159
160
  """Aspect 'Spectral decrease mean': mean framewise spectral decrease.
160
161
 
161
162
  Parameters
@@ -168,10 +169,10 @@ def analyzeSpectralDecreaseMean(pathFilename: str | PathLike[Any]) -> float:
168
169
  spectralDecreaseMean : float
169
170
  Mean spectral decrease across analyzed frames.
170
171
  """
171
- theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectralDecrease
172
+ theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectral_decrease
172
173
  return numpy.mean(theArrayCallable(pathFilename)).astype(float)
173
174
 
174
- def analyzeSpectralEntropy(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
175
+ def analyzeSpectral_entropy(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
175
176
  """Compute the spectral entropy trajectory of an audio file.
176
177
 
177
178
  (AI generated docstring)
@@ -207,7 +208,7 @@ def analyzeSpectralEntropy(pathFilename: str | PathLike[Any]) -> ArrayChannelDat
207
208
  return ffprobeAllInclusiveCache(pathFilename).get('entropy', arrayChannelDataEmpty)
208
209
 
209
210
  @registrationAudioAspect('Spectral entropy mean')
210
- def analyzeSpectralEntropyMean(pathFilename: str | PathLike[Any]) -> float:
211
+ def analyzeSpectral_entropy_mean(pathFilename: str | PathLike[Any]) -> float:
211
212
  """Aspect 'Spectral entropy mean': mean framewise spectral entropy.
212
213
 
213
214
  Parameters
@@ -220,10 +221,10 @@ def analyzeSpectralEntropyMean(pathFilename: str | PathLike[Any]) -> float:
220
221
  spectralEntropyMean : float
221
222
  Mean spectral entropy across analyzed frames.
222
223
  """
223
- theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectralEntropy
224
+ theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectral_entropy
224
225
  return numpy.mean(theArrayCallable(pathFilename)).astype(float)
225
226
 
226
- def analyzeSpectralFlatness(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
227
+ def analyzeSpectral_flatness(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
227
228
  """Compute the spectral flatness trajectory of an audio file.
228
229
 
229
230
  (AI generated docstring)
@@ -260,7 +261,7 @@ def analyzeSpectralFlatness(pathFilename: str | PathLike[Any]) -> ArrayChannelDa
260
261
  return ffprobeAllInclusiveCache(pathFilename).get('flatness', arrayChannelDataEmpty)
261
262
 
262
263
  @registrationAudioAspect('Spectral flatness mean')
263
- def analyzeSpectralFlatnessMean(pathFilename: str | PathLike[Any]) -> float:
264
+ def analyzeSpectral_flatness_mean(pathFilename: str | PathLike[Any]) -> float:
264
265
  """Aspect 'Spectral flatness mean': mean framewise spectral flatness.
265
266
 
266
267
  Returns
@@ -269,10 +270,10 @@ def analyzeSpectralFlatnessMean(pathFilename: str | PathLike[Any]) -> float:
269
270
  Mean value of the framewise spectral flatness.
270
271
 
271
272
  """
272
- theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectralFlatness
273
+ theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectral_flatness
273
274
  return numpy.mean(theArrayCallable(pathFilename)).astype(float)
274
275
 
275
- def analyzeSpectralFlux(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
276
+ def analyzeSpectral_flux(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
276
277
  """Compute the spectral flux trajectory of an audio file.
277
278
 
278
279
  (AI generated docstring)
@@ -309,7 +310,7 @@ def analyzeSpectralFlux(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
309
310
  return ffprobeAllInclusiveCache(pathFilename).get('flux', arrayChannelDataEmpty)
310
311
 
311
312
  @registrationAudioAspect('Spectral flux mean')
312
- def analyzeSpectralFluxMean(pathFilename: str | PathLike[Any]) -> float:
313
+ def analyzeSpectral_flux_mean(pathFilename: str | PathLike[Any]) -> float:
313
314
  """Aspect 'Spectral flux mean': mean framewise spectral flux.
314
315
 
315
316
  Parameters
@@ -322,10 +323,10 @@ def analyzeSpectralFluxMean(pathFilename: str | PathLike[Any]) -> float:
322
323
  spectralFluxMean : float
323
324
  Mean spectral flux across analyzed frames.
324
325
  """
325
- theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectralFlux
326
+ theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectral_flux
326
327
  return numpy.mean(theArrayCallable(pathFilename)).astype(float)
327
328
 
328
- def analyzeSpectralKurtosis(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
329
+ def analyzeSpectral_kurtosis(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
329
330
  """Compute the spectral kurtosis trajectory of an audio file.
330
331
 
331
332
  (AI generated docstring)
@@ -365,7 +366,7 @@ def analyzeSpectralKurtosis(pathFilename: str | PathLike[Any]) -> ArrayChannelDa
365
366
  return ffprobeAllInclusiveCache(pathFilename).get('kurtosis', arrayChannelDataEmpty)
366
367
 
367
368
  @registrationAudioAspect('Spectral kurtosis mean')
368
- def analyzeSpectralKurtosisMean(pathFilename: str | PathLike[Any]) -> float:
369
+ def analyzeSpectral_kurtosis_mean(pathFilename: str | PathLike[Any]) -> float:
369
370
  """Aspect 'Spectral kurtosis mean': mean framewise spectral kurtosis.
370
371
 
371
372
  Parameters
@@ -379,10 +380,10 @@ def analyzeSpectralKurtosisMean(pathFilename: str | PathLike[Any]) -> float:
379
380
  Mean spectral kurtosis across analyzed frames.
380
381
 
381
382
  """
382
- theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectralKurtosis
383
+ theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectral_kurtosis
383
384
  return numpy.mean(theArrayCallable(pathFilename)).astype(float)
384
385
 
385
- def analyzeSpectralMean(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
386
+ def analyzeSpectral_mean(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
386
387
  """Compute the power spectral density trajectory of an audio file.
387
388
 
388
389
  (AI generated docstring)
@@ -412,7 +413,7 @@ def analyzeSpectralMean(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
412
413
  return ffprobeAllInclusiveCache(pathFilename).get('mean', arrayChannelDataEmpty)
413
414
 
414
415
  @registrationAudioAspect('Power spectral density mean')
415
- def analyzeSpectralMeanMean(pathFilename: str | PathLike[Any]) -> float:
416
+ def analyzeSpectral_mean_mean(pathFilename: str | PathLike[Any]) -> float:
416
417
  """Aspect 'Power spectral density mean': mean framewise power spectral density.
417
418
 
418
419
  Parameters
@@ -425,10 +426,10 @@ def analyzeSpectralMeanMean(pathFilename: str | PathLike[Any]) -> float:
425
426
  powerSpectralDensityMean : float
426
427
  Mean power spectral density across all frequency bins and analyzed frames.
427
428
  """
428
- theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectralMean
429
+ theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectral_mean
429
430
  return numpy.mean(theArrayCallable(pathFilename)).astype(float)
430
431
 
431
- def analyzeSpectralRolloff(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
432
+ def analyzeSpectral_rolloff(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
432
433
  """Compute the spectral rolloff trajectory of an audio file.
433
434
 
434
435
  (AI generated docstring)
@@ -466,7 +467,7 @@ def analyzeSpectralRolloff(pathFilename: str | PathLike[Any]) -> ArrayChannelDat
466
467
  return ffprobeAllInclusiveCache(pathFilename).get('rolloff', arrayChannelDataEmpty)
467
468
 
468
469
  @registrationAudioAspect('Spectral rolloff mean')
469
- def analyzeSpectralRolloffMean(pathFilename: str | PathLike[Any]) -> float:
470
+ def analyzeSpectral_rolloff_mean(pathFilename: str | PathLike[Any]) -> float:
470
471
  """Aspect 'Spectral rolloff mean': mean framewise spectral rolloff frequency.
471
472
 
472
473
  Parameters
@@ -479,10 +480,10 @@ def analyzeSpectralRolloffMean(pathFilename: str | PathLike[Any]) -> float:
479
480
  spectralRolloffMean : float
480
481
  Mean spectral rolloff frequency across analyzed frames.
481
482
  """
482
- theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectralRolloff
483
+ theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectral_rolloff
483
484
  return numpy.mean(theArrayCallable(pathFilename)).astype(float)
484
485
 
485
- def analyzeSpectralSkewness(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
486
+ def analyzeSpectral_skewness(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
486
487
  """Compute the spectral skewness trajectory of an audio file.
487
488
 
488
489
  (AI generated docstring)
@@ -521,7 +522,7 @@ def analyzeSpectralSkewness(pathFilename: str | PathLike[Any]) -> ArrayChannelDa
521
522
  return ffprobeAllInclusiveCache(pathFilename).get('skewness', arrayChannelDataEmpty)
522
523
 
523
524
  @registrationAudioAspect('Spectral skewness mean')
524
- def analyzeSpectralSkewnessMean(pathFilename: str | PathLike[Any]) -> float:
525
+ def analyzeSpectral_skewness_mean(pathFilename: str | PathLike[Any]) -> float:
525
526
  """Aspect 'Spectral skewness mean': mean framewise spectral skewness.
526
527
 
527
528
  Parameters
@@ -534,10 +535,10 @@ def analyzeSpectralSkewnessMean(pathFilename: str | PathLike[Any]) -> float:
534
535
  spectralSkewnessMean : float
535
536
  Mean spectral skewness across analyzed frames.
536
537
  """
537
- theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectralSkewness
538
+ theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectral_skewness
538
539
  return numpy.mean(theArrayCallable(pathFilename)).astype(float)
539
540
 
540
- def analyzeSpectralSlope(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
541
+ def analyzeSpectral_slope(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
541
542
  """Compute the spectral slope trajectory of an audio file.
542
543
 
543
544
  (AI generated docstring)
@@ -576,7 +577,7 @@ def analyzeSpectralSlope(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
576
577
  return ffprobeAllInclusiveCache(pathFilename).get('slope', arrayChannelDataEmpty)
577
578
 
578
579
  @registrationAudioAspect('Spectral slope mean')
579
- def analyzeSpectralSlopeMean(pathFilename: str | PathLike[Any]) -> float:
580
+ def analyzeSpectral_slope_mean(pathFilename: str | PathLike[Any]) -> float:
580
581
  """Aspect 'Spectral slope mean': mean framewise spectral slope.
581
582
 
582
583
  Parameters
@@ -589,10 +590,10 @@ def analyzeSpectralSlopeMean(pathFilename: str | PathLike[Any]) -> float:
589
590
  spectralSlopeMean : float
590
591
  Mean spectral slope across analyzed frames.
591
592
  """
592
- theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectralSlope
593
+ theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectral_slope
593
594
  return numpy.mean(theArrayCallable(pathFilename)).astype(float)
594
595
 
595
- def analyzeSpectralSpread(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
596
+ def analyzeSpectral_spread(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
596
597
  """Compute the spectral spread trajectory of an audio file.
597
598
 
598
599
  (AI generated docstring)
@@ -630,7 +631,7 @@ def analyzeSpectralSpread(pathFilename: str | PathLike[Any]) -> ArrayChannelData
630
631
  return ffprobeAllInclusiveCache(pathFilename).get('spread', arrayChannelDataEmpty)
631
632
 
632
633
  @registrationAudioAspect('Spectral spread mean')
633
- def analyzeSpectralSpreadMean(pathFilename: str | PathLike[Any]) -> float:
634
+ def analyzeSpectral_spread_mean(pathFilename: str | PathLike[Any]) -> float:
634
635
  """Aspect 'Spectral spread mean': mean framewise spectral spread.
635
636
 
636
637
  Returns
@@ -639,10 +640,10 @@ def analyzeSpectralSpreadMean(pathFilename: str | PathLike[Any]) -> float:
639
640
  Mean value of the framewise spectral spread.
640
641
 
641
642
  """
642
- theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectralSpread
643
+ theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectral_spread
643
644
  return numpy.mean(theArrayCallable(pathFilename)).astype(float)
644
645
 
645
- def analyzeSpectralVariance(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
646
+ def analyzeSpectral_variance(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
646
647
  """Compute the spectral variance trajectory of an audio file.
647
648
 
648
649
  (AI generated docstring)
@@ -681,7 +682,7 @@ def analyzeSpectralVariance(pathFilename: str | PathLike[Any]) -> ArrayChannelDa
681
682
  return ffprobeAllInclusiveCache(pathFilename).get('variance', arrayChannelDataEmpty)
682
683
 
683
684
  @registrationAudioAspect('Spectral variance mean')
684
- def analyzeSpectralVarianceMean(pathFilename: str | PathLike[Any]) -> float:
685
+ def analyzeSpectral_variance_mean(pathFilename: str | PathLike[Any]) -> float:
685
686
  """Aspect 'Spectral variance mean': mean framewise spectral variance.
686
687
 
687
688
  Parameters
@@ -694,5 +695,5 @@ def analyzeSpectralVarianceMean(pathFilename: str | PathLike[Any]) -> float:
694
695
  spectralVarianceMean : float
695
696
  Mean spectral variance across analyzed frames.
696
697
  """
697
- theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectralVariance
698
+ theArrayCallable: Callable[[str | PathLike[Any]], ArrayChannelData] = analyzeSpectral_variance
698
699
  return numpy.mean(theArrayCallable(pathFilename)).astype(float)
@@ -1,5 +1,9 @@
1
- # ty:ignore[invalid-return-type]
1
+ # pyright: reportArgumentType=false
2
+ # pyright: reportAssignmentType=false
2
3
  # pyright: reportReturnType=false
4
+ # ty:ignore[invalid-argument-type]
5
+ # ty:ignore[invalid-assignment]
6
+ # ty:ignore[invalid-return-type]
3
7
  """Analyzers that use the filename of an audio file to analyze its audio data."""
4
8
  from __future__ import annotations
5
9
 
@@ -9,13 +13,25 @@ from typing import Any, TYPE_CHECKING
9
13
  import numpy
10
14
 
11
15
  if TYPE_CHECKING:
12
- from analyzeAudio import ArrayOverallData
16
+ from analyzeAudio import ArrayChannelData, ArrayOverallData
13
17
  from os import PathLike
14
18
 
15
19
  arrayOverallDataEmpty: ArrayOverallData = numpy.array([], dtype=numpy.float64).reshape(0)
16
20
 
17
- # TODO 'true_peaks_ch0', 'true_peaks_ch1', etc.
18
- # TODO one function ro return one array with all LUFS aspects.
21
+ # TODO one function to return one array with all LUFS aspects.
22
+
23
+ def analyzeTruePeakChannel(pathFilename: str | PathLike[Any]) -> ArrayChannelData:
24
+ keepGoing: bool = True
25
+ channel: int = 0
26
+ listAspectChannels: list[ArrayOverallData] = [ffprobeAllInclusiveCache(pathFilename).get(f'true_peaks_ch{channel}', arrayOverallDataEmpty)]
27
+ while keepGoing:
28
+ channel += 1
29
+ aspectChannel = ffprobeAllInclusiveCache(pathFilename).get(f'true_peaks_ch{channel}', None)
30
+ if aspectChannel is not None:
31
+ listAspectChannels.append(aspectChannel)
32
+ else:
33
+ keepGoing = False
34
+ return numpy.stack(listAspectChannels, axis=0)
19
35
 
20
36
  def analyzeTruePeak(pathFilename: str | PathLike[Any]) -> ArrayOverallData:
21
37
  """Compute the true-peak trajectory of an audio file.
@@ -12,14 +12,16 @@ if TYPE_CHECKING:
12
12
  from analyzeAudio import ArrayChannelData, ArrayOverallData
13
13
  from os import PathLike
14
14
 
15
+ # https://ffmpeg.org/ffmpeg-filters.html#drmeter
16
+ # Potential aspect, but it doesn't work.
17
+ # ffmpeg -hide_banner -i /data/MusicDemixingBenchmarks/synthetic/melody_000_mixture.wav -filter_complex "[0]ebur128,drmeter,astats" -map 0 -f null -
18
+
15
19
  @cache
16
20
  def ffprobeAllInclusiveCache(pathFilename: str | PathLike[Any]) -> dict[str, ArrayChannelData | ArrayOverallData]:
17
- """I use this shared extractor to collect scalar audio aspects from one analysis pass.
18
-
19
- (AI generated docstring)
21
+ """I use this shared extractor to collect audio aspects from one analysis pass.
20
22
 
21
- I use this function to convert one structured analysis result into a dictionary of scalar and
22
- array audio aspects.
23
+ I use this function to convert one structured analysis result into a dictionary of array audio
24
+ aspects.
23
25
 
24
26
  Parameters
25
27
  ----------
@@ -81,6 +83,9 @@ def ffprobeAllInclusiveCache(pathFilename: str | PathLike[Any]) -> dict[str, Arr
81
83
 
82
84
  # TODO Bit_depth: 'Bit_depth', 'Bit_depth2', 'Bit_depth3', 'Bit_depth4',
83
85
 
84
- # If I ran two passes of the filter, I could force per-frame values for all aspects with `reset=1`. astats is pretty fast because there are no transformations.
86
+ # If I ran two passes of the filter, I could force per-frame values for all aspects with
87
+ # `reset=1`. astats is pretty fast because there are no transformations. But I would need to
88
+ # change pythonator because it will use the same key names for both passes, overwriting the
89
+ # first pass.
85
90
 
86
91
  return dictionaryAspects