@webgamekit/strudel-flow 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +661 -0
  2. package/dist/arrangeGrid.d.ts +58 -0
  3. package/dist/callArguments.d.ts +15 -0
  4. package/dist/chordSymbols.d.ts +15 -0
  5. package/dist/chords.d.ts +42 -0
  6. package/dist/codeScanner.d.ts +54 -0
  7. package/dist/compileStrudelFlow.d.ts +27 -0
  8. package/dist/components/notation/notationContextKey.d.ts +4 -0
  9. package/dist/components/overlayTargetKey.d.ts +3 -0
  10. package/dist/components/previewSoundKey.d.ts +3 -0
  11. package/dist/components/sampleFamilyIcons.d.ts +6 -0
  12. package/dist/components/visualizerWidgetIdsKey.d.ts +3 -0
  13. package/dist/config.d.ts +323 -0
  14. package/dist/connections.d.ts +29 -0
  15. package/dist/defaultPatch.d.ts +7 -0
  16. package/dist/envelopeShape.d.ts +13 -0
  17. package/dist/fretPlacement.d.ts +9 -0
  18. package/dist/index.d.ts +50 -0
  19. package/dist/index.js +6351 -0
  20. package/dist/index.umd.cjs +21 -0
  21. package/dist/layout.d.ts +30 -0
  22. package/dist/nodeCodeRange.d.ts +36 -0
  23. package/dist/nodeDefaults.d.ts +56 -0
  24. package/dist/nodeDefinitions.d.ts +9 -0
  25. package/dist/nodePatterns.d.ts +23 -0
  26. package/dist/notationPick.d.ts +22 -0
  27. package/dist/notationSequence.d.ts +15 -0
  28. package/dist/noteGrid.d.ts +45 -0
  29. package/dist/noteValues.d.ts +26 -0
  30. package/dist/parseStrudelFlowCode.d.ts +20 -0
  31. package/dist/patchStorage.d.ts +9 -0
  32. package/dist/patternVariables.d.ts +25 -0
  33. package/dist/readStoredValue.d.ts +32 -0
  34. package/dist/readStrudelFlowNodeData.d.ts +15 -0
  35. package/dist/sampleFamilies.d.ts +10 -0
  36. package/dist/sampleSequence.d.ts +14 -0
  37. package/dist/sheetLayout.d.ts +11 -0
  38. package/dist/solo.d.ts +23 -0
  39. package/dist/storage.d.ts +12 -0
  40. package/dist/structSteps.d.ts +12 -0
  41. package/dist/style.css +1 -0
  42. package/dist/tabLayout.d.ts +11 -0
  43. package/dist/tempo.d.ts +12 -0
  44. package/dist/types.d.ts +461 -0
  45. package/dist/useStrudelFlow.d.ts +8 -0
  46. package/package.json +43 -3
  47. package/README.md +0 -3
@@ -0,0 +1,58 @@
1
+ import type { StrudelFlowNode } from './types';
2
+ /** A cycle that plays no part. */
3
+ export declare const STRUDEL_FLOW_ARRANGE_SILENT = -1;
4
+ /**
5
+ * Whether a section of an arrange call plays nothing.
6
+ * @param pattern - a section's pattern code
7
+ * @returns true for `silence`, `~` or an empty pattern
8
+ */
9
+ export declare const isStrudelFlowArrangeSilent: (pattern: string) => boolean;
10
+ /**
11
+ * Reads the sections of an arrange call as a part for every cycle.
12
+ * @param sections - each section's cycle count and pattern code
13
+ * @returns the parts in order of first appearance, and for each cycle the part that plays
14
+ */
15
+ export declare const readStrudelFlowArrangeSequence: (sections: {
16
+ cycles: number;
17
+ pattern: string;
18
+ }[]) => {
19
+ parts: string[];
20
+ sequence: number[];
21
+ };
22
+ /**
23
+ * Joins runs of cycles that play the same part into sections.
24
+ * @param sequence - the part playing in each cycle
25
+ * @returns the fewest sections that play the same cycles
26
+ */
27
+ export declare const compressStrudelFlowArrange: (sequence: number[]) => {
28
+ cycles: number;
29
+ part: number;
30
+ }[];
31
+ /**
32
+ * Plays a part in a cycle, or stops it when it already plays there.
33
+ * @param sequence - the part playing in each cycle
34
+ * @param part - the part to switch
35
+ * @param cycle - the cycle to switch it in
36
+ * @returns the sequence with that cycle changed
37
+ */
38
+ export declare const toggleStrudelFlowArrangeCycle: (sequence: number[], part: number, cycle: number) => number[];
39
+ /**
40
+ * Gives an arrangement more or fewer cycles.
41
+ * @param sequence - the part playing in each cycle
42
+ * @param length - how many cycles it should span
43
+ * @returns the sequence cut at that length, or padded with silent cycles
44
+ */
45
+ export declare const resizeStrudelFlowArrange: (sequence: number[], length: number) => number[];
46
+ /**
47
+ * Writes an arrangement as an `arrange(...)` call.
48
+ * @param sequence - the part playing in each cycle
49
+ * @param partPatterns - the code of each part, in cable order
50
+ * @returns the call, or `silence` when no cycle plays a part that exists
51
+ */
52
+ export declare const writeStrudelFlowArrange: (sequence: number[], partPatterns: string[]) => string;
53
+ /**
54
+ * Puts the nodes feeding an arrangement in part order: top to bottom, then left to right.
55
+ * @param sources - the nodes cabled into the Arrange node
56
+ * @returns the same nodes, one per part
57
+ */
58
+ export declare const orderStrudelFlowArrangeParts: (sources: StrudelFlowNode[]) => StrudelFlowNode[];
@@ -0,0 +1,15 @@
1
+ import type { StrudelFlowCall, StrudelFlowCallField } from './types';
2
+ /**
3
+ * Reads a call's argument into the controls its node shows, such as a chance slider and the
4
+ * function for `sometimesBy`, or a step per cycle for `mask("<1 1 1 0>")`.
5
+ * @param call - the call as written in the code
6
+ * @returns one field per argument, or null when the call has no controls or its argument is
7
+ * something they cannot show, so it stays editable as text
8
+ */
9
+ export declare const readStrudelFlowCallFields: (call: StrudelFlowCall) => StrudelFlowCallField[] | null;
10
+ /**
11
+ * Writes controls back as a call argument.
12
+ * @param fields - the fields `readStrudelFlowCallFields` read, with their new values
13
+ * @returns the argument, such as `0.2, (x) => x.ply(2)`
14
+ */
15
+ export declare const writeStrudelFlowCallFields: (fields: StrudelFlowCallField[]) => string;
@@ -0,0 +1,15 @@
1
+ import type { StrudelFlowChordsData } from './types';
2
+ /**
3
+ * Reads `<C Am F G>` into a Chords node, in the key whose tonic opens the progression when
4
+ * more than one key holds every chord.
5
+ * @param pattern - the mini notation inside `chord("...")`
6
+ * @returns the Chords node, or null when a symbol is not a plain major, minor or diminished
7
+ * triad, the chords share no key, or the pattern is not one chord per cycle
8
+ */
9
+ export declare const readStrudelFlowChordSymbols: (pattern: string) => StrudelFlowChordsData | null;
10
+ /**
11
+ * Writes a Chords node as the chord symbols of `chord("<...>")`.
12
+ * @param data - the node's key, scale, progression and rests
13
+ * @returns the pattern, such as `<C Am F G>`
14
+ */
15
+ export declare const writeStrudelFlowChordSymbols: (data: StrudelFlowChordsData) => string;
@@ -0,0 +1,42 @@
1
+ import type { StrudelFlowChordsData } from './types';
2
+ export declare const MAJOR_SCALE: number[];
3
+ export declare const MINOR_SCALE: number[];
4
+ export declare const STRUDEL_FLOW_CHORD_PRESETS: readonly [{
5
+ readonly label: "Home";
6
+ readonly steps: readonly [0, 5, 3, 4];
7
+ }, {
8
+ readonly label: "Turnaround";
9
+ readonly steps: readonly [1, 4, 0, 0];
10
+ }, {
11
+ readonly label: "Descending";
12
+ readonly steps: readonly [0, 6, 5, 4];
13
+ }];
14
+ /**
15
+ * The root degrees a progression plays, derived from its first notes when hand-edited.
16
+ * @param data - the chord node's progression or hand-edited notes
17
+ * @returns one root scale degree per progression step
18
+ */
19
+ export declare const getStrudelFlowChordProgression: (data: StrudelFlowChordsData) => number[];
20
+ /**
21
+ * The notes each progression step plays.
22
+ * @param data - the chord node's progression or hand-edited notes
23
+ * @returns the chord notes as scale degrees
24
+ */
25
+ export declare const getStrudelFlowChordNotes: (data: StrudelFlowChordsData) => number[][];
26
+ /**
27
+ * Names for the chord cards, editor degrees and preset previews.
28
+ * @param data - the chord node's key, octave, scale and hand-edited notes
29
+ * @returns the Roman numerals, note names and chord names the UI prints
30
+ */
31
+ export declare const getStrudelFlowChordLabels: (data: StrudelFlowChordsData) => {
32
+ degrees: string[];
33
+ noteName: (degree: number) => string;
34
+ noteLabel: (note: number) => string;
35
+ chordName: (degree: number) => string;
36
+ };
37
+ /**
38
+ * A fresh copy of a chord, safe to edit without changing the previous step.
39
+ * @param notes - the chord's scale degrees
40
+ * @returns a new array with the same notes
41
+ */
42
+ export declare const copyStrudelFlowChord: (notes: number[]) => number[];
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Splits code at a separator that sits outside every string, bracket and call.
3
+ * @param value - the code to split
4
+ * @param separator - the single character to split at
5
+ * @returns the trimmed, non-empty parts in order
6
+ */
7
+ export declare const splitTopLevel: (value: string, separator: string) => string[];
8
+ /**
9
+ * Removes `//` line comments while leaving `//` inside strings, such as sample URLs, alone.
10
+ * @param code - the code to clean
11
+ * @returns the code without line comments
12
+ */
13
+ export declare const stripLineComments: (code: string) => string;
14
+ /**
15
+ * Splits a program into top-level statements: at a `;`, or at a line break that does not
16
+ * continue the expression, as a chain does when its next line starts with `.`.
17
+ * @param code - the program, without comments
18
+ * @returns the statements in order
19
+ */
20
+ export declare const splitStatements: (code: string) => string[];
21
+ /**
22
+ * Whether code parses as JavaScript, the same check Strudel's evaluation starts with. The code
23
+ * is compiled into an async function body, so top-level `await` passes, and never run.
24
+ * @param code - the program
25
+ * @returns true when it has no syntax error
26
+ */
27
+ export declare const isStrudelCodeSyntaxValid: (code: string) => boolean;
28
+ /**
29
+ * Whether one pair of parentheses encloses the whole expression, as in `(a + b)` but not in
30
+ * `(a)(b)`, so it can be unwrapped safely.
31
+ * @param expression - the trimmed expression
32
+ * @returns true when the first parenthesis closes on the last character
33
+ */
34
+ export declare const isWrappedInParentheses: (expression: string) => boolean;
35
+ /**
36
+ * Splits mini notation at a separator outside every bracket, which `splitTopLevel` cannot do
37
+ * since `<` is a comparison in code but an alternation here.
38
+ * @param text - the mini notation to split
39
+ * @param isSeparator - whether a character separates parts
40
+ * @returns the trimmed, non-empty parts in order
41
+ */
42
+ export declare const splitMiniNotation: (text: string, isSeparator: (character: string) => boolean) => string[];
43
+ /**
44
+ * Whether a piece of code is one quoted string.
45
+ * @param value - the code
46
+ * @returns true for `"..."`, `'...'` or a template string
47
+ */
48
+ export declare const isStringLiteral: (value: string) => boolean;
49
+ /**
50
+ * Reads the text a quoted string holds.
51
+ * @param literal - a quoted string, as `isStringLiteral` accepts
52
+ * @returns the string's content without its quotes
53
+ */
54
+ export declare const readStringLiteral: (literal: string) => string;
@@ -0,0 +1,27 @@
1
+ import type { StrudelFlowCompilation, StrudelFlowEdge, StrudelFlowNode, StrudelFlowPatch } from './types';
2
+ /**
3
+ * Turns a flow patch into one Strudel program: a tempo, the setup statements, then one `$:` block per connected
4
+ * component. A component stacks its instruments; each one passes only through the effects
5
+ * downstream of it, and the effects every instrument shares are chained once after the stack.
6
+ * @param patch - the nodes, edges and tempo to compile
7
+ * @returns the program, or the reason it cannot be played
8
+ */
9
+ export declare const compileStrudelFlow: (patch: StrudelFlowPatch) => StrudelFlowCompilation;
10
+ /**
11
+ * The canvas each inline visual such as `._scope()` draws on, which Strudel names after the
12
+ * call and how many calls of that visual come before it in the code.
13
+ * ponytail: a `_scope()` written inside a Code node shifts the count; read the transpiler's
14
+ * widget positions instead if that case ever matters.
15
+ * @param nodes - the patch's nodes
16
+ * @param edges - the patch's cables
17
+ * @returns the canvas element id for every inline Visualizer node that makes it into the code
18
+ */
19
+ export declare const getStrudelFlowVisualizerWidgetIds: (nodes: StrudelFlowNode[], edges: StrudelFlowEdge[]) => Record<string, string>;
20
+ /**
21
+ * The nodes in the order their code appears in the compiled program: each block's instruments,
22
+ * each followed by the effects only it passes through, then the effects the block shares.
23
+ * @param nodes - the patch's nodes
24
+ * @param edges - the patch's cables
25
+ * @returns node ids in code order; a node that writes no code is left out
26
+ */
27
+ export declare const getStrudelFlowCodeOrder: (nodes: StrudelFlowNode[], edges: StrudelFlowEdge[]) => string[];
@@ -0,0 +1,4 @@
1
+ import type { ComputedRef, InjectionKey } from 'vue';
2
+ import type { StrudelFlowNotationContext } from '../../types';
3
+ /** The note reader, cycle length and sound lookup the editor hands its Notes nodes. */
4
+ export declare const STRUDEL_FLOW_NOTATION_CONTEXT: InjectionKey<ComputedRef<StrudelFlowNotationContext>>;
@@ -0,0 +1,3 @@
1
+ import type { InjectionKey, Ref } from 'vue';
2
+ /** The element a popover such as the sample picker draws into, outside the zoomed canvas. */
3
+ export declare const STRUDEL_FLOW_OVERLAY_TARGET: InjectionKey<Ref<HTMLElement | null>>;
@@ -0,0 +1,3 @@
1
+ import type { InjectionKey } from 'vue';
2
+ /** Plays a sound by its registered name, so a picker can let the user hear what they pick. */
3
+ export declare const STRUDEL_FLOW_PREVIEW_SOUND: InjectionKey<(soundName: string) => void>;
@@ -0,0 +1,6 @@
1
+ import type { Component } from 'vue';
2
+ import type { StrudelFlowSampleModifierKind } from '../types';
3
+ /** The icon each sample family shows in the picker and on a Samples step. */
4
+ export declare const STRUDEL_FLOW_SAMPLE_FAMILY_ICONS: Record<string, Component>;
5
+ /** The icon beside a Samples step's modifier, so its effect reads at a glance. */
6
+ export declare const STRUDEL_FLOW_SAMPLE_MODIFIER_ICONS: Record<StrudelFlowSampleModifierKind, Component>;
@@ -0,0 +1,3 @@
1
+ import type { ComputedRef, InjectionKey } from 'vue';
2
+ /** The canvas id each inline Visualizer node's visual draws on, keyed by node id. */
3
+ export declare const STRUDEL_FLOW_VISUALIZER_WIDGET_IDS: InjectionKey<ComputedRef<Record<string, string>>>;
@@ -0,0 +1,323 @@
1
+ import type { StrudelFlowCallParameter, StrudelFlowNotation, StrudelFlowNotationView, StrudelFlowSampleFamily, StrudelFlowVisualName } from './types';
2
+ export declare const STRUDEL_FLOW_PATCH_STORAGE_KEY = "strudel-flow-patch";
3
+ /** The editor this package follows: its node set, controls, layout and look. */
4
+ export declare const STRUDEL_FLOW_REFERENCE: {
5
+ name: string;
6
+ url: string;
7
+ author: string;
8
+ authorUrl: string;
9
+ sourceUrl: string;
10
+ license: string;
11
+ };
12
+ export declare const STRUDEL_FLOW_DEFAULT_BEATS_PER_MINUTE = 120;
13
+ export declare const STRUDEL_FLOW_MIN_BEATS_PER_MINUTE = 1;
14
+ export declare const STRUDEL_FLOW_MAX_BEATS_PER_MINUTE = 300;
15
+ export declare const STRUDEL_FLOW_DEFAULT_BEATS_PER_CYCLE = 4;
16
+ export declare const STRUDEL_FLOW_BEATS_PER_CYCLE_OPTIONS: {
17
+ value: string;
18
+ label: string;
19
+ }[];
20
+ export declare const STRUDEL_FLOW_STEP_COUNT = 16;
21
+ export declare const STRUDEL_FLOW_PAD_STEP_COUNT = 16;
22
+ export declare const STRUDEL_FLOW_PAD_NOTE_COUNT = 8;
23
+ /** Where a newly added node lands, in graph coordinates, two to a row. */
24
+ export declare const STRUDEL_FLOW_NODE_START_X = 80;
25
+ export declare const STRUDEL_FLOW_NODE_START_Y = 120;
26
+ export declare const STRUDEL_FLOW_NODE_COLUMN_GAP = 480;
27
+ export declare const STRUDEL_FLOW_NODE_ROW_GAP = 360;
28
+ export declare const STRUDEL_FLOW_NODE_COLUMNS = 2;
29
+ export declare const STRUDEL_FLOW_MAX_NODE_COORDINATE = 100000;
30
+ export declare const STRUDEL_FLOW_MIN_FILTER_CUTOFF = 20;
31
+ export declare const STRUDEL_FLOW_MAX_FILTER_CUTOFF = 20000;
32
+ export declare const STRUDEL_FLOW_MIN_FILTER_RESONANCE = 0.1;
33
+ export declare const STRUDEL_FLOW_MAX_FILTER_RESONANCE = 20;
34
+ export declare const STRUDEL_FLOW_MAX_ROOM_SIZE = 20;
35
+ export declare const STRUDEL_FLOW_VISUAL_OPTIONS: {
36
+ value: StrudelFlowVisualName;
37
+ label: string;
38
+ }[];
39
+ export declare const STRUDEL_FLOW_VISUAL_PLACEMENT_OPTIONS: {
40
+ value: string;
41
+ label: string;
42
+ }[];
43
+ export declare const STRUDEL_FLOW_EDITOR_MODE_OPTIONS: {
44
+ value: string;
45
+ label: string;
46
+ }[];
47
+ export declare const STRUDEL_FLOW_SOUND_OPTIONS: {
48
+ value: string;
49
+ label: string;
50
+ }[];
51
+ export declare const STRUDEL_FLOW_KEY_OPTIONS: {
52
+ value: string;
53
+ label: string;
54
+ }[];
55
+ export declare const STRUDEL_FLOW_SCALE_OPTIONS: {
56
+ value: string;
57
+ label: string;
58
+ }[];
59
+ export declare const STRUDEL_FLOW_CHORD_SCALE_OPTIONS: {
60
+ value: string;
61
+ label: string;
62
+ }[];
63
+ export declare const STRUDEL_FLOW_PAD_MODIFIER_OPTIONS: {
64
+ value: string;
65
+ label: string;
66
+ }[];
67
+ export declare const STRUDEL_FLOW_MAX_DRUM_ROWS = 8;
68
+ /** The most cycles one arrangement can span. */
69
+ export declare const STRUDEL_FLOW_MAX_ARRANGE_CYCLES = 128;
70
+ /** The most parts one arrangement can switch between. */
71
+ export declare const STRUDEL_FLOW_MAX_ARRANGE_PARTS = 64;
72
+ /** The Notes grid's resolution: two steps to a beat is an eighth note. */
73
+ export declare const STRUDEL_FLOW_NOTE_GRID_STEPS_PER_BEAT = 2;
74
+ /** The most bars the Notes grid can hold. */
75
+ export declare const STRUDEL_FLOW_MAX_NOTE_GRID_BARS = 128;
76
+ export declare const STRUDEL_FLOW_DEFAULT_BEATS_STEPS = 16;
77
+ /** The starter beat: four on the floor, a backbeat snare and eighth-note hats. */
78
+ export declare const STRUDEL_FLOW_DRUM_ROWS: {
79
+ sound: string;
80
+ hits: number[];
81
+ }[];
82
+ /** Sounds a new track takes, in order, skipping any the node already uses. */
83
+ export declare const STRUDEL_FLOW_NEW_DRUM_SOUNDS: string[];
84
+ /** Drum and percussion banks from the dirt-samples kit the editor loads, by family. */
85
+ export declare const STRUDEL_FLOW_DRUM_SOUND_GROUPS: {
86
+ label: string;
87
+ sounds: string[];
88
+ }[];
89
+ /**
90
+ * Strudel names the canvas of an inline visual `<evaluation id>_widget_<call>_<index>`. The
91
+ * editor evaluates without an id, so the name starts at the underscore.
92
+ */
93
+ export declare const STRUDEL_FLOW_WIDGET_ID_PREFIX = "_widget_";
94
+ /** Background canvas id that Strudel's `getDrawContext()` paints behind-the-code visuals on. */
95
+ export declare const STRUDEL_FLOW_BACKGROUND_CANVAS_ID = "test-canvas";
96
+ /** The calls a node shows controls for, one entry per argument; any other call stays text. */
97
+ export declare const STRUDEL_FLOW_CALL_PARAMETERS: Record<string, StrudelFlowCallParameter[]>;
98
+ /** MIDI note of each open string, from the top staff line (the highest string) down. */
99
+ export declare const STRUDEL_FLOW_OPEN_STRINGS: {
100
+ bass: number[];
101
+ guitar: number[];
102
+ };
103
+ export declare const STRUDEL_FLOW_MAX_FRET = 24;
104
+ /** The most frets one hand covers, so a chord stays playable. */
105
+ export declare const STRUDEL_FLOW_CHORD_FRET_SPAN = 4;
106
+ export declare const STRUDEL_FLOW_NOTATION_OPTIONS: {
107
+ value: StrudelFlowNotation;
108
+ label: string;
109
+ }[];
110
+ /** Auto's choice: the first entry whose word is in the sound's name wins; anything else is names. */
111
+ export declare const STRUDEL_FLOW_NOTATION_BY_SOUND: {
112
+ word: string;
113
+ view: StrudelFlowNotationView;
114
+ }[];
115
+ /** The tab staff's drawing unit: the gap between two staff lines. */
116
+ export declare const STRUDEL_FLOW_TAB_LINE_GAP = 12;
117
+ /**
118
+ * Every tab length below is a multiple of the line gap, and mirrors what the tab import reads:
119
+ * stems sit between one and two and three quarter gaps under the staff, beams stack up from the
120
+ * stem's foot, and a triplet bracket runs below the stems.
121
+ */
122
+ export declare const STRUDEL_FLOW_TAB_TOP_MARGIN = 1.5;
123
+ export declare const STRUDEL_FLOW_TAB_BOTTOM_MARGIN = 0.8;
124
+ export declare const STRUDEL_FLOW_TAB_SIDE_MARGIN = 3;
125
+ export declare const STRUDEL_FLOW_TAB_STEM_TOP = 1;
126
+ export declare const STRUDEL_FLOW_TAB_STEM_BOTTOM = 2.6;
127
+ export declare const STRUDEL_FLOW_TAB_BEAM_THICKNESS = 0.2;
128
+ export declare const STRUDEL_FLOW_TAB_BEAM_STEP = 0.4;
129
+ export declare const STRUDEL_FLOW_TAB_FLAG_LENGTH = 0.8;
130
+ export declare const STRUDEL_FLOW_TAB_BRACKET_Y = 3.4;
131
+ export declare const STRUDEL_FLOW_TAB_DIGIT_WIDTH = 0.62;
132
+ /** Centre to centre of the digits in a two digit fret; wider than a digit so they never touch. */
133
+ export declare const STRUDEL_FLOW_TAB_DIGIT_PITCH = 0.68;
134
+ export declare const STRUDEL_FLOW_TAB_DIGIT_CLEARANCE = 0.15;
135
+ /** A tie leaves its number this far below the line, sags to the second depth, and stops short. */
136
+ export declare const STRUDEL_FLOW_TAB_TIE_TOP = 0.2;
137
+ export declare const STRUDEL_FLOW_TAB_TIE_SAG = 0.6;
138
+ export declare const STRUDEL_FLOW_TAB_TIE_END_GAP = 0.3;
139
+ /** Room a stem takes: a fixed part, so short notes stay legible, and a part per beat. */
140
+ export declare const STRUDEL_FLOW_TAB_STEM_SPACE = 2;
141
+ export declare const STRUDEL_FLOW_TAB_SPACE_PER_BEAT = 1.5;
142
+ /** Beats a stem lasts by how many beams or flags it carries: none, one, two, three. */
143
+ export declare const STRUDEL_FLOW_TAB_BEAM_BEATS: number[];
144
+ export declare const STRUDEL_FLOW_TAB_TRIPLET_NUMERATOR = 2;
145
+ export declare const STRUDEL_FLOW_TAB_TRIPLET_DENOMINATOR = 3;
146
+ export declare const STRUDEL_FLOW_PIANO_ROLL_ROW_HEIGHT = 8;
147
+ export declare const STRUDEL_FLOW_PIANO_ROLL_BEAT_WIDTH = 32;
148
+ export declare const STRUDEL_FLOW_PIANO_ROLL_GUTTER = 26;
149
+ export declare const STRUDEL_FLOW_PIANO_ROLL_MIN_ROWS = 12;
150
+ /** Pitch classes of the black keys, shaded in the piano roll. */
151
+ export declare const STRUDEL_FLOW_BLACK_KEY_CLASSES: number[];
152
+ export declare const STRUDEL_FLOW_TAB_MIN_BAR_WIDTH = 5;
153
+ export declare const STRUDEL_FLOW_TAB_REST_WIDTH = 0.8;
154
+ export declare const STRUDEL_FLOW_TAB_REST_HEIGHT = 0.35;
155
+ export declare const STRUDEL_FLOW_TAB_STROKE_WIDTH = 0.1;
156
+ export declare const STRUDEL_FLOW_TAB_STEM_WIDTH = 0.12;
157
+ export declare const STRUDEL_FLOW_TAB_DIGIT_SIZE = 1;
158
+ /** Half the height of a digit in Arial, so a number written there sits centred on its line. */
159
+ export declare const STRUDEL_FLOW_TAB_DIGIT_BASELINE = 0.36;
160
+ export declare const STRUDEL_FLOW_TAB_BRACKET_LABEL_GAP = 0.5;
161
+ export declare const STRUDEL_FLOW_TAB_BRACKET_OVERHANG = 0.3;
162
+ export declare const STRUDEL_FLOW_TAB_BRACKET_HOOK = 0.25;
163
+ export declare const STRUDEL_FLOW_TAB_BRACKET_LABEL_SIZE = 0.7;
164
+ export declare const STRUDEL_FLOW_TAB_BRACKET_LABEL_BASELINE = 0.25;
165
+ export declare const STRUDEL_FLOW_TAB_BOTTOM_SPACE = 4.3;
166
+ /** Semitones above C of each note letter, as Strudel reads note names. */
167
+ export declare const STRUDEL_FLOW_PITCH_CLASSES: Record<string, number>;
168
+ /** Strudel's octave for a note name written without one, such as `c`. */
169
+ export declare const STRUDEL_FLOW_DEFAULT_OCTAVE = 3;
170
+ export declare const STRUDEL_FLOW_SHARP_SIGNS: string[];
171
+ /** The finest note length written as a fraction: a 24th of a beat covers sixteenth triplets. */
172
+ export declare const STRUDEL_FLOW_MAX_LENGTH_DENOMINATOR = 24;
173
+ /** Note letters in staff order, from C up. */
174
+ export declare const STRUDEL_FLOW_NOTE_LETTERS: string[];
175
+ /** How a MIDI number is spelled on a staff, one name per semitone above C. */
176
+ export declare const STRUDEL_FLOW_SHARP_SPELLINGS: {
177
+ letter: string;
178
+ alteration: number;
179
+ }[];
180
+ /** Middle C and up go on the treble staff, everything lower on the bass staff. */
181
+ export declare const STRUDEL_FLOW_SHEET_TREBLE_LOWEST_NOTE = 60;
182
+ /** The step counted from C0 of each clef's bottom line: E4 and G2. */
183
+ export declare const STRUDEL_FLOW_SHEET_BOTTOM_STEPS: {
184
+ treble: number;
185
+ bass: number;
186
+ };
187
+ /** Each written note value: its length in beats and how it looks. */
188
+ export declare const STRUDEL_FLOW_SHEET_VALUES: {
189
+ beats: number;
190
+ filled: boolean;
191
+ stem: boolean;
192
+ flags: number;
193
+ }[];
194
+ /** A dot adds half the value again. */
195
+ export declare const STRUDEL_FLOW_SHEET_DOT_FACTOR = 1.5;
196
+ export declare const STRUDEL_FLOW_SHEET_CLEF_GLYPHS: {
197
+ treble: string;
198
+ bass: string;
199
+ };
200
+ export declare const STRUDEL_FLOW_SHEET_ACCIDENTAL_GLYPHS: {
201
+ sharp: string;
202
+ flat: string;
203
+ natural: string;
204
+ };
205
+ /** The sheet's drawing unit: the gap between two staff lines. Lengths below are in gaps. */
206
+ export declare const STRUDEL_FLOW_SHEET_LINE_GAP = 8;
207
+ export declare const STRUDEL_FLOW_SHEET_TOP_MARGIN = 5;
208
+ export declare const STRUDEL_FLOW_SHEET_BOTTOM_MARGIN = 4;
209
+ /** Top line of the treble staff to the top line of the bass staff in a grand staff. */
210
+ export declare const STRUDEL_FLOW_SHEET_STAFF_DISTANCE = 10;
211
+ export declare const STRUDEL_FLOW_SHEET_CLEF_SPACE = 4.5;
212
+ export declare const STRUDEL_FLOW_SHEET_COLUMN_SPACE = 2.4;
213
+ export declare const STRUDEL_FLOW_SHEET_SPACE_PER_BEAT = 2.5;
214
+ export declare const STRUDEL_FLOW_SHEET_ACCIDENTAL_SPACE = 1.4;
215
+ export declare const STRUDEL_FLOW_SHEET_MIN_BAR_WIDTH = 6;
216
+ export declare const STRUDEL_FLOW_SHEET_HEAD_RADIUS_X = 0.65;
217
+ export declare const STRUDEL_FLOW_SHEET_HEAD_RADIUS_Y = 0.45;
218
+ export declare const STRUDEL_FLOW_SHEET_STEM_LENGTH = 3.5;
219
+ export declare const STRUDEL_FLOW_SHEET_FLAG_STEP = 0.8;
220
+ export declare const STRUDEL_FLOW_SHEET_LEDGER_HALF_WIDTH = 1;
221
+ export declare const STRUDEL_FLOW_SHEET_ACCIDENTAL_OFFSET = 1.4;
222
+ export declare const STRUDEL_FLOW_SHEET_DOT_OFFSET = 1.1;
223
+ export declare const STRUDEL_FLOW_SHEET_TIE_OFFSET = 0.7;
224
+ export declare const STRUDEL_FLOW_SHEET_TIE_SAG = 0.7;
225
+ export declare const STRUDEL_FLOW_SHEET_BRACKET_RISE = 3;
226
+ export declare const STRUDEL_FLOW_SHEET_STROKE_WIDTH = 0.12;
227
+ /**
228
+ * What can follow a sample in a Samples step, in plain words: a speed, a repeat, a length, a
229
+ * chance or a rhythm. `kind` picks the icon and the group the step's menu files it under.
230
+ */
231
+ export declare const STRUDEL_FLOW_SAMPLE_MODIFIER_OPTIONS: readonly [{
232
+ readonly value: "";
233
+ readonly label: "Once";
234
+ readonly kind: "once";
235
+ }, {
236
+ readonly value: "*2";
237
+ readonly label: "2 hits in its step";
238
+ readonly kind: "faster";
239
+ }, {
240
+ readonly value: "*3";
241
+ readonly label: "3 hits in its step";
242
+ readonly kind: "faster";
243
+ }, {
244
+ readonly value: "*4";
245
+ readonly label: "4 hits in its step";
246
+ readonly kind: "faster";
247
+ }, {
248
+ readonly value: "*8";
249
+ readonly label: "8 hits in its step";
250
+ readonly kind: "faster";
251
+ }, {
252
+ readonly value: "!2";
253
+ readonly label: "Repeat over 2 steps";
254
+ readonly kind: "repeat";
255
+ }, {
256
+ readonly value: "!3";
257
+ readonly label: "Repeat over 3 steps";
258
+ readonly kind: "repeat";
259
+ }, {
260
+ readonly value: "!4";
261
+ readonly label: "Repeat over 4 steps";
262
+ readonly kind: "repeat";
263
+ }, {
264
+ readonly value: "@2";
265
+ readonly label: "Last 2 steps";
266
+ readonly kind: "hold";
267
+ }, {
268
+ readonly value: "@3";
269
+ readonly label: "Last 3 steps";
270
+ readonly kind: "hold";
271
+ }, {
272
+ readonly value: "/2";
273
+ readonly label: "Every 2nd cycle";
274
+ readonly kind: "slower";
275
+ }, {
276
+ readonly value: "/4";
277
+ readonly label: "Every 4th cycle";
278
+ readonly kind: "slower";
279
+ }, {
280
+ readonly value: "?";
281
+ readonly label: "Sometimes";
282
+ readonly kind: "chance";
283
+ }, {
284
+ readonly value: "(3,8)";
285
+ readonly label: "3 hits spread over 8";
286
+ readonly kind: "rhythm";
287
+ }, {
288
+ readonly value: "(5,8)";
289
+ readonly label: "5 hits spread over 8";
290
+ readonly kind: "rhythm";
291
+ }, {
292
+ readonly value: "(3,8,2)";
293
+ readonly label: "3 over 8, shifted by 2";
294
+ readonly kind: "rhythm";
295
+ }];
296
+ /** The groups the modifier menu lists, in order, each named for what it does to the step. */
297
+ export declare const STRUDEL_FLOW_SAMPLE_MODIFIER_KINDS: readonly [{
298
+ readonly id: "once";
299
+ readonly label: "Plays";
300
+ }, {
301
+ readonly id: "faster";
302
+ readonly label: "Faster";
303
+ }, {
304
+ readonly id: "repeat";
305
+ readonly label: "Repeat";
306
+ }, {
307
+ readonly id: "hold";
308
+ readonly label: "Longer";
309
+ }, {
310
+ readonly id: "slower";
311
+ readonly label: "Slower";
312
+ }, {
313
+ readonly id: "chance";
314
+ readonly label: "Chance";
315
+ }, {
316
+ readonly id: "rhythm";
317
+ readonly label: "Rhythm";
318
+ }];
319
+ /**
320
+ * Instrument families the sample picker sorts by, matched in order against a sample's name, so
321
+ * `808bd` and `rolandtr909_bd` both land under Kicks. Anything unmatched is Other.
322
+ */
323
+ export declare const STRUDEL_FLOW_SAMPLE_FAMILIES: StrudelFlowSampleFamily[];
@@ -0,0 +1,29 @@
1
+ import type { StrudelFlowEdge, StrudelFlowNode } from './types';
2
+ /** The fields Vue Flow includes when it asks whether a cable or an edge is valid. */
3
+ export type StrudelFlowConnectionCandidate = {
4
+ source?: string | null;
5
+ target?: string | null;
6
+ /** Set when this is an edge the graph already holds, not a cable being drawn. */
7
+ id?: string;
8
+ };
9
+ /**
10
+ * Whether a cable can run from one node into another without turning the patch into something
11
+ * the compiler has to reject: an instrument has no input, a pair connects once, and an effect
12
+ * cannot feed back into a node upstream of itself.
13
+ * @param sourceNodeId - the node the cable leaves
14
+ * @param targetNodeId - the node the cable enters
15
+ * @param nodes - every node in the patch
16
+ * @param edges - every cable already in the patch
17
+ * @returns true when the patch still compiles after adding the cable
18
+ */
19
+ export declare const canConnectStrudelFlowNodes: (sourceNodeId: string, targetNodeId: string, nodes: StrudelFlowNode[], edges: StrudelFlowEdge[]) => boolean;
20
+ /**
21
+ * Whether Vue Flow may keep the connection it is asking about. A cable being drawn follows the
22
+ * patch rules. An edge handed back from the graph already passed those rules, so it is accepted
23
+ * here; checking it again as a new cable would reject it as one of its own duplicates.
24
+ * @param connection - the cable being drawn, or an edge the graph already holds
25
+ * @param nodes - every node in the patch
26
+ * @param edges - every cable already in the patch
27
+ * @returns true when the graph may keep the connection
28
+ */
29
+ export declare const canUseStrudelFlowConnection: (connection: StrudelFlowConnectionCandidate, nodes: StrudelFlowNode[], edges: StrudelFlowEdge[]) => boolean;
@@ -0,0 +1,7 @@
1
+ import type { StrudelFlowPatch } from './types';
2
+ /**
3
+ * The patch a first visit opens, and what Reset returns to: a pad played by a voice through a
4
+ * filter, as the reference editor starts.
5
+ * @returns a fresh patch whose nodes and arrays can be edited without touching another copy
6
+ */
7
+ export declare const createDefaultStrudelFlowPatch: () => StrudelFlowPatch;
@@ -0,0 +1,13 @@
1
+ import type { StrudelFlowEnvelopeData } from './types';
2
+ export type EnvelopePoint = {
3
+ x: number;
4
+ y: number;
5
+ };
6
+ /**
7
+ * Corner points of an ADSR (attack, decay, sustain, release) curve in a 0..1 box, y up.
8
+ * The sustain plateau has no length in the data, so it takes a share of the other stages
9
+ * and the four stages always fill the full width.
10
+ * @param envelope - the four ADSR values
11
+ * @returns five corner points from silence, through peak and sustain, back to silence
12
+ */
13
+ export declare const getEnvelopePoints: (envelope: Pick<StrudelFlowEnvelopeData, 'attack' | 'decay' | 'sustain' | 'release'>) => EnvelopePoint[];
@@ -0,0 +1,9 @@
1
+ import type { StrudelFlowFretPosition } from './types';
2
+ /**
3
+ * Picks a string and fret for every note: per chord, the strings that move the hand least from
4
+ * the last one, within the first 24 frets, with a chord kept inside four frets where it can be.
5
+ * @param chords - the MIDI notes struck together, in playing order
6
+ * @param openStrings - the MIDI note of each open string, from the top staff line down
7
+ * @returns the positions of each chord; a note no string reaches is left out
8
+ */
9
+ export declare const placeStrudelFlowFrets: (chords: number[][], openStrings: number[]) => StrudelFlowFretPosition[][];