@webgamekit/strudel-flow 0.0.0-stage → 0.1.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.
- package/LICENSE +661 -0
- package/dist/callArguments.d.ts +15 -0
- package/dist/chordSymbols.d.ts +15 -0
- package/dist/chords.d.ts +42 -0
- package/dist/codeScanner.d.ts +54 -0
- package/dist/compileStrudelFlow.d.ts +27 -0
- package/dist/components/notation/notationContextKey.d.ts +4 -0
- package/dist/components/overlayTargetKey.d.ts +3 -0
- package/dist/components/previewSoundKey.d.ts +3 -0
- package/dist/components/sampleFamilyIcons.d.ts +6 -0
- package/dist/components/visualizerWidgetIdsKey.d.ts +3 -0
- package/dist/config.d.ts +315 -0
- package/dist/connections.d.ts +29 -0
- package/dist/defaultPatch.d.ts +7 -0
- package/dist/envelopeShape.d.ts +13 -0
- package/dist/fretPlacement.d.ts +9 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +5997 -0
- package/dist/index.umd.cjs +21 -0
- package/dist/layout.d.ts +30 -0
- package/dist/nodeCodeRange.d.ts +36 -0
- package/dist/nodeDefaults.d.ts +55 -0
- package/dist/nodeDefinitions.d.ts +9 -0
- package/dist/nodePatterns.d.ts +23 -0
- package/dist/notationPick.d.ts +22 -0
- package/dist/notationSequence.d.ts +15 -0
- package/dist/noteValues.d.ts +20 -0
- package/dist/parseStrudelFlowCode.d.ts +20 -0
- package/dist/patchStorage.d.ts +9 -0
- package/dist/patternVariables.d.ts +16 -0
- package/dist/readStoredValue.d.ts +32 -0
- package/dist/readStrudelFlowNodeData.d.ts +15 -0
- package/dist/sampleFamilies.d.ts +10 -0
- package/dist/sampleSequence.d.ts +14 -0
- package/dist/sheetLayout.d.ts +11 -0
- package/dist/solo.d.ts +23 -0
- package/dist/storage.d.ts +12 -0
- package/dist/structSteps.d.ts +12 -0
- package/dist/style.css +1 -0
- package/dist/tabLayout.d.ts +11 -0
- package/dist/tempo.d.ts +12 -0
- package/dist/types.d.ts +453 -0
- package/dist/useStrudelFlow.d.ts +8 -0
- package/package.json +43 -3
- package/README.md +0 -3
|
@@ -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;
|
package/dist/chords.d.ts
ADDED
|
@@ -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,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>;
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
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
|
+
export declare const STRUDEL_FLOW_DEFAULT_BEATS_STEPS = 16;
|
|
69
|
+
/** The starter beat: four on the floor, a backbeat snare and eighth-note hats. */
|
|
70
|
+
export declare const STRUDEL_FLOW_DRUM_ROWS: {
|
|
71
|
+
sound: string;
|
|
72
|
+
hits: number[];
|
|
73
|
+
}[];
|
|
74
|
+
/** Sounds a new track takes, in order, skipping any the node already uses. */
|
|
75
|
+
export declare const STRUDEL_FLOW_NEW_DRUM_SOUNDS: string[];
|
|
76
|
+
/** Drum and percussion banks from the dirt-samples kit the editor loads, by family. */
|
|
77
|
+
export declare const STRUDEL_FLOW_DRUM_SOUND_GROUPS: {
|
|
78
|
+
label: string;
|
|
79
|
+
sounds: string[];
|
|
80
|
+
}[];
|
|
81
|
+
/**
|
|
82
|
+
* Strudel names the canvas of an inline visual `<evaluation id>_widget_<call>_<index>`. The
|
|
83
|
+
* editor evaluates without an id, so the name starts at the underscore.
|
|
84
|
+
*/
|
|
85
|
+
export declare const STRUDEL_FLOW_WIDGET_ID_PREFIX = "_widget_";
|
|
86
|
+
/** Background canvas id that Strudel's `getDrawContext()` paints behind-the-code visuals on. */
|
|
87
|
+
export declare const STRUDEL_FLOW_BACKGROUND_CANVAS_ID = "test-canvas";
|
|
88
|
+
/** The calls a node shows controls for, one entry per argument; any other call stays text. */
|
|
89
|
+
export declare const STRUDEL_FLOW_CALL_PARAMETERS: Record<string, StrudelFlowCallParameter[]>;
|
|
90
|
+
/** MIDI note of each open string, from the top staff line (the highest string) down. */
|
|
91
|
+
export declare const STRUDEL_FLOW_OPEN_STRINGS: {
|
|
92
|
+
bass: number[];
|
|
93
|
+
guitar: number[];
|
|
94
|
+
};
|
|
95
|
+
export declare const STRUDEL_FLOW_MAX_FRET = 24;
|
|
96
|
+
/** The most frets one hand covers, so a chord stays playable. */
|
|
97
|
+
export declare const STRUDEL_FLOW_CHORD_FRET_SPAN = 4;
|
|
98
|
+
export declare const STRUDEL_FLOW_NOTATION_OPTIONS: {
|
|
99
|
+
value: StrudelFlowNotation;
|
|
100
|
+
label: string;
|
|
101
|
+
}[];
|
|
102
|
+
/** Auto's choice: the first entry whose word is in the sound's name wins; anything else is names. */
|
|
103
|
+
export declare const STRUDEL_FLOW_NOTATION_BY_SOUND: {
|
|
104
|
+
word: string;
|
|
105
|
+
view: StrudelFlowNotationView;
|
|
106
|
+
}[];
|
|
107
|
+
/** The tab staff's drawing unit: the gap between two staff lines. */
|
|
108
|
+
export declare const STRUDEL_FLOW_TAB_LINE_GAP = 12;
|
|
109
|
+
/**
|
|
110
|
+
* Every tab length below is a multiple of the line gap, and mirrors what the tab import reads:
|
|
111
|
+
* stems sit between one and two and three quarter gaps under the staff, beams stack up from the
|
|
112
|
+
* stem's foot, and a triplet bracket runs below the stems.
|
|
113
|
+
*/
|
|
114
|
+
export declare const STRUDEL_FLOW_TAB_TOP_MARGIN = 1.5;
|
|
115
|
+
export declare const STRUDEL_FLOW_TAB_BOTTOM_MARGIN = 0.8;
|
|
116
|
+
export declare const STRUDEL_FLOW_TAB_SIDE_MARGIN = 3;
|
|
117
|
+
export declare const STRUDEL_FLOW_TAB_STEM_TOP = 1;
|
|
118
|
+
export declare const STRUDEL_FLOW_TAB_STEM_BOTTOM = 2.6;
|
|
119
|
+
export declare const STRUDEL_FLOW_TAB_BEAM_THICKNESS = 0.2;
|
|
120
|
+
export declare const STRUDEL_FLOW_TAB_BEAM_STEP = 0.4;
|
|
121
|
+
export declare const STRUDEL_FLOW_TAB_FLAG_LENGTH = 0.8;
|
|
122
|
+
export declare const STRUDEL_FLOW_TAB_BRACKET_Y = 3.4;
|
|
123
|
+
export declare const STRUDEL_FLOW_TAB_DIGIT_WIDTH = 0.62;
|
|
124
|
+
/** Centre to centre of the digits in a two digit fret; wider than a digit so they never touch. */
|
|
125
|
+
export declare const STRUDEL_FLOW_TAB_DIGIT_PITCH = 0.68;
|
|
126
|
+
export declare const STRUDEL_FLOW_TAB_DIGIT_CLEARANCE = 0.15;
|
|
127
|
+
/** A tie leaves its number this far below the line, sags to the second depth, and stops short. */
|
|
128
|
+
export declare const STRUDEL_FLOW_TAB_TIE_TOP = 0.2;
|
|
129
|
+
export declare const STRUDEL_FLOW_TAB_TIE_SAG = 0.6;
|
|
130
|
+
export declare const STRUDEL_FLOW_TAB_TIE_END_GAP = 0.3;
|
|
131
|
+
/** Room a stem takes: a fixed part, so short notes stay legible, and a part per beat. */
|
|
132
|
+
export declare const STRUDEL_FLOW_TAB_STEM_SPACE = 2;
|
|
133
|
+
export declare const STRUDEL_FLOW_TAB_SPACE_PER_BEAT = 1.5;
|
|
134
|
+
/** Beats a stem lasts by how many beams or flags it carries: none, one, two, three. */
|
|
135
|
+
export declare const STRUDEL_FLOW_TAB_BEAM_BEATS: number[];
|
|
136
|
+
export declare const STRUDEL_FLOW_TAB_TRIPLET_NUMERATOR = 2;
|
|
137
|
+
export declare const STRUDEL_FLOW_TAB_TRIPLET_DENOMINATOR = 3;
|
|
138
|
+
export declare const STRUDEL_FLOW_PIANO_ROLL_ROW_HEIGHT = 8;
|
|
139
|
+
export declare const STRUDEL_FLOW_PIANO_ROLL_BEAT_WIDTH = 32;
|
|
140
|
+
export declare const STRUDEL_FLOW_PIANO_ROLL_GUTTER = 26;
|
|
141
|
+
export declare const STRUDEL_FLOW_PIANO_ROLL_MIN_ROWS = 12;
|
|
142
|
+
/** Pitch classes of the black keys, shaded in the piano roll. */
|
|
143
|
+
export declare const STRUDEL_FLOW_BLACK_KEY_CLASSES: number[];
|
|
144
|
+
export declare const STRUDEL_FLOW_TAB_MIN_BAR_WIDTH = 5;
|
|
145
|
+
export declare const STRUDEL_FLOW_TAB_REST_WIDTH = 0.8;
|
|
146
|
+
export declare const STRUDEL_FLOW_TAB_REST_HEIGHT = 0.35;
|
|
147
|
+
export declare const STRUDEL_FLOW_TAB_STROKE_WIDTH = 0.1;
|
|
148
|
+
export declare const STRUDEL_FLOW_TAB_STEM_WIDTH = 0.12;
|
|
149
|
+
export declare const STRUDEL_FLOW_TAB_DIGIT_SIZE = 1;
|
|
150
|
+
/** Half the height of a digit in Arial, so a number written there sits centred on its line. */
|
|
151
|
+
export declare const STRUDEL_FLOW_TAB_DIGIT_BASELINE = 0.36;
|
|
152
|
+
export declare const STRUDEL_FLOW_TAB_BRACKET_LABEL_GAP = 0.5;
|
|
153
|
+
export declare const STRUDEL_FLOW_TAB_BRACKET_OVERHANG = 0.3;
|
|
154
|
+
export declare const STRUDEL_FLOW_TAB_BRACKET_HOOK = 0.25;
|
|
155
|
+
export declare const STRUDEL_FLOW_TAB_BRACKET_LABEL_SIZE = 0.7;
|
|
156
|
+
export declare const STRUDEL_FLOW_TAB_BRACKET_LABEL_BASELINE = 0.25;
|
|
157
|
+
export declare const STRUDEL_FLOW_TAB_BOTTOM_SPACE = 4.3;
|
|
158
|
+
/** Semitones above C of each note letter, as Strudel reads note names. */
|
|
159
|
+
export declare const STRUDEL_FLOW_PITCH_CLASSES: Record<string, number>;
|
|
160
|
+
/** Strudel's octave for a note name written without one, such as `c`. */
|
|
161
|
+
export declare const STRUDEL_FLOW_DEFAULT_OCTAVE = 3;
|
|
162
|
+
export declare const STRUDEL_FLOW_SHARP_SIGNS: string[];
|
|
163
|
+
/** The finest note length written as a fraction: a 24th of a beat covers sixteenth triplets. */
|
|
164
|
+
export declare const STRUDEL_FLOW_MAX_LENGTH_DENOMINATOR = 24;
|
|
165
|
+
/** Note letters in staff order, from C up. */
|
|
166
|
+
export declare const STRUDEL_FLOW_NOTE_LETTERS: string[];
|
|
167
|
+
/** How a MIDI number is spelled on a staff, one name per semitone above C. */
|
|
168
|
+
export declare const STRUDEL_FLOW_SHARP_SPELLINGS: {
|
|
169
|
+
letter: string;
|
|
170
|
+
alteration: number;
|
|
171
|
+
}[];
|
|
172
|
+
/** Middle C and up go on the treble staff, everything lower on the bass staff. */
|
|
173
|
+
export declare const STRUDEL_FLOW_SHEET_TREBLE_LOWEST_NOTE = 60;
|
|
174
|
+
/** The step counted from C0 of each clef's bottom line: E4 and G2. */
|
|
175
|
+
export declare const STRUDEL_FLOW_SHEET_BOTTOM_STEPS: {
|
|
176
|
+
treble: number;
|
|
177
|
+
bass: number;
|
|
178
|
+
};
|
|
179
|
+
/** Each written note value: its length in beats and how it looks. */
|
|
180
|
+
export declare const STRUDEL_FLOW_SHEET_VALUES: {
|
|
181
|
+
beats: number;
|
|
182
|
+
filled: boolean;
|
|
183
|
+
stem: boolean;
|
|
184
|
+
flags: number;
|
|
185
|
+
}[];
|
|
186
|
+
/** A dot adds half the value again. */
|
|
187
|
+
export declare const STRUDEL_FLOW_SHEET_DOT_FACTOR = 1.5;
|
|
188
|
+
export declare const STRUDEL_FLOW_SHEET_CLEF_GLYPHS: {
|
|
189
|
+
treble: string;
|
|
190
|
+
bass: string;
|
|
191
|
+
};
|
|
192
|
+
export declare const STRUDEL_FLOW_SHEET_ACCIDENTAL_GLYPHS: {
|
|
193
|
+
sharp: string;
|
|
194
|
+
flat: string;
|
|
195
|
+
natural: string;
|
|
196
|
+
};
|
|
197
|
+
/** The sheet's drawing unit: the gap between two staff lines. Lengths below are in gaps. */
|
|
198
|
+
export declare const STRUDEL_FLOW_SHEET_LINE_GAP = 8;
|
|
199
|
+
export declare const STRUDEL_FLOW_SHEET_TOP_MARGIN = 5;
|
|
200
|
+
export declare const STRUDEL_FLOW_SHEET_BOTTOM_MARGIN = 4;
|
|
201
|
+
/** Top line of the treble staff to the top line of the bass staff in a grand staff. */
|
|
202
|
+
export declare const STRUDEL_FLOW_SHEET_STAFF_DISTANCE = 10;
|
|
203
|
+
export declare const STRUDEL_FLOW_SHEET_CLEF_SPACE = 4.5;
|
|
204
|
+
export declare const STRUDEL_FLOW_SHEET_COLUMN_SPACE = 2.4;
|
|
205
|
+
export declare const STRUDEL_FLOW_SHEET_SPACE_PER_BEAT = 2.5;
|
|
206
|
+
export declare const STRUDEL_FLOW_SHEET_ACCIDENTAL_SPACE = 1.4;
|
|
207
|
+
export declare const STRUDEL_FLOW_SHEET_MIN_BAR_WIDTH = 6;
|
|
208
|
+
export declare const STRUDEL_FLOW_SHEET_HEAD_RADIUS_X = 0.65;
|
|
209
|
+
export declare const STRUDEL_FLOW_SHEET_HEAD_RADIUS_Y = 0.45;
|
|
210
|
+
export declare const STRUDEL_FLOW_SHEET_STEM_LENGTH = 3.5;
|
|
211
|
+
export declare const STRUDEL_FLOW_SHEET_FLAG_STEP = 0.8;
|
|
212
|
+
export declare const STRUDEL_FLOW_SHEET_LEDGER_HALF_WIDTH = 1;
|
|
213
|
+
export declare const STRUDEL_FLOW_SHEET_ACCIDENTAL_OFFSET = 1.4;
|
|
214
|
+
export declare const STRUDEL_FLOW_SHEET_DOT_OFFSET = 1.1;
|
|
215
|
+
export declare const STRUDEL_FLOW_SHEET_TIE_OFFSET = 0.7;
|
|
216
|
+
export declare const STRUDEL_FLOW_SHEET_TIE_SAG = 0.7;
|
|
217
|
+
export declare const STRUDEL_FLOW_SHEET_BRACKET_RISE = 3;
|
|
218
|
+
export declare const STRUDEL_FLOW_SHEET_STROKE_WIDTH = 0.12;
|
|
219
|
+
/**
|
|
220
|
+
* What can follow a sample in a Samples step, in plain words: a speed, a repeat, a length, a
|
|
221
|
+
* chance or a rhythm. `kind` picks the icon and the group the step's menu files it under.
|
|
222
|
+
*/
|
|
223
|
+
export declare const STRUDEL_FLOW_SAMPLE_MODIFIER_OPTIONS: readonly [{
|
|
224
|
+
readonly value: "";
|
|
225
|
+
readonly label: "Once";
|
|
226
|
+
readonly kind: "once";
|
|
227
|
+
}, {
|
|
228
|
+
readonly value: "*2";
|
|
229
|
+
readonly label: "2 hits in its step";
|
|
230
|
+
readonly kind: "faster";
|
|
231
|
+
}, {
|
|
232
|
+
readonly value: "*3";
|
|
233
|
+
readonly label: "3 hits in its step";
|
|
234
|
+
readonly kind: "faster";
|
|
235
|
+
}, {
|
|
236
|
+
readonly value: "*4";
|
|
237
|
+
readonly label: "4 hits in its step";
|
|
238
|
+
readonly kind: "faster";
|
|
239
|
+
}, {
|
|
240
|
+
readonly value: "*8";
|
|
241
|
+
readonly label: "8 hits in its step";
|
|
242
|
+
readonly kind: "faster";
|
|
243
|
+
}, {
|
|
244
|
+
readonly value: "!2";
|
|
245
|
+
readonly label: "Repeat over 2 steps";
|
|
246
|
+
readonly kind: "repeat";
|
|
247
|
+
}, {
|
|
248
|
+
readonly value: "!3";
|
|
249
|
+
readonly label: "Repeat over 3 steps";
|
|
250
|
+
readonly kind: "repeat";
|
|
251
|
+
}, {
|
|
252
|
+
readonly value: "!4";
|
|
253
|
+
readonly label: "Repeat over 4 steps";
|
|
254
|
+
readonly kind: "repeat";
|
|
255
|
+
}, {
|
|
256
|
+
readonly value: "@2";
|
|
257
|
+
readonly label: "Last 2 steps";
|
|
258
|
+
readonly kind: "hold";
|
|
259
|
+
}, {
|
|
260
|
+
readonly value: "@3";
|
|
261
|
+
readonly label: "Last 3 steps";
|
|
262
|
+
readonly kind: "hold";
|
|
263
|
+
}, {
|
|
264
|
+
readonly value: "/2";
|
|
265
|
+
readonly label: "Every 2nd cycle";
|
|
266
|
+
readonly kind: "slower";
|
|
267
|
+
}, {
|
|
268
|
+
readonly value: "/4";
|
|
269
|
+
readonly label: "Every 4th cycle";
|
|
270
|
+
readonly kind: "slower";
|
|
271
|
+
}, {
|
|
272
|
+
readonly value: "?";
|
|
273
|
+
readonly label: "Sometimes";
|
|
274
|
+
readonly kind: "chance";
|
|
275
|
+
}, {
|
|
276
|
+
readonly value: "(3,8)";
|
|
277
|
+
readonly label: "3 hits spread over 8";
|
|
278
|
+
readonly kind: "rhythm";
|
|
279
|
+
}, {
|
|
280
|
+
readonly value: "(5,8)";
|
|
281
|
+
readonly label: "5 hits spread over 8";
|
|
282
|
+
readonly kind: "rhythm";
|
|
283
|
+
}, {
|
|
284
|
+
readonly value: "(3,8,2)";
|
|
285
|
+
readonly label: "3 over 8, shifted by 2";
|
|
286
|
+
readonly kind: "rhythm";
|
|
287
|
+
}];
|
|
288
|
+
/** The groups the modifier menu lists, in order, each named for what it does to the step. */
|
|
289
|
+
export declare const STRUDEL_FLOW_SAMPLE_MODIFIER_KINDS: readonly [{
|
|
290
|
+
readonly id: "once";
|
|
291
|
+
readonly label: "Plays";
|
|
292
|
+
}, {
|
|
293
|
+
readonly id: "faster";
|
|
294
|
+
readonly label: "Faster";
|
|
295
|
+
}, {
|
|
296
|
+
readonly id: "repeat";
|
|
297
|
+
readonly label: "Repeat";
|
|
298
|
+
}, {
|
|
299
|
+
readonly id: "hold";
|
|
300
|
+
readonly label: "Longer";
|
|
301
|
+
}, {
|
|
302
|
+
readonly id: "slower";
|
|
303
|
+
readonly label: "Slower";
|
|
304
|
+
}, {
|
|
305
|
+
readonly id: "chance";
|
|
306
|
+
readonly label: "Chance";
|
|
307
|
+
}, {
|
|
308
|
+
readonly id: "rhythm";
|
|
309
|
+
readonly label: "Rhythm";
|
|
310
|
+
}];
|
|
311
|
+
/**
|
|
312
|
+
* Instrument families the sample picker sorts by, matched in order against a sample's name, so
|
|
313
|
+
* `808bd` and `rolandtr909_bd` both land under Kicks. Anything unmatched is Other.
|
|
314
|
+
*/
|
|
315
|
+
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[][];
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './config';
|
|
3
|
+
export * from './storage';
|
|
4
|
+
export * from './readStoredValue';
|
|
5
|
+
export * from './chords';
|
|
6
|
+
export * from './callArguments';
|
|
7
|
+
export * from './readStrudelFlowNodeData';
|
|
8
|
+
export * from './nodeDefaults';
|
|
9
|
+
export * from './nodeDefinitions';
|
|
10
|
+
export * from './nodePatterns';
|
|
11
|
+
export * from './compileStrudelFlow';
|
|
12
|
+
export * from './connections';
|
|
13
|
+
export * from './tempo';
|
|
14
|
+
export * from './defaultPatch';
|
|
15
|
+
export * from './patchStorage';
|
|
16
|
+
export * from './useStrudelFlow';
|
|
17
|
+
export * from './parseStrudelFlowCode';
|
|
18
|
+
export * from './noteValues';
|
|
19
|
+
export * from './fretPlacement';
|
|
20
|
+
export * from './notationPick';
|
|
21
|
+
export * from './tabLayout';
|
|
22
|
+
export * from './sheetLayout';
|
|
23
|
+
export * from './sampleSequence';
|
|
24
|
+
export * from './sampleFamilies';
|
|
25
|
+
export * from './nodeCodeRange';
|
|
26
|
+
export { default as StrudelFlowEditor } from './components/StrudelFlowEditor.vue';
|
|
27
|
+
export { default as StrudelFlowNode } from './components/StrudelFlowNode.vue';
|
|
28
|
+
export { default as StrudelFlowPadControls } from './components/controls/StrudelFlowPadControls.vue';
|
|
29
|
+
export { default as StrudelFlowBeatsControls } from './components/controls/StrudelFlowBeatsControls.vue';
|
|
30
|
+
export { default as StrudelFlowChordsControls } from './components/controls/StrudelFlowChordsControls.vue';
|
|
31
|
+
export { default as StrudelFlowCodeControls } from './components/controls/StrudelFlowCodeControls.vue';
|
|
32
|
+
export { default as StrudelFlowDelayControls } from './components/controls/StrudelFlowDelayControls.vue';
|
|
33
|
+
export { default as StrudelFlowFilterControls } from './components/controls/StrudelFlowFilterControls.vue';
|
|
34
|
+
export { default as StrudelFlowSpaceControls } from './components/controls/StrudelFlowSpaceControls.vue';
|
|
35
|
+
export { default as StrudelFlowLevelControls } from './components/controls/StrudelFlowLevelControls.vue';
|
|
36
|
+
export { default as StrudelFlowEnvelopeControls } from './components/controls/StrudelFlowEnvelopeControls.vue';
|
|
37
|
+
export { default as StrudelFlowVisualizerControls } from './components/controls/StrudelFlowVisualizerControls.vue';
|
|
38
|
+
export { default as StrudelFlowKnob } from './components/controls/StrudelFlowKnob.vue';
|
|
39
|
+
export { default as StrudelFlowSelect } from './components/controls/StrudelFlowSelect.vue';
|
|
40
|
+
export { default as StrudelFlowStepper } from './components/controls/StrudelFlowStepper.vue';
|
|
41
|
+
export { default as StrudelFlowAccordion } from './components/controls/StrudelFlowAccordion.vue';
|
|
42
|
+
export { default as StrudelFlowChordEditor } from './components/controls/StrudelFlowChordEditor.vue';
|
|
43
|
+
export { default as StrudelFlowVoiceControls } from './components/controls/StrudelFlowVoiceControls.vue';
|
|
44
|
+
export { default as StrudelFlowNotation } from './components/notation/StrudelFlowNotation.vue';
|
|
45
|
+
export { default as StrudelFlowTabStaff } from './components/notation/StrudelFlowTabStaff.vue';
|
|
46
|
+
export { default as StrudelFlowSheet } from './components/notation/StrudelFlowSheet.vue';
|
|
47
|
+
export { default as StrudelFlowPianoRoll } from './components/notation/StrudelFlowPianoRoll.vue';
|
|
48
|
+
export { default as StrudelFlowNoteNames } from './components/notation/StrudelFlowNoteNames.vue';
|
|
49
|
+
export { default as StrudelFlowRadialMenu } from './components/StrudelFlowRadialMenu.vue';
|