Skip to content

Main content

Random Quantized Drum Pattern Generator

Generate caller-defined percussion lanes on a fixed integer subdivision grid with Bernoulli hits, inclusive MIDI velocities, explicit rests and delegated quarter-tempo/PPQN timing; no audio, MIDI file or percussion-map assumptions.

Loading tool…

Description

Generate caller-defined percussion lanes on a fixed integer subdivision grid with Bernoulli hits, inclusive MIDI velocities, explicit rests and delegated quarter-tempo/PPQN timing; no audio, MIDI file or percussion-map assumptions.

A musical fixture expresses pitch or timing through explicit numeric conventions such as MIDI numbers, semitone intervals, beats, and durations. A reproducible symbolic sequence is separate from a performed sound or a judgment of musical quality.

Generate caller-defined percussion lanes on a fixed integer subdivision grid with Bernoulli hits, inclusive MIDI velocities, explicit rests and delegated quarter-tempo/PPQN timing; no audio, MIDI file or percussion-map assumptions.

When to use this tool

Use this generator to create reproducible drum pattern cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.

How to use the tool and how it works

  1. Supply bars, meterNumerator, meterDenominator, subdivisionsPerQuarter, pulsesPerQuarter, beatsPerMinute, lanes, minimumVelocity, maximumVelocity in the field shapes below. Set seed when you need an explicit replay.
  2. Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
  3. Read lanes, velocityGrid, hits, totalSteps, totalTicks, stepDurationSeconds, durationSeconds, microsecondsPerPulse. Use the conventions below. Keep answer-bearing fields separate when presenting an exercise.

Derive a finite step grid from meter, bars, and subdivisions. Draw each lane's hit flag and positive velocity, convert steps to ticks and nominal seconds, and return the velocity matrix plus time-ordered hits and MIDI clock timing.1

Delegated operations used for this result: midi clock us per quarter ppqn. Their calculation or parsing conventions apply to the corresponding result fields.2

Input fieldMeaning and unitsAccepted input
barsBarsRequired. Safe integer; minimum 1; maximum 16.
meterNumeratorMeter NumeratorRequired. Safe integer; minimum 1; maximum 16.
meterDenominatorMeter DenominatorRequired. Safe integer; one of 1, 2, 4, 8, 16.
subdivisionsPerQuarterSubdivisions Per QuarterRequired. Safe integer; minimum 1; maximum 24.
pulsesPerQuarterPulses Per QuarterRequired. Safe integer; minimum 1.
beatsPerMinuteBeats Per MinuteRequired. Finite number; strictly above 0.
lanesLanesRequired. Array of Object; no unknown keys.; minimum items 1; maximum items 16.
lanes[].idLiteral identifier used independently of display labels.Required. Text; minimum UTF-16 length 1; maximum UTF-16 length 64.
lanes[].midiNoteMidi NoteRequired. Safe integer; minimum 0; maximum 127.
lanes[].hitProbabilityHit ProbabilityRequired. Finite number; minimum 0; maximum 1.
minimumVelocityMinimum VelocityRequired. Safe integer; minimum 1; maximum 127.
maximumVelocityMaximum VelocityRequired. Safe integer; minimum 1; maximum 127.
seedOptional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed.Optional. Safe integer.
Output fieldInterpretationReturned shape
lanesLanesRequired. Array of Object; no unknown keys.; minimum items 1; maximum items 16.
lanes[].idLiteral identifier used independently of display labels.Required. Text; minimum UTF-16 length 1; maximum UTF-16 length 64.
lanes[].midiNoteMidi NoteRequired. Safe integer; minimum 0; maximum 127.
lanes[].hitProbabilityHit ProbabilityRequired. Finite number; minimum 0; maximum 1.
velocityGridVelocity GridRequired. Array of Array of Safe integer; minimum 0; maximum 127.; minimum items 1; maximum items 4096.; minimum items 1; maximum items 16.
hitsHitsRequired. Array of Object; no unknown keys.; maximum items 4096.
hits[].laneIdLane IdRequired. Text; minimum UTF-16 length 1; maximum UTF-16 length 64.
hits[].midiNoteMidi NoteRequired. Safe integer; minimum 0; maximum 127.
hits[].stepStepRequired. Safe integer; minimum 0; maximum 4095.
hits[].tickTickRequired. Safe integer; minimum 0.
hits[].onsetSecondsOnset SecondsRequired. Finite number; minimum 0.
hits[].velocityVelocityRequired. Safe integer; minimum 1; maximum 127.
totalStepsTotal StepsRequired. Safe integer; minimum 1; maximum 4096.
totalTicksTotal TicksRequired. Safe integer; minimum 1.
stepDurationSecondsStep Duration SecondsRequired. Finite number; strictly above 0.
durationSecondsDuration SecondsRequired. Finite number; strictly above 0.
microsecondsPerPulseMicroseconds Per PulseRequired. Finite number; strictly above 0.
randomnessReplay source and normalized 32-bit seed, or null seed for an advancing context source.Required. Object; no unknown keys.
randomness.seedOptional safe-integer replay seed; normalization and precedence are explained below.Required. Safe integer. or Null.
randomness.sourceSourceRequired. Text; one of "context", "seed".

An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.

json
{
  "input": {
    "bars": 1,
    "meterNumerator": 4,
    "meterDenominator": 4,
    "subdivisionsPerQuarter": 2,
    "pulsesPerQuarter": 24,
    "beatsPerMinute": 120,
    "lanes": [
      {
        "id": "kick",
        "midiNote": 36,
        "hitProbability": 0.6
      },
      {
        "id": "snare",
        "midiNote": 38,
        "hitProbability": 0.3
      }
    ],
    "minimumVelocity": 60,
    "maximumVelocity": 100,
    "seed": 42
  },
  "output": {
    "lanes": [
      {
        "id": "kick",
        "midiNote": 36,
        "hitProbability": 0.6
      },
      {
        "id": "snare",
        "midiNote": 38,
        "hitProbability": 0.3
      }
    ],
    "velocityGrid": [
      [
        0,
        94,
        0,
        81,
        85,
        0,
        70,
        0
      ],
      [
        0,
        0,
        80,
        0,
        0,
        79,
        0,
        84
      ]
    ],
    "hits": [
      {
        "laneId": "kick",
        "midiNote": 36,
        "step": 1,
        "tick": 12,
        "onsetSeconds": 0.25,
        "velocity": 94
      },
      {
        "laneId": "snare",
        "midiNote": 38,
        "step": 2,
        "tick": 24,
        "onsetSeconds": 0.5,
        "velocity": 80
      },
      {
        "laneId": "kick",
        "midiNote": 36,
        "step": 3,
        "tick": 36,
        "onsetSeconds": 0.75,
        "velocity": 81
      },
      {
        "laneId": "kick",
        "midiNote": 36,
        "step": 4,
        "tick": 48,
        "onsetSeconds": 1,
        "velocity": 85
      },
      {
        "laneId": "snare",
        "midiNote": 38,
        "step": 5,
        "tick": 60,
        "onsetSeconds": 1.25,
        "velocity": 79
      },
      {
        "laneId": "kick",
        "midiNote": 36,
        "step": 6,
        "tick": 72,
        "onsetSeconds": 1.5,
        "velocity": 70
      },
      {
        "laneId": "snare",
        "midiNote": 38,
        "step": 7,
        "tick": 84,
        "onsetSeconds": 1.75,
        "velocity": 84
      }
    ],
    "totalSteps": 8,
    "totalTicks": 96,
    "stepDurationSeconds": 0.25,
    "durationSeconds": 2,
    "microsecondsPerPulse": 20833.333333333332,
    "randomness": {
      "seed": 42,
      "source": "seed"
    }
  }
}

Limitations and assumptions

  • PPQN must divide cleanly by subdivisions and total steps/ticks must fit budgets. The result is symbolic data, not a MIDI file, synthesized audio, or a guarantee of rhythmic or instrumental suitability.
  • A replay requires the same complete input and implementation. The stated sampling convention applies within its eligible space. A finite draw does not exhaust all possible outputs; repeats remain possible unless a distinct-selection rule is explicit.
  • The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.

Alternative or Complementary methods

For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.

References

  1. Tool behavior and example: Random Quantized Drum Pattern Generator — tool.io

  2. Calculation or validation: music/midi-clock-us-per-quarter-ppqn — tool.io

Similar or alternative tools

  • Random Cadence Chord Progression Generator

    Sample supplied reviewed progression templates into target keys with delegated spelling-aware transposition and elementary cadence labels.

  • Sequential Pattern Mining Tool

    Mine bounded frequent ordered subsequences of single-event string sequences using prefix projection, allowing arbitrary gaps and repeated events and counting each source sequence at most once per pattern.