Juan Sebastian Mendez

SERG

Year : 2023

Shifting Euclidean Rhythm Generator (SERG) is a musical composition tool inspired by Steve Reich’s concept of phasing rhythms. Utilizing Godfried Toussaint’s Euclidean rhythms, this tool generates musical beats and complex polyrhythms that evolve organically over time as they shift in and out of phase, synchronizing precise audio synthesis with real-time circular visualizations.

Technologies:

Euclidean Rhythms

The rhythmic core of SERG is based on Euclidean Rhythms (discovered by Godfried Toussaint in 2004). By utilizing Euclid's greatest common divisor algorithm, the system distributes a specific number of 'hits' (onsets) as equidistantly as possible within a grid of 'pulses.' Remarkably, this pure mathematical calculation automatically generates most of the fundamental rhythms found in traditional world music (such as the Cuban Tresillo) and modern electronic music.

Audio Flux

Developed entirely in JavaScript, the ecosystem leverages Tone.js for web-based synthesis and Tone.js/midi for musical data structures.

Each synthesizer and sampler track undergoes rigorous routing to prevent clipping through individual limiters, before entering the spatial effects buses (Chorus, Delay, Reverb).

Visualization and Phase Shifting

The interface, built with p5.js, functions as a rhythmic clock. The outer rings represent the static base track, while the inner rings undergo 'Phase Shifting'.

The Synchronization Challenge: The Synchronization Challenge: Running UI drawing processes (p5.js) and audio processes (Web Audio API) on the same JavaScript thread introduces latency. This was resolved by pre-scheduling Tone.js MIDI events into the buffer with a calculated offset, ensuring that the p5.js visual sweep aligns perfectly with audio transients at a millisecond level (latency compensation). offset calculado, asegurando que el barrido visual de p5.js coincida exactamente con los transitorios del audio a nivel de milisegundo (compensación de retardo).