Skip to content

Main content

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.

Loading tool…

Description

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.

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 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.

When to use this tool

Use this generator to create reproducible interval melody 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 count, minimumMidi, maximumMidi, startingMidi, maximumStepSemitones 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 notes, signedIntervals. Use the conventions below and keep answer-bearing fields separate when presenting an exercise.

Start from startingMidi and draw each next MIDI pitch from the allowed range intersected with the previous pitch plus or minus maximumStepSemitones. Return pitch representations and signed adjacent intervals.1

Input fieldMeaning and unitsAccepted input
countRequested count; the mechanics explain whether one draw expands into several returned records.Required. Safe integer; minimum 1; maximum 1024.
minimumMidiMinimum MidiRequired. Safe integer; minimum 0; maximum 127.
maximumMidiMaximum MidiRequired. Safe integer; minimum 0; maximum 127.
startingMidiStarting MidiRequired. Safe integer; minimum 0; maximum 127.
maximumStepSemitonesMaximum Step SemitonesRequired. Safe integer; minimum 0; 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
notesNotesRequired. Array of Object; no unknown keys.; minimum items 1; maximum items 1024.
notes[].midiMidiRequired. Safe integer; minimum 0; maximum 127.
notes[].noteNoteRequired. Text; minimum UTF-16 length 2; maximum UTF-16 length 4.
notes[].octaveOctaveRequired. Safe integer; minimum -1; maximum 9.
notes[].frequencyHzFrequency HzRequired. Finite number; strictly above 0.
signedIntervalsSigned IntervalsRequired. Array of Safe integer; minimum -127; maximum 127.; maximum items 1023.
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": {
    "count": 7,
    "minimumMidi": 60,
    "maximumMidi": 72,
    "startingMidi": 67,
    "maximumStepSemitones": 4,
    "seed": 42
  },
  "output": {
    "notes": [
      {
        "midi": 67,
        "note": "G4",
        "octave": 4,
        "frequencyHz": 391.99543598174927
      },
      {
        "midi": 68,
        "note": "G#4",
        "octave": 4,
        "frequencyHz": 415.3046975799451
      },
      {
        "midi": 68,
        "note": "G#4",
        "octave": 4,
        "frequencyHz": 415.3046975799451
      },
      {
        "midi": 71,
        "note": "B4",
        "octave": 4,
        "frequencyHz": 493.8833012561241
      },
      {
        "midi": 71,
        "note": "B4",
        "octave": 4,
        "frequencyHz": 493.8833012561241
      },
      {
        "midi": 68,
        "note": "G#4",
        "octave": 4,
        "frequencyHz": 415.3046975799451
      },
      {
        "midi": 68,
        "note": "G#4",
        "octave": 4,
        "frequencyHz": 415.3046975799451
      }
    ],
    "signedIntervals": [
      1,
      0,
      3,
      0,
      -3,
      0
    ],
    "randomness": {
      "seed": 42,
      "source": "seed"
    }
  }
}

Limitations and assumptions

  • Repeated pitches are allowed and the starting note must fit the range. Semitone limits do not enforce a key, rhythm, instrument range, or voice-leading quality.
  • 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 Bounded-Interval Melody Generator — tool.io

Similar or alternative tools

  • Random Scale-Constrained Melody Generator

    Generate exact-count independent MIDI pitches with replacement from supplied tonic-relative pitch classes and scientific octave bounds, delegating octave and A4=440 Hz frequency metadata; no rhythm, key spelling or musical-quality claim.

  • Random Polyrhythm Event Grid Generator

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