hunterHearsPy 1.0.1__tar.gz → 1.0.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hunterHearsPy
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: Audio processing.
5
5
  Keywords:
6
6
  Author: Hunter Hogan
@@ -20,7 +20,7 @@ Requires-Dist: huntermakespy>=0.7.0
20
20
  Requires-Dist: numpy
21
21
  Requires-Dist: resampy
22
22
  Requires-Dist: scipy
23
- Requires-Dist: soundfile
23
+ Requires-Dist: soundfile>=0.14.0
24
24
  Requires-Dist: tqdm
25
25
  Requires-Dist: torch ; extra == 'torch'
26
26
  Maintainer: Hunter Hogan
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hunterHearsPy"
3
- version = "1.0.1"
3
+ version = "1.0.3"
4
4
  description = "Audio processing."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -21,12 +21,12 @@ classifiers = [
21
21
  "Typing :: Typed",
22
22
  ]
23
23
  dependencies = [
24
- "hunterMakesPy>=0.7.0",
25
- "numpy",
26
- "resampy",
27
- "scipy",
28
- "soundfile",
29
- "tqdm",
24
+ "hunterMakesPy>=0.7.0",
25
+ "numpy",
26
+ "resampy",
27
+ "scipy",
28
+ "soundfile>=0.14.0",
29
+ "tqdm",
30
30
  ]
31
31
  optional-dependencies = { torch = ["torch"] }
32
32
 
@@ -39,12 +39,7 @@ Issues = "https://github.com/hunterhogan/hunterHearsPy/issues"
39
39
  Repository = "https://github.com/hunterhogan/hunterHearsPy.git"
40
40
 
41
41
  [dependency-groups]
42
- dev = [
43
- "astToolkit",
44
- "pytest-cov",
45
- "scipy-stubs",
46
- "types-resampy",
47
- ]
42
+ dev = ["astToolkit", "pytest-cov", "scipy-stubs", "types-resampy"]
48
43
  pytorch = ["torch==2.10.0", "torchaudio==2.10.0"]
49
44
  testing = ["pytest", "pytest-mock", "pytest-xdist", "torch"]
50
45
 
@@ -9,24 +9,24 @@ arrays shaped `(channels, samples)`. All spectrograms are complex 64-bit float
9
9
  Contents
10
10
  --------
11
11
  Functions
12
- getWaveformMetadata
13
- Retrieve metadata for a collection of audio waveform files.
14
- loadSpectrograms
15
- Load spectrograms from a list of audio files.
16
- loadWaveforms
17
- Load a list of audio files into a single stacked NumPy array.
18
- readAudioFile
19
- Read an audio file and return stereo waveform data as a NumPy array.
20
- resampleWaveform
21
- Resample a waveform array to a target sample rate.
22
- spectrogramToWAV
23
- Write a complex spectrogram to a WAV file.
24
- stft
25
- Perform Short-Time Fourier Transform or its inverse on waveform or spectrogram data.
26
- waveformSpectrogramWaveform
27
- Decorate a spectrogram-processing callable to accept and return waveforms.
28
- writeWAV
29
- Write a waveform array to a WAV file.
12
+ getWaveformMetadata
13
+ Retrieve metadata for a collection of audio waveform files.
14
+ loadSpectrograms
15
+ Load spectrograms from a list of audio files.
16
+ loadWaveforms
17
+ Load a list of audio files into a single stacked NumPy array.
18
+ readAudioFile
19
+ Read an audio file and return stereo waveform data as a NumPy array.
20
+ resampleWaveform
21
+ Resample a waveform array to a target sample rate.
22
+ spectrogramToWAV
23
+ Write a complex spectrogram to a WAV file.
24
+ stft
25
+ Perform Short-Time Fourier Transform or its inverse on waveform or spectrogram data.
26
+ waveformSpectrogramWaveform
27
+ Decorate a spectrogram-processing callable to accept and return waveforms.
28
+ writeWAV
29
+ Write a waveform array to a WAV file.
30
30
 
31
31
  """
32
32
  from __future__ import annotations
@@ -138,19 +138,18 @@ def getWaveformMetadata(listPathFilenames: Sequence[str | PathLike[str]], sample
138
138
  def readAudioFile(pathFilename: str | PathLike[Any] | BinaryIO, sampleRate: float | None = None) -> Waveform:
139
139
  """Read an audio file and return stereo waveform data as a NumPy array.
140
140
 
141
- You can use this function to load any audio file that `soundfile` [1] supports. The
142
- returned `Waveform` [2] is always shaped `(channels, samples)` where `channels` is `2`.
143
- When the source file is mono, `readAudioFile` duplicates the single channel to produce
144
- a stereo array. When `sampleRate` differs from the file's native sample rate,
145
- `readAudioFile` resamples using `resampleWaveform`.
141
+ You can use this function to load any audio file that `soundfile` [1] supports. The returned
142
+ `Waveform` [2] is always shaped `(channels, samples)` where `channels` is `2`. When the source
143
+ file is mono, `readAudioFile` duplicates the single channel to produce a stereo array. When
144
+ `sampleRate` differs from the file's native sample rate, `readAudioFile` resamples using
145
+ `resampleWaveform`.
146
146
 
147
147
  Parameters
148
148
  ----------
149
149
  pathFilename : str | PathLike[Any] | BinaryIO
150
150
  Path to the audio file or a binary stream compatible with `soundfile` [1].
151
- sampleRate : float | None = None
152
- Target sample rate of the returned `Waveform` [2] in Hz. Defaults to `44100`
153
- when `None`.
151
+ sampleRate : float | None = 44100
152
+ Target sample rate of the returned `Waveform` [2] in Hz. Defaults to `44100` when `None`.
154
153
 
155
154
  Returns
156
155
  -------
@@ -188,6 +187,7 @@ def readAudioFile(pathFilename: str | PathLike[Any] | BinaryIO, sampleRate: floa
188
187
  axisTime = 0
189
188
  axisChannels = 1
190
189
  waveform = cast('Waveform', resampleWaveform(waveform, sampleRateDesired=sampleRate, sampleRateSource=sampleRateSource, axisTime=axisTime))
190
+ # TODO In my audio ecosystem, must I force a minimum of 2 channels, or can I merely force an axis for time, even if the axis is length=1?
191
191
  if waveform.shape[axisChannels] == 1:
192
192
  waveform = cast('Waveform', numpy.repeat(waveform, 2, axis=axisChannels))
193
193
  return cast('Waveform', numpy.transpose(waveform, axes=(axisChannels, axisTime)))
@@ -352,10 +352,10 @@ def stft(arrayTarget: Waveform, *, sampleRate: float | None = None, lengthHop: i
352
352
  def stft(arrayTarget: ArrayWaveforms, *, sampleRate: float | None = None, lengthHop: int | None = None, windowingFunction: WindowingFunction | None = None, lengthWindowingFunction: int | None = None, lengthFFT: int | None = None, inverse: Literal[False] = False, lengthWaveform: None = None, indexingAxis: int = -1) -> ArraySpectrograms: ...
353
353
 
354
354
  @overload # istft 1 ndarray
355
- def stft(arrayTarget: Spectrogram, *, sampleRate: float | None = None, lengthHop: int | None = None, windowingFunction: WindowingFunction | None = None, lengthWindowingFunction: int | None = None, lengthFFT: int | None = None, inverse: Literal[True] = True, lengthWaveform: int, indexingAxis: None = None) -> Waveform: ...
355
+ def stft(arrayTarget: Spectrogram, *, sampleRate: float | None = None, lengthHop: int | None = None, windowingFunction: WindowingFunction | None = None, lengthWindowingFunction: int | None = None, lengthFFT: int | None = None, inverse: Literal[True], lengthWaveform: int, indexingAxis: None = None) -> Waveform: ...
356
356
 
357
357
  @overload # istft many ndarray
358
- def stft(arrayTarget: ArraySpectrograms, *, sampleRate: float | None = None, lengthHop: int | None = None, windowingFunction: WindowingFunction | None = None, lengthWindowingFunction: int | None = None, lengthFFT: int | None = None, inverse: Literal[True] = True, lengthWaveform: int, indexingAxis: int = -1) -> ArrayWaveforms: ...
358
+ def stft(arrayTarget: ArraySpectrograms, *, sampleRate: float | None = None, lengthHop: int | None = None, windowingFunction: WindowingFunction | None = None, lengthWindowingFunction: int | None = None, lengthFFT: int | None = None, inverse: Literal[True], lengthWaveform: int, indexingAxis: int = -1) -> ArrayWaveforms: ...
359
359
 
360
360
  def stft(arrayTarget: Waveform | ArrayWaveforms | Spectrogram | ArraySpectrograms
361
361
  , *
File without changes
File without changes