Home Manual Reference Source Test

References

summary
public
public
public

controller

summary
public

F async compose(parameters: Object, steps: Step[], hooks: Object): Promise<{ parts: Object[], labelCache: Object, midi: ?Object, failedParts: string[], solvedParts: number, } | null>

Run the 3-step composition pipeline (form, chords, notes); pure orchestration via hooks.

public

F async buildParameters(steps: Step[]): Promise<{steps: Step[], schemas: Object<string, Object[]>, parameters: Object}>

Builds the initial composition parameters (theta) for a list of steps by calling schema() on each.

public

F exportParameters(parameters: Object)

Exports the composition parameters (theta) as a JSON file download.

public

F importParameters(file: File | Blob): Promise<Object>

Reads a parameter JSON file and returns the parsed content.

public

Initialize the MiniZinc WASM engine; must run before any solveModel() call.

public

F async solveModel(modelName: string, modelString: string, solverId: string): Promise<{solution: ?Object, statistics: ?Object, status: string}>

Wrap MiniZinc's event-based solver as a Promise. Implements the solve() call from Thesis' Algorithm.

public

F generateMidi(parts: Object[], voiceConfig: {voices: number, voice: {instrument: number}[]}, tempo: number): {combinedB64: string, voicesB64: string[]}

Builds MIDI from part notes solutions N (N=1 for per-part preview, N=|parts| for full piece).

public
public

model

summary
public

F modelChords(parameters: Object, graph: Object): string

Builds the MiniZinc COP for Step 2: shortest path of fixed length over the chord graph.

public

F modelNotes(parameters: Object, time: {subdivision: number, subBeatsPerBar: number, numSubBeats: number, activeBeats: Set<number>[]}): string

Builds the MiniZinc CSP for Step 3: assigns one note per active sub-beat and voice.

public

F chordGraph(mode: 'major' | 'minor', preset: Object<string, {edges: Object<string, number>, chromatic: string[]}>): { nodes: string[], activeNodes: string[], edges: [string,string][], costs: Map<string,number>, tonic: string, }

Creates the chord digraph G = (V, E, w) for a given mode, optionally tuned by a corpus preset (pi).

public

F chordName(node: string, keyIndex: number): string

Roman-numeral display: with keyIndex returns the concrete chord name; without keyIndex returns the function-label form for UI dropdowns.

public

F noteNames(keyIndex: number): string[]

Chromatic note-name array (12 entries starting from C); flat-preferring by default (also used as MIDI key-signature labels), sharp-preferring when keyIndex (kappa) is a sharp-favouring key.

public

F timeGrid(voice: {duration: string}[], voices: number, numerator: number, bars: number): {subdivision: number, subBeatsPerBar: number, numSubBeats: number, activeBeats: Set<number>[]}

Per-part time-grid; subdivision (tau) is the LCM of voice durations.

public

Voice instruments = General MIDI Level-1 program list grouped into the 16 standard families.

public

V CHORDS: {major: Object<string, number[]>, minor: Object<string, number[]>}

Chord tones per mode (mu): pitch classes (mod 12) for each Roman-numeral.

public

V EDGES: { CADENCE: [number, {major: string, minor: string}], NORMAL: [number, {major: string, minor: string}], NC: number, LOOP: number, MISSING: number, }

Default chord-graph configuration: structural costs (LOOP, NC, MISSING) and edge tables [cost, {major, minor}].

pipeline

summary
public

Step 1: macro-structure as a sequence of parts rho_1 ...

public

Step 2: chord-progression solving as shortest path of fixed length over the weighted chord graph G = (V, E, w); emits Roman-numeral progression + SVG.

public

Step 3: per-voice pitch assignment.

public

I Step

Pipeline phase interface; subclass name "StepNSuffix" drives index/id/name.

public

Trait: adds abstract solve(parameters, solver) to a Step subclass.

view

summary
public

F downloadBlob(data: Blob | string, filename: string): string

Triggers a browser file download from a Blob or a Base64-encoded string.

public

F submitFeedback(dialog: HTMLDialogElement, midiB64: string, parameters: Object, report: Object)

Collects feedback form values, downloads the MIDI file, and opens a pre-filled mailto: link with the form data and composition parameters (theta) in the body.

public

Bundle of form-control helpers wired into the Alpine "app" data object via spread.

public

Bundle of compose-result rendering helpers wired into the Alpine "app" data object via spread.