Audio processing.
Project description
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. sampleRateis giving me problems in the "ingest" functions.- Regularly review these semiotics until the system is clear.
- Most of the time,
sampleRateis descriptive: this is the sample rate. SeewriteWAV. - In
readAudioFile, the parameter is prescriptive: make this the sample rate. Even worse, the attribute of the current sample rate isreadSoundFile.samplerate, which is descriptive, of course. - However,
def resampleWaveform(waveform, sampleRateDesired: float, sampleRateSource: float):has excellent semiotics because it does not usesampleRate.
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hunterhearspy-1.1.0.tar.gz.
File metadata
- Download URL: hunterhearspy-1.1.0.tar.gz
- Upload date:
- Size: 24.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe2bd0d87d94da51b828e29250c349a5707d41526fa66d800461bd42b9ed75c7
|
|
| MD5 |
09025197280798f1185bd25a153cc51b
|
|
| BLAKE2b-256 |
94d444653b634bf70b7cfe5040c5dc156470a65d0481f1a1c371a84ef50f86bf
|
File details
Details for the file hunterhearspy-1.1.0-py3-none-any.whl.
File metadata
- Download URL: hunterhearspy-1.1.0-py3-none-any.whl
- Upload date:
- Size: 31.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8612b448cb60e98c965bfe2ea06679057b3842c3577ec381010f1e3d7370e221
|
|
| MD5 |
1a96ae7d50f2a065c1573877f37aee52
|
|
| BLAKE2b-256 |
410fd4bc7b72d58346314b266b56b01d8f357153bb9924df7b59b0611beca190
|