Skip to content

Main content

Random Polyrhythm Event Grid Generator

Generate exact rational event grids for shared-cycle polyrhythms or shared-beat polymeters with delegated tempo timing.

Loading tool…

Description

Generate exact rational event grids for shared-cycle polyrhythms or shared-beat polymeters with delegated tempo timing.

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 exact rational event grids for shared-cycle polyrhythms or shared-beat polymeters with delegated tempo timing.

When to use this tool

Use this generator to create reproducible polyrhythm event grid 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 pulseCounts, mode, sharedCycleQuarterNotes, beatsPerMinute 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 mode, pulseCounts, gridTicks, cycleQuarterNotes, cycleSeconds, events. Use the conventions below and keep answer-bearing fields separate when presenting an exercise.

Draw layer pulse counts and form their least-common-multiple tick grid. Polyrhythm spreads each layer's pulses over the shared cycle; polymeter advances every layer on each shared beat, tracking its bar and pulse position. Sort events by tick then layer.1

Delegated operations used for this result: least common multiple; note value duration seconds at bpm. Their calculation or parsing conventions apply to the corresponding result fields.2, 3

Input fieldMeaning and unitsAccepted input
pulseCountsPulse CountsRequired. Array of Object; no unknown keys.; minimum items 2; maximum items 8.
pulseCounts[].minimumMinimumRequired. Safe integer; minimum 1; maximum 32.
pulseCounts[].maximumMaximumRequired. Safe integer; minimum 1; maximum 32.
modeModeRequired. Text; one of "polyrhythm", "polymeter".
sharedCycleQuarterNotesShared Cycle Quarter NotesRequired. Finite number; strictly above 0.
beatsPerMinuteBeats Per MinuteRequired. Finite number; strictly above 0.
seedOptional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed.Optional. Safe integer.
Output fieldInterpretationReturned shape
modeModeRequired. Text; one of "polyrhythm", "polymeter".
pulseCountsPulse CountsRequired. Array of Safe integer; minimum 1; maximum 32.; minimum items 2; maximum items 8.
gridTicksGrid TicksRequired. Safe integer; minimum 1; maximum 4096.
cycleQuarterNotesCycle Quarter NotesRequired. Finite number; strictly above 0.
cycleSecondsCycle SecondsRequired. Finite number; strictly above 0.
eventsEventsRequired. Array of Object; no unknown keys.; minimum items 1; maximum items 2048.
events[].layerLayerRequired. Safe integer; minimum 0; maximum 7.
events[].pulsePulseRequired. Safe integer; minimum 0; maximum 4095.
events[].barBarRequired. Safe integer; minimum 0; maximum 4095.
events[].pulseInBarPulse In BarRequired. Safe integer; minimum 0; maximum 31.
events[].tickTickRequired. Safe integer; minimum 0; maximum 4095.
events[].cycleFractionNumeratorCycle Fraction NumeratorRequired. Safe integer; minimum 0; maximum 4095.
events[].cycleFractionDenominatorCycle Fraction DenominatorRequired. Safe integer; minimum 1; maximum 4096.
events[].timeSecondsTime SecondsRequired. Finite number.
randomnessReplay metadata: source is seed or context; seed is the normalized 32-bit seed or null for a context source.Required. Object; no unknown keys.
randomness.seedOptional numeric 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": {
    "pulseCounts": [
      {
        "minimum": 3,
        "maximum": 3
      },
      {
        "minimum": 2,
        "maximum": 2
      }
    ],
    "mode": "polyrhythm",
    "sharedCycleQuarterNotes": 4,
    "beatsPerMinute": 120,
    "seed": 42
  },
  "output": {
    "mode": "polyrhythm",
    "pulseCounts": [
      3,
      2
    ],
    "gridTicks": 6,
    "cycleQuarterNotes": 4,
    "cycleSeconds": 2,
    "events": [
      {
        "layer": 0,
        "pulse": 0,
        "bar": 0,
        "pulseInBar": 0,
        "tick": 0,
        "cycleFractionNumerator": 0,
        "cycleFractionDenominator": 6,
        "timeSeconds": 0
      },
      {
        "layer": 1,
        "pulse": 0,
        "bar": 0,
        "pulseInBar": 0,
        "tick": 0,
        "cycleFractionNumerator": 0,
        "cycleFractionDenominator": 6,
        "timeSeconds": 0
      },
      {
        "layer": 0,
        "pulse": 1,
        "bar": 0,
        "pulseInBar": 1,
        "tick": 2,
        "cycleFractionNumerator": 2,
        "cycleFractionDenominator": 6,
        "timeSeconds": 0.6666666666666666
      },
      {
        "layer": 1,
        "pulse": 1,
        "bar": 0,
        "pulseInBar": 1,
        "tick": 3,
        "cycleFractionNumerator": 3,
        "cycleFractionDenominator": 6,
        "timeSeconds": 1
      },
      {
        "layer": 0,
        "pulse": 2,
        "bar": 0,
        "pulseInBar": 2,
        "tick": 4,
        "cycleFractionNumerator": 4,
        "cycleFractionDenominator": 6,
        "timeSeconds": 1.3333333333333333
      }
    ],
    "randomness": {
      "seed": 42,
      "source": "seed"
    }
  }
}

Limitations and assumptions

  • Polymeter requires sharedCycleQuarterNotes equal to one. Grid and event counts are bounded. Nominal event times use BPM and do not imply performed accents or auditory rendering.
  • A replay requires the same complete input and implementation. Randomized construction does not guarantee uniform coverage of every feasible output; finite samples can repeat unless a distinct-selection rule is explicitly stated.
  • 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 Polyrhythm Event Grid Generator — tool.io

  2. Calculation or validation: number/least-common-multiple — tool.io

  3. Calculation or validation: music/note-value-duration-seconds-at-bpm — tool.io

Similar or alternative tools

  • Random Bounded-Interval Melody Generator

    Generate a MIDI melody from an explicit starting pitch with uniform local choices including repeated notes inside a pitch range and maximum semitone step, delegating frequency and signed interval answers; not uniform over complete melodies.

  • Random Exact-Fill Rhythm Measure Generator

    Fill one supplied meter exactly in a bounded rational tick grid with reachable duration choices and independent rests, delegating tempo and tuplet seconds; choices are locally uniform, not uniform over complete measures, and tuplet engraving groups are not inferred.