{
"id": "at.atmosynth.patch",
"defs": {
"main": {
"key": "tid",
"type": "record",
"record": {
"type": "object",
"required": [
"descriptionVersion",
"name",
"description",
"moduleInstances",
"createdAt"
],
"properties": {
"name": {
"type": "string",
"maxLength": 200,
"minLength": 1
},
"tags": {
"type": "array",
"items": {
"type": "string",
"maxLength": 128
},
"description": "Freely created tags, lower-cased on write so one hashtag matches one set of patches."
},
"tempo": {
"type": "integer",
"maximum": 300,
"minimum": 20,
"description": "The tempo this patch was written at, in beats per minute. It is what a sequenced patch counts its bars against, so a patch that plays itself arrives at the speed its creator meant. It seeds the player's own tempo rather than replacing it: how fast a visitor plays is still theirs, and moving it moves everything counting against it. Optional permanently — a patch that says nothing is played at whatever tempo the player already had."
},
"types": {
"type": "array",
"items": {
"type": "string",
"knownValues": [
"Lead",
"Pad",
"Bass",
"Plucked",
"Percussion",
"Keys",
"Brass",
"Strings",
"Vocal",
"SFX"
]
},
"description": "Zero or more of the ten fixed types. A patch may carry several."
},
"output": {
"ref": "#outputRef",
"type": "ref",
"description": "Which instance reaches the audio output."
},
"createdAt": {
"type": "string",
"format": "datetime"
},
"forkedFrom": {
"ref": "#lineage",
"type": "ref"
},
"connections": {
"type": "array",
"items": {
"ref": "#connection",
"type": "ref"
}
},
"description": {
"type": "string",
"maxLength": 3000
},
"midiRouting": {
"type": "array",
"items": {
"ref": "#midiRoute",
"type": "ref"
},
"description": "Which module instances receive MIDI input."
},
"moduleInstances": {
"type": "array",
"items": {
"ref": "#moduleInstance",
"type": "ref"
}
},
"descriptionVersion": {
"type": "integer",
"minimum": 1,
"description": "Version of the patch description this record follows."
}
}
},
"description": "A patch, held in its creator's own repository."
},
"lineage": {
"type": "object",
"required": [
"uri",
"creatorDid"
],
"properties": {
"uri": {
"type": "string",
"format": "at-uri"
},
"patchId": {
"type": "string",
"maxLength": 128
},
"creatorDid": {
"type": "string",
"format": "did"
}
},
"description": "The patch this one was forked from, and its creator. Preserved even when the source is later deleted."
},
"inputRef": {
"type": "object",
"required": [
"instanceId",
"audioInput"
],
"properties": {
"audioInput": {
"type": "string",
"maxLength": 64,
"minLength": 1
},
"instanceId": {
"type": "string",
"maxLength": 64,
"minLength": 1
}
}
},
"position": {
"type": "object",
"required": [
"x",
"y"
],
"properties": {
"x": {
"type": "integer"
},
"y": {
"type": "integer"
}
}
},
"midiRoute": {
"type": "object",
"required": [
"instanceId",
"midiInput"
],
"properties": {
"from": {
"ref": "#noteOutputRef",
"type": "ref",
"description": "The note output these notes leave. Absent where they come from the player."
},
"midiInput": {
"type": "string",
"maxLength": 64,
"minLength": 1
},
"instanceId": {
"type": "string",
"maxLength": 64,
"minLength": 1
}
},
"description": "Where one instance's notes come from. `instanceId` and `midiInput` name the MIDI input they arrive at; `from` names the note output they leave. **A route with no `from` comes from the player** — the on-screen keys, the computer keyboard and every MIDI device at once — which is what every route written before note sources existed says, and what it goes on saying."
},
"moduleRef": {
"type": "object",
"required": [
"moduleId",
"versionKey",
"authorDid"
],
"properties": {
"moduleId": {
"type": "string",
"maxLength": 128,
"minLength": 1
},
"authorDid": {
"type": "string",
"format": "did"
},
"versionKey": {
"type": "string",
"maxLength": 128,
"minLength": 1
}
},
"description": "A pin to one exact published version of a module. Resolving it fetches that record, whoever authored it."
},
"noteEvent": {
"type": "object",
"required": [
"note"
],
"properties": {
"at": {
"type": "integer",
"minimum": 0,
"description": "The tick of the loop this note is struck at, counted from its start at 96 ticks to the beat. Ticks rather than steps of the grid, because a note is at a moment and the grid is a guide over it: 96 is divided exactly by every grid this description offers, so a note keeps its moment however the grid is changed."
},
"hold": {
"type": "integer",
"minimum": 1,
"description": "How many ticks this note is held for. Counted in ticks rather than in seconds for the reason the start is: a phrase written at 90 is the same phrase, held notes and all, at 140. A note is cut off by the loop's end and by the next note of its own pitch, since the same pitch overlapping itself is one voice rather than two."
},
"note": {
"type": "integer",
"maximum": 127,
"minimum": 0,
"description": "The MIDI note number. 60 is middle C."
},
"step": {
"type": "integer",
"minimum": 0,
"description": "Which step of the grid this note is on, counted from the start of the loop. The older way of saying where a note is, read from every pattern published before a note carried a tick and written by none."
},
"length": {
"type": "integer",
"minimum": 1,
"description": "How many steps of the grid this note is held for, where its start is written as a step. Absent is one, which is what every pattern written before notes had a length says."
}
},
"description": "One note struck at one moment of the loop and held from it, at one fixed strength — a pattern is what is played and not how hard. It is written one of two ways: a note written now says the tick it is at and how many ticks it is held for, and a note written while the grid was part of what a note was says the step of that grid and how many of those steps it was held for. Both are read; the first is written."
},
"outputRef": {
"type": "object",
"required": [
"instanceId",
"audioOutput"
],
"properties": {
"instanceId": {
"type": "string",
"maxLength": 64,
"minLength": 1
},
"audioOutput": {
"type": "string",
"maxLength": 64,
"minLength": 1
}
}
},
"connection": {
"type": "object",
"required": [
"from",
"to"
],
"properties": {
"to": {
"ref": "#inputRef",
"type": "ref"
},
"from": {
"ref": "#outputRef",
"type": "ref"
}
},
"description": "An audio connection between two module instances, naming the declared ports at each end."
},
"resolution": {
"type": "object",
"required": [
"value"
],
"properties": {
"unit": {
"type": "string",
"description": "Three of them into the time of two, or not. Absent is normal. A dotted grid is not offered: it does not divide a bar evenly, so it would leave a pattern whose steps do not line up with its own loop.",
"knownValues": [
"normal",
"triplet"
]
},
"value": {
"type": "string",
"description": "The note value one step is worth. A bar is four beats.",
"knownValues": [
"bar",
"1/2",
"1/4",
"1/8",
"1/16",
"1/32",
"1/64",
"1/128"
]
}
},
"description": "One note value, as a length and what that length is multiplied by. The same vocabulary the player's own musical time is counted in."
},
"midiControl": {
"type": "object",
"required": [
"parameter",
"controller"
],
"properties": {
"parameter": {
"type": "string",
"maxLength": 64,
"minLength": 1,
"description": "The id of the exposed parameter this control moves. One parameter is moved by at most one controller; one controller may move several parameters."
},
"controller": {
"type": "integer",
"maximum": 127,
"minimum": 0,
"description": "The control change number. Five are spoken for by MIDI itself and cannot be bound: 64, the sustain pedal, and 6, 38, 100 and 101, which carry registered-parameter traffic."
}
},
"description": "One MIDI control change bound to one of the module's exposed parameters. The controller's 0 to 127 sweeps the parameter across the range the module declares, or, where the module declares a closed value set instead, across those values in order. A control is read from every input on every channel, like every other MIDI message here: there is nothing to configure."
},
"notePattern": {
"type": "object",
"required": [
"bars",
"resolution"
],
"properties": {
"bars": {
"type": "integer",
"maximum": 8,
"minimum": 1,
"description": "How long the first loop is, in bars of four beats. There is no time signature anywhere here, and 4/4 is what a bar means to everyone who has not been told otherwise. Each loop keeps its own length: one may be four bars and the next five."
},
"active": {
"type": "integer",
"minimum": 0,
"description": "Which loop is played, counting the one written here as zero. Absent is the first. It is in the record because it is what a visitor opening the patch hears — unlike stopping a loop, which is how a browser is listening and is written nowhere. Every loop counts from the same downbeat and wraps at its own length whether or not it is the one being heard, so switching between them reveals where the other had got to rather than starting it."
},
"events": {
"type": "array",
"items": {
"ref": "#noteEvent",
"type": "ref"
},
"maxLength": 2048,
"description": "The notes in the first loop. A moment carrying no note is a rest; a note starting outside the loop's length is not played."
},
"alternates": {
"type": "array",
"items": {
"ref": "#alternatePattern",
"type": "ref"
},
"maxLength": 7,
"description": "The loops after the first. Absent while the sequencer holds a single pattern, which is what every sequencer written before there could be more than one says."
},
"resolution": {
"ref": "#resolution",
"type": "ref",
"description": "The grid every loop on this sequencer is drawn and snapped to. It is a guide and not a part of what is played: it decides where a note being put down lands, and changing it moves nothing already written, so a loop may hold a note no line of the current grid passes through."
}
},
"description": "The loops one sequencer holds, and the grid they are written on. A loop is a whole number of bars and the notes in it are counted in ticks of the beat, so a pattern means the same thing at any tempo — what a tick is worth in seconds is the player's tempo's business and not the pattern's. The first loop is written here, where a pattern has always been written; any after it are alternates."
},
"noteOutputRef": {
"type": "object",
"required": [
"instanceId",
"noteOutput"
],
"properties": {
"instanceId": {
"type": "string",
"maxLength": 64,
"minLength": 1
},
"noteOutput": {
"type": "string",
"maxLength": 64,
"minLength": 1
}
}
},
"moduleInstance": {
"type": "object",
"required": [
"instanceId",
"module",
"voiceScope"
],
"properties": {
"module": {
"ref": "#moduleRef",
"type": "ref"
},
"unison": {
"type": "integer",
"maximum": 6,
"minimum": 1,
"description": "How many voices each note this instance plays is sounded by, detuned narrowly against each other and centred on the note. It lives here, in the patch, for the reason the pattern above it does: how a loop is voiced is a decision about this use of the module. The player's own unison is a setting of their browser and says nothing about this one, so a loop written thick stays thick for everyone who opens the patch. Optional permanently: an instance that says nothing plays one voice per note, which is what every record written before this field existed says."
},
"enabled": {
"type": "boolean",
"description": "Whether this instance does its work. An instance that is switched off makes no sound of its own, and anything reaching its audio inputs leaves its audio outputs unaltered. Optional permanently: an instance that says nothing is on, which is what every record written before this field existed says."
},
"position": {
"ref": "#position",
"type": "ref",
"description": "Where the creator placed this instance in the patch's arrangement, so the arrangement travels with the patch and a fork inherits it. Optional permanently, and the only field in either description that exists for presentation."
},
"instanceId": {
"type": "string",
"maxLength": 64,
"minLength": 1
},
"voiceScope": {
"enum": [
"perNote",
"perPatch"
],
"type": "string",
"description": "Whether this instance is built once for each sounding note or once for the whole patch. One of the two, always: the choice is made when the module is added, from what the module is, and is the creator's to move afterwards. There is no third value and no leaving it out — an instance that said nothing left the answer to be worked out afresh every time the patch was played, which is a decision nobody could see and nobody could change."
},
"notePattern": {
"ref": "#notePattern",
"type": "ref",
"description": "The pattern this instance loops, where its module is a sequencer. It lives here, in the patch, for the reason a sample slot fill and a control binding do: what is played is a decision about this use of the module, and writing one never touches the module's record. Absent on every instance whose module is not a note source."
},
"midiControls": {
"type": "array",
"items": {
"ref": "#midiControl",
"type": "ref"
},
"description": "Which MIDI control changes move this instance's parameters while it is played. A binding lives here, in the patch, because which knob moves what is a decision about this use of the module and not about the module."
},
"parameterValues": {
"type": "array",
"items": {
"ref": "#parameterValue",
"type": "ref"
}
},
"sampleSlotFills": {
"type": "array",
"items": {
"ref": "#sampleSlotFill",
"type": "ref"
},
"description": "Samples this instance supplies for the module's declared slots. A fill lives here, in the patch, so writing one never touches the module."
}
},
"description": "One use of one module version. A patch may use the same module more than once; each instance is separately addressable and carries its own parameter values and slot fills."
},
"parameterValue": {
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"type": "string",
"maxLength": 64,
"minLength": 1
},
"value": {
"type": "unknown",
"description": "The value this patch sets the parameter to. A number that is not a whole number is carried as its decimal string — \"0.5\", not 0.5 — because the ATproto data model has no floating-point type and a PDS refuses one. A whole number is an ordinary integer, and a reader turns such a string back into a number. Where the module declares a closed set of values instead, this is one of those strings, and a label that looks like a number stays the label it is."
},
"useDefault": {
"type": "boolean",
"description": "Set where the patch explicitly defers to the module's default rather than recording a value."
}
},
"description": "A value for one of the module's exposed parameters, or an explicit fall-back to the module's declared default."
},
"sampleSlotFill": {
"type": "object",
"required": [
"slotId",
"blob",
"ownerDid"
],
"properties": {
"blob": {
"type": "blob",
"accept": [
"audio/wav"
],
"maxSize": 2097152
},
"slotId": {
"type": "string",
"maxLength": 64,
"minLength": 1
},
"ownerDid": {
"type": "string",
"format": "did"
}
}
},
"alternatePattern": {
"type": "object",
"required": [
"bars"
],
"properties": {
"bars": {
"type": "integer",
"maximum": 8,
"minimum": 1,
"description": "How long this loop is, in bars of four beats."
},
"events": {
"type": "array",
"items": {
"ref": "#noteEvent",
"type": "ref"
},
"maxLength": 2048,
"description": "The notes in this loop."
}
},
"description": "One of the loops after the first on a sequencer. It has its own length and its own notes, and shares the grid written beside the first."
}
},
"$type": "com.atproto.lexicon.schema",
"lexicon": 1,
"description": "A synth patch: which modules it uses, how they are wired, what their parameters are set to, and how it is played. A patch plus the module records it pins is everything needed to reproduce it."
}