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:
- 72 moria per octave — a frequency factor of 2^(m/72) for m moria
- Seven notes — Νη, Πα, Βου, Γα, Δι, Κε, Ζω — on a fixed tonic (Κε = 220 Hz)
- A scale is an interval pattern; the note grid is generated by rotating that pattern across the octave
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:
- Pitch shifting in moria, not cents: coarse steps of ±6 and fine steps of ±1, up to ±36 moria total. For oscillators this is just
frequency = tonic * 2^(m/72); for samples the engine applies the same ratio at playback rate. - Envelopes that don’t click. Attack and release ramps sound trivial until you hear the pop of an unramped gain change.
- Polyphony in the premium tier — multiple voices at once, each with its own envelope and filter.
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.
