KXkonstantinos.chafis
A drone engine for Byzantine chant on the Web Audio API
Updated: 7 Nov 20263 min read

A drone engine for Byzantine chant on the Web Audio API

How Isokratis turns Byzantine music theory into a real-time synthesis engine — a 72-moria scale model, oscillator and sample voices, ADSR envelopes, and pitch shifting the way chanters expect it.

Update, November 2026: this post was written about the original PWA, and it stays as the record of that work. The PWA has since been retired. Isokratis is now an Expo / React Native app, not released yet, with the Android build in internal testing on Google Play. The music model and the engine’s classes came across and now run on react-native-audio-api, which follows the Web Audio spec. Storage and session handling changed; the last two sections say how.

Isokratis is a fully fledged tool for any Byzantine chanter. A chanter needs a stable drone — the isokratima — to sing against, and the app synthesizes that drone in real time while the singer chooses the scale and the starting note. The interesting engineering lives in two places: the music model and the audio graph.

Music theory, encoded

Byzantine chant does not use equal temperament. The octave is divided into 72 equal units called moria, and each scale is a sequence of interval steps in that space. So instead of hardcoding frequencies, the model works like the theory does:

Selecting a different scale changes only the interval list. The pitch is always derived from the tonic through the moria arithmetic, which keeps the whole engine consistent — and makes microtonal shifts natural, because a morium is the smallest unit.

The audio graph

The synthesis chain is deliberately small and typed:

AudioSource → ActiveVoice → DroneEngine → destination

Each ActiveVoice is either an oscillator (continuous tone, through a low-pass filter) or a buffer sample (recorded drone), routed through an EQ stage and a gain node with an ADSR envelope. The DroneEngine owns the master gain and exposes events (start, stop, voicesChanged) so the UI stays in sync without polling.

The parts that take real care:

Persistence and sync

In the PWA, settings and presets lived in IndexedDB per user, which made the app feel instant. On the server, a Cloudflare D1 database stored accounts, sessions and premium state, and cross-device sync used a stale-while-revalidate helper: IndexedDB answered immediately, the API refreshed in the background.

The native app keeps them per user in SQLite. D1 still holds accounts, sessions and premium state, and cross-device sync is now last-writer-wins per record.

What the engine taught me

The Web Audio API is surprisingly complete for this use case — the only thing you cannot do is ignore the audio thread’s state machine. Every gain ramp, every voice start, has to be scheduled or it clicks. That discipline carried over: the same care showed up in the PWA’s API layer, where session validation was cached in Cloudflare KV with a TTL. The current Worker has dropped that cache and checks sessions in D1.

If you sing Byzantine chant, the app’s site is where to find it once it’s out of testing. If you write audio code, the moria arithmetic is the part I would steal.

Related projects