Skip to main content

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, write ndarray not array.
  • Use sampleRate unless 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
  • astToolKit
  • pytest

Probably won't need

  • analyzeAudio
  • gmpy2
  • numba
  • platformdirs
  • sympy
  • torch-einops-kit

Not using PyTorch for "business" logic

  • But, I must have torch compatibility.
  • At a minimum, a transformation to and from torch that the user must call.
  • astToolkit easily creates real torch APIs and identifiers, however, for the windowingFunctions module in windowingFunctionsTensor.

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 for loops.
  • Few or no for object comprehensions.

Installation

pip install hunterHearsPy

My recovery

Static Badge

CC-BY-NC-4.0

By law, authors retain their copyrights unless they grant exceptions. The Attribution-NonCommercial 4.0 International Deed outlines how you may use this work.

The restriction on commercial use (without a license) limits advantage-taking, unjust enrichment, and exploitation. You would be morally wrong if you were to enrich yourself by using this work while I am denied healthcare, housing, security of property, and the safety of my person.

To obtain and retain the right to use this work, you incur the cost of attributing the work to me. Your nominal cost might accrue as a benefit that mitigates my suffering or saves my life.

Metadata

Release files for hunterHearsPy 1.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hunterHearsPy 1.4.1
File Size Uploaded Provenance Actions
hunterhearspy-1.4.1.tar.gz 43.3 kB Without provenance Details for hunterhearspy-1.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hunterHearsPy 1.4.1
File Interpreter ABI Platform Actions
hunterhearspy-1.4.1-py3-none-any.whl Python 3 none any Details for hunterhearspy-1.4.1-py3-none-any.whl

Total release size: 97.6 kB

Release files / hunterhearspy-1.4.1.tar.gz

Download URL hunterhearspy-1.4.1.tar.gz
Size 43.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9068a250a33ca185495eb34f1cf558ea77914a392bfcf49958ec41ae29787296
BLAKE2b-256 checksum
How to use checksums
f3289a63006fc8537959a7e7b646b0364e6129c4a0a0074a65bc1bba863bac43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / hunterhearspy-1.4.1-py3-none-any.whl

Download URL hunterhearspy-1.4.1-py3-none-any.whl
Size 54.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc3a7f355144d410f2ce73b79f2767eb1287844f82abac370f1bf4ec747e6baf
BLAKE2b-256 checksum
How to use checksums
9850e4ca4e35448474de5989f6b6438711423a4e1e37c579d96e7b91a6d931cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for hunterHearsPy 1.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page