A comprehensive collection of Python utilities for developers and audio processing enthusiasts. "Z0Z_" indicates a prototype package where individual components may eventually evolve into focused standalone packages or move to existing packages. Please suggest a good home for the audio processing tools or any of the other functions.
Read audio files with automatic stereo conversion and sample rate control:
from Z0Z_tools 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)
Load and process batches of audio files:
from Z0Z_tools 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)
Convert between waveforms and spectrograms:
from Z0Z_tools 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)
Create functions that operate on spectrograms:
from Z0Z_tools 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)
Install unpackaged Python code with a simple command:
# From your terminal or command prompt
python -m Z0Z_tools.pipAnything /path/to/unpackaged/code
pip install Z0Z_tools
Coding One Step at a Time:
- WRITE CODE.
- Don't write stupid code that's hard to revise.
- Write good code.
- When revising, write better code.