# noise sample-by-sample digital audio processing in zig. inspired by [torvalds/AudioNoise](https://github.com/torvalds/AudioNoise). ## philosophy - single sample in, single sample out - zero latency (no block processing) - IIR filters and delay lines only - no FFT, no complex transforms - learn by building ## what's here - **biquad** - second-order IIR filter (lowpass, highpass, bandpass, notch, allpass) - **lfo** - low frequency oscillator (sine, triangle, sawtooth) - **wav** - wav file writer (44-byte header + samples, no ffmpeg) ## compositions ### ambient ```bash zig build ambient # generates ambient.wav ``` an eno-inspired generative piece. a low C2 drone serves as the constant tonal center, while auxiliary voices (fifth, octave, major third, major seventh) fade in and out on their own long cycles. each voice has a prime-number period (17, 19, 23, 29, 31 seconds) so they never sync up - sometimes you hear just the drone, sometimes several voices bloom together, never the same combination twice. ## usage ```zig const noise = @import("noise"); // create a lowpass filter at 1kHz const lpf = noise.biquad.lowpass(1000, 0.707, 48000); var state: noise.State = .{}; // process samples for (input_samples) |sample| { const output = noise.biquad.step(lpf, &state, sample); // ... } ``` ## example ```bash zig build run # generates output.wav ``` a 440Hz sine with lowpass filtering and tremolo. demonstrates basic synthesis pipeline. ## install ```zig // build.zig.zon .noise = .{ .url = "https://tangled.sh/@zzstoatzz.io/noise/archive/main" }, // build.zig const noise = b.dependency("noise", .{}).module("noise"); exe.root_module.addImport("noise", noise); ``` ## test ```bash zig build test ```