hunterHearsPy
A comprehensive collection of Python utilities for audio processing.
Audio Processing Made Simple
Load and Save Audio Files
Read audio files with automatic stereo conversion and sample rate control:
from hunterHearsPy import readAudioFile, writeWAV
# Load audio with sample rate conversion
waveform = readAudioFile('input.wav', sampleRate=44100)
# Save in WAV format (always 32-bit float)
writeWAV('output.wav', waveform)
Process Multiple Audio Files at Once
Load and process batches of audio files:
from hunterHearsPy import loadWaveforms
# Load multiple files with consistent formatting
array_waveforms = loadWaveforms(['file1.wav', 'file2.wav', 'file3.wav'])
# The result is a unified array with shape (channels, samples, file_count)
Work with Spectrograms
Convert between waveforms and spectrograms:
from hunterHearsPy import stft, halfsine
# Create a spectrogram with a half-sine window
spectrogram = stft(waveform, windowingFunction=halfsine(1024))
# Convert back to a waveform
reconstructed = stft(spectrogram, inverse=True, lengthWaveform=original_length)
Process Audio in the Frequency Domain
Create functions that operate on spectrograms:
from hunterHearsPy import waveformSpectrogramWaveform
def boost_low_frequencies(spectrogram):
# Boost frequencies below 500 Hz
spectrogram[:, :10, :] *= 2.0
return spectrogram
# Create a processor that handles the STFT/ISTFT automatically
processor = waveformSpectrogramWaveform(boost_low_frequencies)
# Apply the processor to a waveform
processed_waveform = processor(original_waveform)
Development
I want:
- consistent waveforms,
- consistent spectrograms, and
- efficient, reliable transformations.
Therefore, I want one package, this package, to manage those objectives with a single source of truth for configurable universal settings.
- I need good default universal settings.
- I need an easy way to change a universal setting.
- I want ad hoc overrides for some or all universal settings.
I don't know a good way to implement user-configurable universal settings. Therefore, as I normally do, I will use my HARDCODED system as a placeholder.
Semiotics
- channel, rarely channels.
- time is more generic than samples and often preferred.
- array is generic.
- when talking about a NumPy
ndarray, writendarraynot array. - Use
sampleRateunless I have a compelling reason not to.
Preferred packages
- NumPy
- scipy
- hunterMakesPy
- tqdm (for status messages)
- cytoolz via the Z0Z_tools package (until it finds a forever home)
- more_itertools
astToolKitpytest
Probably won't need
analyzeAudiogmpy2numbaplatformdirssympytorch-einops-kit
Not using PyTorch for "business" logic
- But, I must have
torchcompatibility. - At a minimum, a transformation to and from
torchthat the user must call. astToolkiteasily creates realtorchAPIs and identifiers, however, for thewindowingFunctionsmodule inwindowingFunctionsTensor.
Not using librosa
- Dependency bloated.
- Slow.
- Less precise than I want.
- I generally dislike the API and identifiers.
Disfavored packages
pandas
More vectorization
- Few or no
forloops. - Few or no
forobject comprehensions.
Installation
pip install hunterHearsPy
My recovery
Release files for hunterHearsPy 1.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hunterhearspy-1.4.0.tar.gz | 38.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hunterhearspy-1.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 73.0 kB
Release files / hunterhearspy-1.4.0.tar.gz
| Download URL | hunterhearspy-1.4.0.tar.gz |
|---|---|
| Size | 38.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef25cca34af60f7d5e8ed53f3073dc68eeac1efad440fe4bbd88e7ce990da477
|
|
BLAKE2b-256 checksum How to use checksums |
2c5440ccb2e1c1aee004df218f3deb1c418cdbb039b878561279c694b04aeebd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Release files / hunterhearspy-1.4.0-py3-none-any.whl
| Download URL | hunterhearspy-1.4.0-py3-none-any.whl |
|---|---|
| Size | 34.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b9ec8c709d1505672dec744ec9726dd12595a312185d35d7cd76979e8df4d5b7
|
|
BLAKE2b-256 checksum How to use checksums |
5121a4d1f4d29b4e736223000150c6a79aac8d0e4926b76feabc9f0ffc64e8e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|