# Nonstop focus beats — research and implementation brief

Researched 14 October 2026. This research guided `index.html`. The
implementation uses synthesized meditation sounds only, with selectable
downloaded or procedural drum kits.

## Direction

Create continuously generated electronic beats **over meditation sounds**, with
a simple full-viewport Canvas 2D visualization. Interpret “Berlin style” here as
hypnotic techno with dub-techno space and restrained percussion. This is a
proposed aesthetic direction, not a definition of all music made in Berlin.

The meditation layer is the foundation. The beat should add a reliable pulse
without burying that foundation. Keep separate meditation and beat levels, and
make bass and pitched chord layers optional. The user selected synthesized
meditation sounds only. The page mixes this layer internally and includes it in
sound-enabled exports.

“Focus” describes the listening intention, not a demonstrated cognitive benefit.
The parameter values below are starting points to audition, not scientifically
established settings or prescriptions from the cited authors.

## What the research suggests

### Repetition needs a stable anchor

Attack's own Basic Channel-inspired production tutorial combines a quarter-note
kick, offbeat hats, syncopated chords, and filtered echoes. Its example uses 145
BPM with no swing; movement also comes from delay, so heavy shuffle is not a
requirement. This is a useful production reference, not a tempo target for our
meditation overlay.
[Basic Channel-style dub techno](https://www.attackmagazine.com/technique/beat-dissected/basic-channel-style-dub-techno/)

**Application:** preserve the kick grid while changing small supporting details.
Use a quieter, slower initial setting and let the listener increase intensity.
Avoid frequent fills, abrupt drops, cymbal crashes, and constant new melodies.

### Shape the kick before making it louder

Ableton's kick synthesis and mixing article separates attack, body, and tail.
Its engineer interview emphasizes their balance and warns that too much decay
can obscure the low end. Tuning a kick to a musical root is a choice, not a
universal requirement.
[Drop It: The Kick in Electronic Music](https://www.ableton.com/es/blog/drop-it-kick-electronic-music/)

**Application:** use a soft transient and a short, controlled body. Judge the
kick with the meditation bed playing, not only in isolation. Do not compensate
for an inaudible sub on small speakers by endlessly raising its gain.

### Harmonic restraint leaves space

A minor seventh chord adds a minor seventh to a minor triad. Inversions change
which chord tone is lowest without changing the chord's pitch classes.
[Ableton Learning Music: seventh chords](https://learningmusic.ableton.com/advanced-topics/seventh-chords.html)

**Application:** if the bed is tonal, choose its root first and audition every
pitched layer against it. A possible D-minor palette is D–F–A–C, with a bass on
D or A and upper chords spaced above the bass. This palette is an example, not
an assumption about the user's meditation sounds. With an unknown or changing
key, start with percussion only; a tuned bass can clash too. Bowls may have
inharmonic partials, so a nominal root does not guarantee compatibility.

### Let echoes carry some of the motion

Attack's chord tutorial explores oscillator/filter shaping and slow filter
modulation; its separate delay tutorial demonstrates restrained pitch
irregularity for tape-like character. These are sound-design techniques, not
requirements to emulate a particular plugin.
[Dub techno synth chords](https://www.attackmagazine.com/technique/synth-secrets/dub-techno-synth-chords/),
[Creating dub delays](https://www.attackmagazine.com/technique/tutorials/creating-dub-delays-with-standard-plugins/)

**Application:** sparse filtered stabs with dark echoes can create movement
without more notes. Keep repeats quieter than the dry event and remove low
frequencies from the effects return. Do not modulate delay time abruptly: that
also changes pitch and can create distracting artifacts.

### Percussion can be synthesized without external samples

Gordon Reid's practical snare tutorial demonstrates drum synthesis using noise
and tonal components. His cymbal tutorial discusses oscillator-based metallic
sounds and envelope/filter shaping. These original synthesis demonstrations
support a fully procedural kit, although a simple noise hat should not be sold
as an exact TR-909 emulation.
[Practical snare synthesis](https://www.soundonsound.com/techniques/practical-snare-drum-synthesis),
[Practical cymbal synthesis](https://www.soundonsound.com/techniques/practical-cymbal-synthesis)

### The background is part of the composition

Ableton's ambient collection includes both drones and processed field
recordings. Dennis DeSantis also discusses using noise and recorded environments
as musical material. A meditation bed therefore need not be another chord
progression.
[Ableton ambient collection](https://www.ableton.com/en/blog/collections/ambient/),
[Silence and Noise](https://makingmusic.ableton.com/silence-and-noise)

**Application:** let the existing bed provide atmosphere. If synthesis is
chosen, begin with gently filtered noise or a sparse drone, rather than adding
every possible ambient texture at once. Wind-like noise is an abstraction, not a
realistic nature recording.

## Proposed musical starting point

All settings in this section are our design proposals and require listening
tests.

| Parameter       | Initial proposal                                     | Reason                                       |
| --------------- | ---------------------------------------------------- | -------------------------------------------- |
| Meter           | 4/4, 16 steps per bar                                | A readable, stable rhythmic foundation       |
| Tempo           | 112 BPM; offer 90–130 BPM                            | Start gently while retaining a techno pulse  |
| Swing           | Straight by default; optional 50–56%                 | Add motion without destabilizing the kick    |
| Kit             | Kick, closed/open hat, soft rim or clap              | Enough contrast without a dense arrangement  |
| Tonal parts     | Off until compatible with the bed                    | Avoid imposing an incompatible key           |
| Pattern changes | Small changes every 8–16 bars                        | Preserve a recognizable groove               |
| Larger changes  | Gradual shifts over 32–64 bars                       | Long-form development without dramatic drops |
| Stereo          | Kick and sub centered; upper details modestly spread | Keep the low end stable                      |

At 112 BPM a quarter note is about 536 ms, a sixteenth about 134 ms, and a bar
about 2.14 seconds. Derive timing from `60 / bpm`, not rounded constants.

### First pattern to audition

Steps are numbered 1–16. `X` is an anchor, `x` a quieter hit, and `.` silence.
This is an original test pattern, not a transcription of a recording.

```text
Step        1234 5678 9012 3456
Kick        X... X... X... X...
Open hat    ..x. ..x. ..x. ..x.
Closed hat  ...x .... ...x ....
Soft rim    .... x... .... x...
```

Begin with kick and quiet hats; make the rim optional. Add only occasional ghost
hits. Keep the primary kick fixed. For optional swing, delay alternate
sixteenths within each eighth-note pair while preserving the pair's total
duration; do not swing the entire transport.

### Voice recipes

| Voice              | Proposed synthesis                                                          | Starting envelope / tone                                                                 |
| ------------------ | --------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| Kick               | Sine oscillator with downward pitch envelope; tiny optional noise transient | Roughly 125 Hz to 50 Hz in 35–60 ms; amplitude decay 160–260 ms; soften the first 2–5 ms |
| Closed hat         | Seeded noise through high-pass and gentle low-pass filters                  | 1–3 ms attack, 25–60 ms decay; high-pass around 5–7 kHz                                  |
| Open hat           | Same family, longer decay; choke on a closed hat                            | 80–160 ms decay; quieter than the kick                                                   |
| Rim / soft snare   | Short tonal body plus filtered noise                                        | Tonal component around 180–350 Hz; 50–100 ms total decay                                 |
| Optional bass      | Sine with a quiet triangle component, low-pass filtered                     | 5–12 ms attack, 100–220 ms body; short release                                           |
| Optional dub chord | Quiet saw/triangle voices, high-pass then low-pass, short envelope          | 5–15 ms attack, 150–400 ms decay; modest detuning only                                   |

Use smooth gain envelopes and stop/disconnect expired voices. Exponential ramps
need a positive floor, followed by an explicit zero/stop. Keep noise
deterministic per event and cap voice lifetimes and polyphony.

For optional bass, put a few notes between kicks before trying a dense riff. Use
gain automation triggered by the known kick events to duck bass and chord
returns, initially about 3–6 dB with 100–200 ms recovery. This is a proposed
mixing control, not a demand to pump the meditation bed. A Web Audio compressor
does not provide a separate external sidechain input like a DAW compressor.

Try a dotted-eighth echo (`0.75 * 60 / bpm`) with low wet gain, high-pass near
300 Hz, and low-pass around 2–4 kHz. Start feedback around 0.25–0.4 and impose a
conservative upper limit. Never allow uncontrolled self-oscillation.

## Mixing beats over meditation sounds

1. Establish a comfortable bed level first, then raise the beat from silence.
   Store independent gains; avoid a fixed loudness ratio for unknown material.
2. Identify whether the bed is tonal, noisy, rhythmic, or spoken. Offer
   percussion-only operation for unknown tonality; leave extra midrange space
   when speech is present.
3. Shorten the kick or remove optional bass if the bed already contains strong
   lows. If hiss, rain, or bowls compete with hats, reduce hat brightness and
   density before boosting levels.
4. Leave the bed's natural dynamics intact by default. Apply optional ducking to
   the electronic layers first; strong full-band ducking can make ambience
   audibly breathe with every kick.
5. Keep enough combined headroom for coincident peaks. Audition at matched
   loudness so “louder” does not masquerade as “better.” Check both channels,
   mono, headphones, and small speakers.
6. Fade transport and mix changes smoothly. If recordings loop, audition the
   join and use a suitable crossfade; changing background playback speed would
   also affect pitch unless separately processed.

Before implementation, resolve where mixing happens. Audio playing in another
application is not automatically part of this page's graph or exported video. If
recordings are supplied later, decide how they enter the page and export
timeline while honoring the standalone/no-runtime-fetch contract. Do not choose
or download meditation recordings on the user's behalf during this research
step.

## Nonstop composition without chaotic randomization

Use seeded decisions addressed by `(seed, part, bar, step, parameter)`. Keep
pattern choice separate from small velocity/timbre changes. Rendering more
Canvas frames must never consume musical randomness or change the composition.

Maintain a small family of compatible patterns. At a phrase boundary, change one
supporting element, keep the anchors, and retain the result for several bars.
Let filter brightness drift gradually over longer periods. Avoid cycling through
unrelated roots or replacing the whole arrangement every bar.

“Nonstop” means continuous playback until paused, not mathematical proof that no
motif ever repeats. Repetition is intentional; evolution should prevent a short,
obvious whole-track loop. Browser or operating-system suspension can still
interrupt playback and must be represented honestly in the UI.

## Web Audio and Canvas implementation implications

### Audio owns the clock

Schedule sound against `AudioContext.currentTime`. JavaScript timers should
queue upcoming events, not produce the beat directly. A short recurring timer
with a scheduling horizon is the standard approach described by Chris Wilson and
MDN. [A tale of two clocks](https://web.dev/articles/audio-scheduling),
[MDN sequencing tutorial](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Advanced_techniques)

Proposed initial live settings: check every 25 ms, schedule approximately
100–150 ms ahead, and measure underruns. Handle suspension/resume explicitly;
never replay an accumulated backlog of late drum hits. Hidden-tab behavior
requires testing; a short lookahead is not a guarantee against timer throttling.
Use `requestAnimationFrame` only for the live visualization.

Keep one live context and bounded buses. Start/resume it after a user gesture.
Disconnect voices on completion, reuse small noise buffers, and cap effects.
Apply parameter changes with ramps and commit pattern/tempo changes on a known
musical boundary. Pause, mute, and layer levels should have distinct meanings.

### Two layers, one deliberate mix

```text
drum voices + optional bass/chords -> beat gain ------+
                                                    +-> mix -> analyser
meditation source ----------------> meditation gain +             |
                                                        monitor gain -> speakers
```

Keep live monitor mute downstream of the compositional mix. Export should use
the selected beat/meditation balance independently of live monitor mute, unless
silent export is explicitly selected. Whether the meditation source can be
included depends on the source decision above; report that state visibly.

`AnalyserNode` exposes waveform and frequency data for visualization.
[MDN AnalyserNode](https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode)
For a first Canvas treatment, use one quiet waveform or 32 broad spectrum bars
plus a soft kick pulse. Smooth motion, avoid flashing, and offer reduced motion.
Place the analyser before monitor mute so visuals can continue when muted. Reuse
typed arrays and scale the drawing buffer for DPR and resizing.

### Plan offline sound before writing the live engine

`OfflineAudioContext` renders a graph into an audio buffer instead of the
speakers. It does not automatically preserve the state of a previous context.
[MDN OfflineAudioContext](https://developer.mozilla.org/en-US/docs/Web/API/OfflineAudioContext)

Use the same deterministic event planner for live and offline synthesis. Bounded
export chunks must account for notes crossing boundaries, noise position,
oscillator phase, and delay/reverb history. Do not simply restart each chunk's
graph. Choose explicit stateful DSP or a documented finite-tail/pre-roll design
and compare boundaries against a continuous reference. Infinite-feedback effects
cannot be reproduced exactly by an arbitrarily short pre-roll.

The repository's full export contract remains applicable: frame-by-frame
WebCodecs video, chunked audio, interleaving, bounded queues, disk backpressure,
honest codec support, stop/save, and cancel. This research does not establish
that export works or that an hour-long render has been tested.

## Implementation and listening acceptance checklist

- First audition: sparse beat over the actual chosen meditation bed. Adjust
  transient hardness, low-end overlap, and hat brightness before adding voices.
- Compare several seeds at matched volume over at least 10–15 minutes. Confirm
  that variation is audible but not constantly attention-seeking.
- Verify tonal compatibility with drones/bowls and intelligibility if speech is
  present. Test percussion-only and bed-only settings.
- Check clicks, clipping, excessive stereo cancellation, and disappearing bass
  on small speakers. Log peaks/RMS and inspect decoded audio, not just UI
  meters.
- Test pause/resume, mute, reseed, tempo changes, tab hiding, and device
  interruption. Confirm there is no catch-up burst or steadily growing graph.
- Verify desktop/mobile layout and a quiet, responsive Canvas visualization.
- For export, verify non-silent decoded sound while live playback is muted,
  chunk-boundary continuity, exact frame count/timing, stop/save, cancellation,
  and a deliberately slowed output sink. Separate short 4K/60 tests from an
  actual one-hour endurance test.
- Only after the page exists and passes browser review, render its real
  `thumnail.png` and register it in the catalog.

Implementation decision: synthesize the meditation source inside the page and
export the combined mix. Downloaded drum kits remain selectable alongside the
procedural kits; their provenance is documented in `sounds/README.md`.
