Python practice in Audio & DSP
Browse the rooms before signing in. Opening a room requires an account and follows your existing access. Practice does not issue certificates.
Kill the DC
A cheap mic added a DC offset that wastes headroom. Subtract the mean so the waveform swings symmetrically around zero.
levels. Free room.
Level It Out
The take is too hot in places. Peak-normalize the signal so its loudest sample sits at full scale before it hits the converter.
levels. Free room.
Read the Meter
The loudness meter needs a number. Compute the RMS level of the buffer, the effective loudness the ear responds to.
levels. Free room.
Tune the Oscillator
First sound of the day: generate a clean sine at the requested frequency so the rest of the patch has something to work with.
signals. Free room.
Count the Crossings
A rough pitch estimate counts how often the waveform crosses zero. Tally the sign changes, the cheapest frequency cue in the book.
analysis. Account access required.
Shape the Note
A raw tone clicks on and off. Build an ADSR envelope so the note has a real attack, sustain, and release.
envelopes. Account access required.
Stack the Harmonics
Build a richer tone additively: sum the harmonics with the given amplitudes over the fundamental.
additive. Account access required.
Window the Frame
Before the analyzer FFTs each frame, taper it with a Hann window to tame spectral leakage.
windows. Account access required.
Measure the Energy
Loudness scaling and Parseval's theorem both start here: the total energy of a signal is the sum of its squared samples. Compute it.
spectral. Account access required.
Slide the Kernel
Apply a filter the honest way: convolve the signal with the kernel from scratch, two loops, no np.convolve.
convolution. Account access required.
Smooth the Signal
Tame a noisy control signal with a one-pole low-pass: mix a little of the new input with a lot of the last output.
iir. Account access required.
Transform by Hand
No library calls: compute the Discrete Fourier Transform straight from its definition so you know exactly what np.fft does.
dft. Account access required.
Carve with a Biquad
Compute the RBJ cookbook coefficients for a resonant low-pass biquad, the second-order section behind every parametric EQ.
iir. Account access required.
Design the Filter
Roll your own low-pass: a windowed-sinc FIR with unity DC gain, the workhorse of clean digital filtering.
design. Account access required.
Fast Transform
The analyzer needs speed. Implement the radix-2 Cooley-Tukey FFT, splitting even and odd samples and recombining.
fft. Account access required.
Read the Decibels
Faders and meters speak in decibels, not raw amplitude. Convert a linear amplitude to dBFS with the 20*log10 law, where unity gain reads zero.
levels. Account access required.
Build the Echo
Add depth with a feedback echo: each repeat is a fraction of the last, fading into the distance.
effects. Account access required.
Compand the Signal
Telephony squeezes dynamic range with mu-law companding before quantizing. Apply the mu-law encoder, the nonlinear curve that gives quiet sounds more bits.
quantization. Account access required.
Detect the Pitch
Prove the tuner works: detect the fundamental of a tone with the YIN difference function and its cumulative-mean-normalized pick.
pitch. Account access required.
Play a Voice
The whole instrument in one function: a sawtooth oscillator through a low-pass and an ADSR envelope. Synthesize the note.
instrument. Account access required.