The generation model

A copy-and-edit Transformer that starts from your own bar and changes the right hits, then a post-processing chain that keeps it musical.

Architecture

Once your pattern is on the grid (either drawn, MIDI-loaded, or transcribed from audio), the generator takes over. CedarGrooveNET v3.2 is a copy-and-edit Transformer: instead of writing every bar from scratch, it starts from your own last bar and learns which hits to change. Left untrained, it would simply repeat your bar, so everything it learns is added on top of a groove that already works.

  • The model reads the last four bars (64 steps) with attention: each step can look at every other step, so it sees how your kick, snare and hats line up across the whole loop.
  • It writes one bar (16 steps) per pass. A copy path carries your hits forward and an edit path decides where to add, move or drop a hit. Longer continuations go bar by bar and re-read your original loop every 4 bars, so a 16-bar take keeps your groove instead of drifting away from it.
  • A placement head learned where drummers put fills and variations inside a four-bar phrase. At each bar it decides whether this is the moment to break from the groove and how far, so fills land where a drummer would play them instead of at random.
  • Drum & Bass, House, Techno, Rock and Jazz are learned genres: the genre goes into the model itself and shapes every bar it writes. The other four genres run the model in its general mode and add their hand-authored genre rules on top.
  • Each step is represented as 24 features: 11 hit presence flags (one per drum class), 11 velocity values (normalized 0-1), and 2 positional encodings (bar position and beat index) that help the model understand where it is in the musical measure.
  • The output is 22 values per step: 11 hit scores (how likely each drum is to trigger) and 11 velocity predictions (how hard each drum should be hit).

Training

The model was trained on a large corpus of drum patterns spanning many genres and styles. It learned the relationships between instruments — how kick patterns relate to snare placement, how hi-hat density affects the overall groove feel, how toms and crashes are used to create fills and signal transitions between sections — and, above all, which changes to a bar sound musical and which do not.

The model uses the ONNX (Open Neural Network Exchange) format for efficient cross-platform inference. At about 9 MB, it is small enough for real-time generation with near-instantaneous response times.

Decoding and post-processing

The raw model output goes through a multi-stage pipeline before becoming the final pattern you see on the grid:

  1. Temperature: Scales how freely the model picks between likely and less likely hits. Lower keeps the safest take; higher lets more surprising hits through.
  2. Density: The centre of the knob keeps your loop's own number of hits per bar, separately for kick, snare and toms, and hats and cymbals. Lower thins the continuation, higher fills it in.
  3. Variation: Scales the placement head. At 0 the model stays close to your groove, at 1 (the default) it places fills and variations itself, and up to 1.5 it plays more of them. Fill asks for a fill on the first new bar, after which the model carries on by itself.
  4. Candidates: Each bar is drawn four times and the most likely draft that keeps your loop's density wins; in a fill bar, the drafts first pass a screen of what idiomatic fills in that genre look like.
  5. Anchor Strength: The model reinforces drums that were present in your input pattern and suppresses those that were not. This prevents it from "hallucinating" instruments you did not include — if your input only uses kick, snare, and hi-hat, the continuation will respect that palette. A fill bar is the exception: it may bring in a tom run or a crash.
  6. Input Class Filtering: Any drum class not present in your input is filtered out of the generation, ensuring clean, focused output, except in a fill bar.
  7. Genre Constraints: For the genres the model has not learned, hand-authored step-weight grids and rules shape where kicks and snares fall in that genre's patterns.
  8. Style preset blending: A selected sub-style, in any genre, injects its characteristic pattern tendencies and velocity ranges, guiding the generation toward a particular sound.
  9. Humanize: Random timing and velocity jitter is applied to the final output for a more natural, human feel. The amount is controllable from subtle to pronounced.

Inference

Inference runs on ONNX Runtime, the industry-standard engine for deploying machine learning models. The session is configured for single-threaded execution for consistent, predictable performance. Tensor shapes are discovered dynamically from the model at load time, meaning the system automatically adapts to future model upgrades without code changes.

Generation is near-instantaneous — typically completing in under 100 milliseconds. This makes it practical to experiment freely, generating and regenerating patterns until you find the perfect groove.