# Melody — Randomly

> Random walk, Markov, or the 1/f kind that sounds written — on a scale that cannot clash. One of 63 generators at [Randomly](https://randomly.cluxnei.dev), a library of random generators seeded from verifiable real-world entropy. Free HTTP API, no key, no signup.

## `audio.melody` — Melody

Random walk, Markov, or the 1/f kind that sounds written — on a scale that cannot clash.

| | |
|---|---|
| **Key** | `audio.melody` |
| **Module** | `audio` |
| **Version** | `1` — a permalink carries this, and a replay against a different version returns `409` rather than something else |
| **Formats** | `application/json`, `text/plain`, `audio/wav` |
| **Studio** | https://randomly.cluxnei.dev/g/audio/melody |
| **API** | `GET https://randomly.cluxnei.dev/api/v1/g/audio.melody` |

`value` is a **score** — events, envelopes and synthesis parameters — not samples. Ask for `format=wav` to get the audio.

| Parameter | Type | Default | Accepts | What it does |
|---|---|---|---|---|
| `scale` | enum | `pentatonic_major` | `pentatonic_major`, `pentatonic_minor`, `major`, `minor`, `dorian`, `phrygian`, `lydian`, `mixolydian`, `blues`, `whole_tone`, `hirajoshi` | Scale — The one control that decides whether random notes sound musical. Pentatonic has no semitone in it to clash with. |
| `root` | enum | `C` | `C`, `C#`, `D`, `D#`, `E`, `F`, `F#`, `G`, `G#`, `A`, `A#`, `B` | Root |
| `octave` | int | `4` | `2` – `5` | Octave — Octave 4 is middle C. |
| `range` | int | `2` | `1` – `3` | Range (octaves) |
| `method` | enum | `walk` | `walk`, `uniform`, `markov`, `voss` | Method — Switch between these on the same seed. Uniform is aimless, the walk has contour, Markov has phrasing, 1/f sits where real music sits. |
| `order` | int | `2` | `1` – `2` | Markov order — Only used by the Markov method. Order 1 is a word salad of intervals; order 2 starts quoting whole phrases. |
| `bars` | int | `8` | `1` – `16` | Bars |
| `tempo` | float | `100` | `50` – `180` | Tempo (BPM) |
| `rate` | enum | `1` | `0.5`, `1`, `2`, `4` | Note length |
| `rests` | float | `0.15` | `0` – `0.5` | Rests — How often a note is left out. A melody with no silence in it has no phrases in it. |
| `engine` | enum | `fm` | `fm`, `additive`, `subtractive`, `sine` | Engine |
| `volume` | float | `-12` | `-36` – `0` | Volume (dBFS) — Where the mix sits before the master limiter. 0 dBFS is full scale; everything starts 12 dB below it. |

Out-of-range numbers are **clamped, not rejected**, so a request never fails for being
ambitious — but it may not do what you meant. Unknown keys are dropped and missing ones
fall back to the defaults above.

```bash
curl -s 'https://randomly.cluxnei.dev/api/v1/g/audio.melody?scale=pentatonic_major&root=C&octave=4' -H 'Accept: text/plain'
curl -o out.wav 'https://randomly.cluxnei.dev/api/v1/g/audio.melody?scale=pentatonic_major&root=C&octave=4&format=wav'
```

## The receipt

Every result carries one, naming the physical source of the randomness and linking to the
third party's own record of it:

```json
"receipt": {
  "source": "seismic",
  "source_label": "USGS Seismic Feed",
  "class": "C",
  "caveat": "Carries only tens of bits of genuine surprise. Always mixed with the OS CSPRNG.",
  "narrative": "A magnitude 3.6 earthquake, 67 km N of Culebra, Puerto Rico, 39.6 km down — 52 minutes ago.",
  "proof_url": "https://earthquake.usgs.gov/earthquakes/eventpage/us7000th33",
  "mixed_with_csprng": true,
  "degraded": false
}
```

Pick the source with `?source=`, or leave it at the default `auto`:

- **Class A** (Cryptographic) — `csprng`, `anu-qrng`, `random-org`
- **Class B** (Public beacon) — `nist-beacon`, `drand`, `bitcoin`. Published openly — anyone can look this value up after the fact.
- **Class C** (Observational) — `seismic`, `space-weather`, `atmosphere`, `iss`. Carries only tens of bits of genuine surprise. Always mixed with the OS CSPRNG.

## More

- [The full API contract](https://randomly.cluxnei.dev/api.md)
- [Everything in one file](https://randomly.cluxnei.dev/llms-full.txt)
- [The catalogue as JSON](https://randomly.cluxnei.dev/api/v1/generators)
- [This generator in the browser](https://randomly.cluxnei.dev/g/audio/melody)
