A quick map of the public surface. Import the top-level names from grainloom.
AudioBuffer(samples, sample_rate=44100)— core container.- properties:
n_frames,n_channels,is_mono,duration - methods:
gain(db),normalized(peak=1.0),to_mono(),mixed(other, gain_db=0.0),concat(*others),with_samples(samples) - classmethod:
AudioBuffer.silence(seconds, sample_rate=44100)
- properties:
oscillators.sine/saw/square/triangle/phasor(freq, seconds, sample_rate=44100, ...)noise.white/pink/brown(seconds, sample_rate=44100, rng=None, amplitude=1.0)windows.hann/hamming/tukey/gaussian/triangular(n)envelopes.linear_fade,envelopes.adsr,envelopes.apply_envelope,envelopes.fade_in/fade_out
Grain(source, position, length, pitch=1.0, window="hann", amplitude=1.0)GranularCloud(source, grain_ms=80, density=20, window="hann", pitch=1.0, position_jitter=0.0, pitch_jitter=0.0, seed=None)—.render(seconds)granulate(source, seconds, ...)granular_stretch(buf, factor, grain_ms=80, overlap=0.5, window="hann")
stft(x, n_fft=1024, hop=256)/istft(frames, n_fft=1024, hop=256, length=None)spectral_freeze(buf, freeze_at=0.5, seconds=None, ..., seed=None)spectral_morph(a, b, amount=0.5, ...)spectral_blur(buf, width=4, ...)
textures.drone(freq, seconds, partials=5, detune=0.01, seed=None)textures.ambience(seconds, color="pink", cutoff=1200, room=0.85, seed=None)textures.shimmer(source, seconds, pitch=2.0, density=25, seed=None)
All implement process(buf) -> AudioBuffer.
Delay(time=0.3, feedback=0.4, mix=0.5)Reverb(room=0.7, mix=0.3)Chorus(rate=0.8, depth=0.003, voices=2, base_delay=0.02, mix=0.5)Saturation(drive=2.0, mix=1.0)BitCrush(bits=8, downsample=1, mix=1.0)Filter(cutoff=1000, mode="lowpass", mix=1.0)Tremolo(rate=5.0, depth=0.5, mix=1.0)EffectChain(effects=[], bypass=False)—.add(effect),.process(buf)
read_wav(path) -> AudioBufferwrite_wav(path, buf)