@sudobility/music_drawing 0.0.18 → 0.0.19
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/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/keyboard-geometry.d.ts +96 -0
- package/dist/keyboard-geometry.d.ts.map +1 -0
- package/dist/keyboard-geometry.js +145 -0
- package/dist/keyboard-geometry.js.map +1 -0
- package/dist/print-layout.d.ts +60 -0
- package/dist/print-layout.d.ts.map +1 -0
- package/dist/print-layout.js +52 -0
- package/dist/print-layout.js.map +1 -0
- package/dist/types.d.ts +12 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -1
- package/package.json +9 -6
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export * from './types.js';
|
|
|
20
20
|
export * from './drawing-context.js';
|
|
21
21
|
export * from './layout.js';
|
|
22
22
|
export * from './pagination.js';
|
|
23
|
+
export * from './print-layout.js';
|
|
23
24
|
export * from './display-timing.js';
|
|
24
25
|
export * from './convert.js';
|
|
25
26
|
export * from './measure-content.js';
|
|
@@ -28,4 +29,9 @@ export * from './note-color.js';
|
|
|
28
29
|
export * from './playhead.js';
|
|
29
30
|
export * from './percussion.js';
|
|
30
31
|
export * from './icon-canvas.js';
|
|
32
|
+
/**
|
|
33
|
+
* Piano-keyboard geometry: white keys tile, black keys straddle the boundary
|
|
34
|
+
* between them. Shared by the web and native apps, which both draw one.
|
|
35
|
+
*/
|
|
36
|
+
export * from './keyboard-geometry.js';
|
|
31
37
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AAEjC;;;GAGG;AACH,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ export * from './types.js';
|
|
|
20
20
|
export * from './drawing-context.js';
|
|
21
21
|
export * from './layout.js';
|
|
22
22
|
export * from './pagination.js';
|
|
23
|
+
export * from './print-layout.js';
|
|
23
24
|
export * from './display-timing.js';
|
|
24
25
|
export * from './convert.js';
|
|
25
26
|
export * from './measure-content.js';
|
|
@@ -28,4 +29,9 @@ export * from './note-color.js';
|
|
|
28
29
|
export * from './playhead.js';
|
|
29
30
|
export * from './percussion.js';
|
|
30
31
|
export * from './icon-canvas.js';
|
|
32
|
+
/**
|
|
33
|
+
* Piano-keyboard geometry: white keys tile, black keys straddle the boundary
|
|
34
|
+
* between them. Shared by the web and native apps, which both draw one.
|
|
35
|
+
*/
|
|
36
|
+
export * from './keyboard-geometry.js';
|
|
31
37
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AAEjC;;;GAGG;AACH,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/** A0 — the lowest key on a standard 88-key piano. */
|
|
2
|
+
export declare const KEYBOARD_MIN_MIDI = 21;
|
|
3
|
+
/** C8 — the highest. */
|
|
4
|
+
export declare const KEYBOARD_MAX_MIDI = 108;
|
|
5
|
+
/** The 88 keys span 52 whites; the blacks overlay them and add no width. */
|
|
6
|
+
export declare const WHITE_KEY_COUNT = 52;
|
|
7
|
+
/**
|
|
8
|
+
* The keyboard is drawn over a caller-chosen range, not always all 88 keys:
|
|
9
|
+
* the active track's instrument decides it, so a piccolo part does not present
|
|
10
|
+
* three octaves of keys that will never sound.
|
|
11
|
+
*/
|
|
12
|
+
export type KeyboardRange = {
|
|
13
|
+
min: number;
|
|
14
|
+
max: number;
|
|
15
|
+
};
|
|
16
|
+
export declare const FULL_RANGE: KeyboardRange;
|
|
17
|
+
/**
|
|
18
|
+
* Widens `range` so it begins and ends on a white key, and clamps it to the
|
|
19
|
+
* 88-key piano.
|
|
20
|
+
*
|
|
21
|
+
* A keyboard whose first or last key is black looks broken — a black key has no
|
|
22
|
+
* white neighbour to hang off on that side, so it would float. Widening is
|
|
23
|
+
* always safe: it only ever adds a key the instrument nearly reaches.
|
|
24
|
+
*/
|
|
25
|
+
export declare function snapToWhiteKeys(range: KeyboardRange): KeyboardRange;
|
|
26
|
+
/** How many white keys a range spans, which is what sets the keyboard's width. */
|
|
27
|
+
export declare function whiteKeyCount(range?: KeyboardRange): number;
|
|
28
|
+
/**
|
|
29
|
+
* Below this the keys stop shrinking and the keyboard scrolls horizontally
|
|
30
|
+
* instead — 52 × 14 = 728px, so any narrower panel scrolls.
|
|
31
|
+
*/
|
|
32
|
+
export declare const MIN_WHITE_KEY_WIDTH = 14;
|
|
33
|
+
/** Black-key size, as a fraction of a white key. */
|
|
34
|
+
export declare const BLACK_KEY_WIDTH_RATIO = 0.6;
|
|
35
|
+
export declare const BLACK_KEY_HEIGHT_RATIO = 0.62;
|
|
36
|
+
export type PianoKey = {
|
|
37
|
+
midi: number;
|
|
38
|
+
isBlack: boolean;
|
|
39
|
+
/** Left edge in px, from the keyboard's own origin. */
|
|
40
|
+
x: number;
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
/**
|
|
44
|
+
* Set on each C and F (`C4`, `F4`), left null elsewhere.
|
|
45
|
+
*
|
|
46
|
+
* Those two are the landmarks of the black-key groups — C sits left of the
|
|
47
|
+
* group of two, F left of the group of three — so with both labelled no white
|
|
48
|
+
* key is ever more than two steps from a reference. Labelling all seven per
|
|
49
|
+
* octave is legible only while the keys are wide, and this keyboard shrinks.
|
|
50
|
+
*/
|
|
51
|
+
label: string | null;
|
|
52
|
+
/**
|
|
53
|
+
* What this key sounds, spelled out — the note name, or the drum on a
|
|
54
|
+
* percussion track.
|
|
55
|
+
*
|
|
56
|
+
* The key's accessible name, which is not always what `label` prints: a black
|
|
57
|
+
* key prints nothing but still has to announce itself, and a drum key prints
|
|
58
|
+
* "Cl HH" while announcing "Closed Hi-Hat".
|
|
59
|
+
*/
|
|
60
|
+
name: string;
|
|
61
|
+
/**
|
|
62
|
+
* Where the label sits, measured from the key's own top.
|
|
63
|
+
*
|
|
64
|
+
* Both kinds of key start at y=0 but a black one is shorter, so "just below
|
|
65
|
+
* this key" is not the same line for both. Labels go in the gutter under the
|
|
66
|
+
* *white* keys, and a labelled black key drops to a second row: a black key
|
|
67
|
+
* sits between two whites, so one row would print its name on top of both
|
|
68
|
+
* its neighbours'.
|
|
69
|
+
*/
|
|
70
|
+
labelTop: number;
|
|
71
|
+
};
|
|
72
|
+
/** Height of one row of key labels, and so of the gutter a keyboard needs per row. */
|
|
73
|
+
export declare const LABEL_ROW_HEIGHT = 12;
|
|
74
|
+
/**
|
|
75
|
+
* How a keyboard names its keys.
|
|
76
|
+
*
|
|
77
|
+
* A percussion track's keys are drums, not pitches: `C3` is a name for nothing
|
|
78
|
+
* on a drum staff, where that key sounds a Bass Drum. Passing the mode in keeps
|
|
79
|
+
* `computeKeys` free of any opinion about tracks or clefs.
|
|
80
|
+
*/
|
|
81
|
+
export type KeyNaming = 'pitch' | 'percussion';
|
|
82
|
+
/** True for the five black keys per octave (pitch classes 1, 3, 6, 8, 10). */
|
|
83
|
+
export declare function isBlackKey(midi: number): boolean;
|
|
84
|
+
/** A midi number as a pitch string, e.g. `C4`, `F#3` — sharp spelling, since a keyboard has no key signature to spell against. */
|
|
85
|
+
export declare function noteLabel(midi: number): string;
|
|
86
|
+
/** Total width of the keyboard at a given white-key width. */
|
|
87
|
+
export declare function keyboardWidth(whiteKeyWidth: number, range?: KeyboardRange): number;
|
|
88
|
+
/**
|
|
89
|
+
* Every key, whites first and blacks second.
|
|
90
|
+
*
|
|
91
|
+
* That order IS the z-order: a caller can render the array straight through
|
|
92
|
+
* and the blacks land on top of the whites they overlap, with no z-index
|
|
93
|
+
* bookkeeping.
|
|
94
|
+
*/
|
|
95
|
+
export declare function computeKeys(whiteKeyWidth: number, whiteKeyHeight: number, range?: KeyboardRange, naming?: KeyNaming): PianoKey[];
|
|
96
|
+
//# sourceMappingURL=keyboard-geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboard-geometry.d.ts","sourceRoot":"","sources":["../src/keyboard-geometry.ts"],"names":[],"mappings":"AA0BA,sDAAsD;AACtD,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,wBAAwB;AACxB,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,4EAA4E;AAC5E,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzD,eAAO,MAAM,UAAU,EAAE,aAGxB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa,CASnE;AAED,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,KAAK,GAAE,aAA0B,GAAG,MAAM,CAKvE;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,oDAAoD;AACpD,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,uDAAuD;IACvD,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;OAOG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;;;;;;OAOG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;;OAQG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,sFAAsF;AACtF,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,YAAY,CAAC;AAE/C,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGhD;AAED,kIAAkI;AAClI,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,8DAA8D;AAC9D,wBAAgB,aAAa,CAC3B,aAAa,EAAE,MAAM,EACrB,KAAK,GAAE,aAA0B,GAChC,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,KAAK,GAAE,aAA0B,EACjC,MAAM,GAAE,SAAmB,GAC1B,QAAQ,EAAE,CAwDZ"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Physical piano-keyboard layout. Pure arithmetic — no React, no store — so
|
|
3
|
+
* the key positions are unit-testable on their own.
|
|
4
|
+
*
|
|
5
|
+
* Here rather than in an app because two of them now draw a keyboard, and a
|
|
6
|
+
* second copy of this would drift from the first the moment either was tuned.
|
|
7
|
+
* It sits in music_drawing beside the score layout for the same reason that
|
|
8
|
+
* does: it answers where something is drawn, and it needs only music_types.
|
|
9
|
+
*
|
|
10
|
+
* The piano roll modelled pitch as one uniform row per semitone. A real
|
|
11
|
+
* keyboard cannot: white keys tile edge to edge and each black key straddles
|
|
12
|
+
* the boundary *between* two whites, overlapping both.
|
|
13
|
+
*
|
|
14
|
+
* ┌─┬─┬─┬─┬─┬─┬─┐
|
|
15
|
+
* │ │█│ │█│ │ │█│ white: x = whiteIndex * w
|
|
16
|
+
* │ └┬┘ └┬┘ │ └┬┘ black: x = (whiteIndex + 1) * w - blackWidth / 2
|
|
17
|
+
* │C │D │E │F │G │
|
|
18
|
+
* └──┴──┴──┴──┴──┘
|
|
19
|
+
*/
|
|
20
|
+
import { gmPercussion, gmPercussionName, midiToPitch, pitchToString, } from '@sudobility/music_types';
|
|
21
|
+
/** A0 — the lowest key on a standard 88-key piano. */
|
|
22
|
+
export const KEYBOARD_MIN_MIDI = 21;
|
|
23
|
+
/** C8 — the highest. */
|
|
24
|
+
export const KEYBOARD_MAX_MIDI = 108;
|
|
25
|
+
/** The 88 keys span 52 whites; the blacks overlay them and add no width. */
|
|
26
|
+
export const WHITE_KEY_COUNT = 52;
|
|
27
|
+
export const FULL_RANGE = {
|
|
28
|
+
min: KEYBOARD_MIN_MIDI,
|
|
29
|
+
max: KEYBOARD_MAX_MIDI,
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Widens `range` so it begins and ends on a white key, and clamps it to the
|
|
33
|
+
* 88-key piano.
|
|
34
|
+
*
|
|
35
|
+
* A keyboard whose first or last key is black looks broken — a black key has no
|
|
36
|
+
* white neighbour to hang off on that side, so it would float. Widening is
|
|
37
|
+
* always safe: it only ever adds a key the instrument nearly reaches.
|
|
38
|
+
*/
|
|
39
|
+
export function snapToWhiteKeys(range) {
|
|
40
|
+
let min = Math.max(KEYBOARD_MIN_MIDI, Math.min(range.min, range.max));
|
|
41
|
+
let max = Math.min(KEYBOARD_MAX_MIDI, Math.max(range.min, range.max));
|
|
42
|
+
while (min > KEYBOARD_MIN_MIDI && isBlackKey(min))
|
|
43
|
+
min -= 1;
|
|
44
|
+
while (max < KEYBOARD_MAX_MIDI && isBlackKey(max))
|
|
45
|
+
max += 1;
|
|
46
|
+
// If clamping left an edge black (the very ends of the piano), step inward.
|
|
47
|
+
while (isBlackKey(min) && min < max)
|
|
48
|
+
min += 1;
|
|
49
|
+
while (isBlackKey(max) && max > min)
|
|
50
|
+
max -= 1;
|
|
51
|
+
return { min, max };
|
|
52
|
+
}
|
|
53
|
+
/** How many white keys a range spans, which is what sets the keyboard's width. */
|
|
54
|
+
export function whiteKeyCount(range = FULL_RANGE) {
|
|
55
|
+
let count = 0;
|
|
56
|
+
for (let midi = range.min; midi <= range.max; midi += 1)
|
|
57
|
+
if (!isBlackKey(midi))
|
|
58
|
+
count += 1;
|
|
59
|
+
return count;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Below this the keys stop shrinking and the keyboard scrolls horizontally
|
|
63
|
+
* instead — 52 × 14 = 728px, so any narrower panel scrolls.
|
|
64
|
+
*/
|
|
65
|
+
export const MIN_WHITE_KEY_WIDTH = 14;
|
|
66
|
+
/** Black-key size, as a fraction of a white key. */
|
|
67
|
+
export const BLACK_KEY_WIDTH_RATIO = 0.6;
|
|
68
|
+
export const BLACK_KEY_HEIGHT_RATIO = 0.62;
|
|
69
|
+
/** Height of one row of key labels, and so of the gutter a keyboard needs per row. */
|
|
70
|
+
export const LABEL_ROW_HEIGHT = 12;
|
|
71
|
+
/** True for the five black keys per octave (pitch classes 1, 3, 6, 8, 10). */
|
|
72
|
+
export function isBlackKey(midi) {
|
|
73
|
+
const pitchClass = ((midi % 12) + 12) % 12;
|
|
74
|
+
return [1, 3, 6, 8, 10].includes(pitchClass);
|
|
75
|
+
}
|
|
76
|
+
/** A midi number as a pitch string, e.g. `C4`, `F#3` — sharp spelling, since a keyboard has no key signature to spell against. */
|
|
77
|
+
export function noteLabel(midi) {
|
|
78
|
+
return pitchToString(midiToPitch(midi));
|
|
79
|
+
}
|
|
80
|
+
/** Total width of the keyboard at a given white-key width. */
|
|
81
|
+
export function keyboardWidth(whiteKeyWidth, range = FULL_RANGE) {
|
|
82
|
+
return whiteKeyCount(range) * whiteKeyWidth;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Every key, whites first and blacks second.
|
|
86
|
+
*
|
|
87
|
+
* That order IS the z-order: a caller can render the array straight through
|
|
88
|
+
* and the blacks land on top of the whites they overlap, with no z-index
|
|
89
|
+
* bookkeeping.
|
|
90
|
+
*/
|
|
91
|
+
export function computeKeys(whiteKeyWidth, whiteKeyHeight, range = FULL_RANGE, naming = 'pitch') {
|
|
92
|
+
const whites = [];
|
|
93
|
+
const blacks = [];
|
|
94
|
+
const blackWidth = whiteKeyWidth * BLACK_KEY_WIDTH_RATIO;
|
|
95
|
+
const blackHeight = whiteKeyHeight * BLACK_KEY_HEIGHT_RATIO;
|
|
96
|
+
const drums = naming === 'percussion';
|
|
97
|
+
// `whiteIndex` counts only the whites seen so far, which is what positions
|
|
98
|
+
// both kinds: a white sits at its own index, and a black hangs off the
|
|
99
|
+
// boundary after the white that precedes it.
|
|
100
|
+
let whiteIndex = 0;
|
|
101
|
+
for (let midi = range.min; midi <= range.max; midi += 1) {
|
|
102
|
+
const pitch = midiToPitch(midi);
|
|
103
|
+
const isLandmark = pitch.accidental === 0 && (pitch.step === 'C' || pitch.step === 'F');
|
|
104
|
+
// On a drum kit every key is a different instrument, so every key is worth
|
|
105
|
+
// labelling — the landmark rule exists because pitch names are predictable
|
|
106
|
+
// from a reference, and drum names are not.
|
|
107
|
+
const label = drums
|
|
108
|
+
? (gmPercussion(midi)?.short ?? null)
|
|
109
|
+
: isLandmark
|
|
110
|
+
? noteLabel(midi)
|
|
111
|
+
: null;
|
|
112
|
+
const name = drums ? gmPercussionName(midi) : noteLabel(midi);
|
|
113
|
+
if (isBlackKey(midi)) {
|
|
114
|
+
blacks.push({
|
|
115
|
+
midi,
|
|
116
|
+
isBlack: true,
|
|
117
|
+
x: whiteIndex * whiteKeyWidth - blackWidth / 2,
|
|
118
|
+
width: blackWidth,
|
|
119
|
+
height: blackHeight,
|
|
120
|
+
// A black key is never a pitch landmark, but it is a drum of its own:
|
|
121
|
+
// Closed Hi-Hat is F#, and leaving it blank would drop the most-played
|
|
122
|
+
// piece of the kit off the labelled keyboard.
|
|
123
|
+
label: drums ? label : null,
|
|
124
|
+
name,
|
|
125
|
+
// Second row: clear of the white keys and of their labels.
|
|
126
|
+
labelTop: whiteKeyHeight + 1 + LABEL_ROW_HEIGHT,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
whites.push({
|
|
131
|
+
midi,
|
|
132
|
+
isBlack: false,
|
|
133
|
+
x: whiteIndex * whiteKeyWidth,
|
|
134
|
+
width: whiteKeyWidth,
|
|
135
|
+
height: whiteKeyHeight,
|
|
136
|
+
label,
|
|
137
|
+
name,
|
|
138
|
+
labelTop: whiteKeyHeight + 1,
|
|
139
|
+
});
|
|
140
|
+
whiteIndex += 1;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return [...whites, ...blacks];
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=keyboard-geometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboard-geometry.js","sourceRoot":"","sources":["../src/keyboard-geometry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,aAAa,GACd,MAAM,yBAAyB,CAAC;AAEjC,sDAAsD;AACtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,wBAAwB;AACxB,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AACrC,4EAA4E;AAC5E,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AASlC,MAAM,CAAC,MAAM,UAAU,GAAkB;IACvC,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,iBAAiB;CACvB,CAAC;AAEF;;;;;;;G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YACH,UAAU,IAAI,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What printing *is*, as decisions over a layout plan.
|
|
3
|
+
*
|
|
4
|
+
* Page mode, one ink, no editor state, no track gutter — none of which is a
|
|
5
|
+
* property of a browser or of a phone, which is why this sits beside
|
|
6
|
+
* `paginate` rather than in either app. The two apps then differ only in how
|
|
7
|
+
* they get a drawing onto paper: the web scales canvases through a print
|
|
8
|
+
* stylesheet, and the native app hands page images to the platform's print
|
|
9
|
+
* service.
|
|
10
|
+
*
|
|
11
|
+
* Pure over a `LayoutPlan` — no DOM, no store, no renderer — so the decisions
|
|
12
|
+
* are testable without drawing anything.
|
|
13
|
+
*/
|
|
14
|
+
import type { CanvasRenderOptions } from './canvas-renderer.js';
|
|
15
|
+
import type { LayoutPlan } from './layout.js';
|
|
16
|
+
import { type RenderTheme } from './types.js';
|
|
17
|
+
/**
|
|
18
|
+
* Logical width the score is laid out at.
|
|
19
|
+
*
|
|
20
|
+
* Not a paper width: each system is scaled onto whatever page the printer
|
|
21
|
+
* has. What this number actually decides is how many measures fit on a line —
|
|
22
|
+
* wide enough to be musical, narrow enough that the scaled-down result stays
|
|
23
|
+
* legible.
|
|
24
|
+
*/
|
|
25
|
+
export declare const PRINT_WIDTH = 1000;
|
|
26
|
+
/** Backing-store scale. Roughly 300dpi once scaled onto the page. */
|
|
27
|
+
export declare const PRINT_SCALE = 3;
|
|
28
|
+
/**
|
|
29
|
+
* One system's slice of the layout: the vertical band to draw for it.
|
|
30
|
+
*
|
|
31
|
+
* Not a page — a page is a *set* of these, chosen by `paginate`. The two were
|
|
32
|
+
* the same thing until page turns had to land on rests.
|
|
33
|
+
*/
|
|
34
|
+
export type PrintSystemSlice = {
|
|
35
|
+
systemIndex: number;
|
|
36
|
+
top: number;
|
|
37
|
+
bottom: number;
|
|
38
|
+
height: number;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Render options for print: page mode, one ink, no gutter, no editing state.
|
|
42
|
+
*
|
|
43
|
+
* The palette defaults to `DEFAULT_PRINT_RENDER_THEME`, which is monochrome.
|
|
44
|
+
* A printed part has no active track, no selection and no playhead, so every
|
|
45
|
+
* state colour on paper is a colour that means nothing to the person reading
|
|
46
|
+
* from it — and on a monochrome printer it is a grey note among black ones.
|
|
47
|
+
*
|
|
48
|
+
* Editing state is *omitted* rather than blanked — an absent `noteColors` is
|
|
49
|
+
* how the renderer is told "everything is normal", and an empty map would say
|
|
50
|
+
* the same thing less clearly.
|
|
51
|
+
*/
|
|
52
|
+
export declare function printRenderOptions(trackIds?: readonly string[], theme?: RenderTheme): Omit<CanvasRenderOptions, 'viewport'>;
|
|
53
|
+
/**
|
|
54
|
+
* One slice per system, each spanning its measure-number band to its bottom.
|
|
55
|
+
*
|
|
56
|
+
* `gutterTop`, not `yTop`: measure numbers are drawn above the stave, and
|
|
57
|
+
* slicing at `yTop` would cut them off.
|
|
58
|
+
*/
|
|
59
|
+
export declare function printSystems(plan: LayoutPlan): PrintSystemSlice[];
|
|
60
|
+
//# sourceMappingURL=print-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"print-layout.d.ts","sourceRoot":"","sources":["../src/print-layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1E;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,OAAO,CAAC;AAEhC,qEAAqE;AACrE,eAAO,MAAM,WAAW,IAAI,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,GAAE,SAAS,MAAM,EAAO,EAChC,KAAK,GAAE,WAAwC,GAC9C,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAYvC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,gBAAgB,EAAE,CAOjE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { DEFAULT_PRINT_RENDER_THEME } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Logical width the score is laid out at.
|
|
4
|
+
*
|
|
5
|
+
* Not a paper width: each system is scaled onto whatever page the printer
|
|
6
|
+
* has. What this number actually decides is how many measures fit on a line —
|
|
7
|
+
* wide enough to be musical, narrow enough that the scaled-down result stays
|
|
8
|
+
* legible.
|
|
9
|
+
*/
|
|
10
|
+
export const PRINT_WIDTH = 1000;
|
|
11
|
+
/** Backing-store scale. Roughly 300dpi once scaled onto the page. */
|
|
12
|
+
export const PRINT_SCALE = 3;
|
|
13
|
+
/**
|
|
14
|
+
* Render options for print: page mode, one ink, no gutter, no editing state.
|
|
15
|
+
*
|
|
16
|
+
* The palette defaults to `DEFAULT_PRINT_RENDER_THEME`, which is monochrome.
|
|
17
|
+
* A printed part has no active track, no selection and no playhead, so every
|
|
18
|
+
* state colour on paper is a colour that means nothing to the person reading
|
|
19
|
+
* from it — and on a monochrome printer it is a grey note among black ones.
|
|
20
|
+
*
|
|
21
|
+
* Editing state is *omitted* rather than blanked — an absent `noteColors` is
|
|
22
|
+
* how the renderer is told "everything is normal", and an empty map would say
|
|
23
|
+
* the same thing less clearly.
|
|
24
|
+
*/
|
|
25
|
+
export function printRenderOptions(trackIds = [], theme = DEFAULT_PRINT_RENDER_THEME) {
|
|
26
|
+
return {
|
|
27
|
+
zoom: 1,
|
|
28
|
+
// Never continuous: that is one system as wide as the piece, which on
|
|
29
|
+
// paper is a single unreadable strip.
|
|
30
|
+
layoutMode: 'page',
|
|
31
|
+
width: PRINT_WIDTH,
|
|
32
|
+
theme,
|
|
33
|
+
showTrackInfo: false,
|
|
34
|
+
...(trackIds.length > 0 ? { trackIds: [...trackIds] } : {}),
|
|
35
|
+
devicePixelRatio: PRINT_SCALE,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* One slice per system, each spanning its measure-number band to its bottom.
|
|
40
|
+
*
|
|
41
|
+
* `gutterTop`, not `yTop`: measure numbers are drawn above the stave, and
|
|
42
|
+
* slicing at `yTop` would cut them off.
|
|
43
|
+
*/
|
|
44
|
+
export function printSystems(plan) {
|
|
45
|
+
return plan.systems.map((system, systemIndex) => ({
|
|
46
|
+
systemIndex,
|
|
47
|
+
top: system.gutterTop,
|
|
48
|
+
bottom: system.yBottom,
|
|
49
|
+
height: system.yBottom - system.gutterTop,
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=print-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"print-layout.js","sourceRoot":"","sources":["../src/print-layout.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,0BAA0B,EAAoB,MAAM,YAAY,CAAC;AAE1E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC;AAEhC,qEAAqE;AACrE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAe7B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAChC,WAA8B,EAAE,EAChC,QAAqB,0BAA0B;IAE/C,OAAO;QACL,IAAI,EAAE,CAAC;QACP,sEAAsE;QACtE,sCAAsC;QACtC,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,WAAW;QAClB,KAAK;QACL,aAAa,EAAE,KAAK;QACpB,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,gBAAgB,EAAE,WAAW;KAC9B,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,IAAgB;IAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;QAChD,WAAW;QACX,GAAG,EAAE,MAAM,CAAC,SAAS;QACrB,MAAM,EAAE,MAAM,CAAC,OAAO;QACtB,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,SAAS;KAC1C,CAAC,CAAC,CAAC;AACN,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -78,11 +78,22 @@ export declare const PRINT_INK = "#000000";
|
|
|
78
78
|
export declare const DEFAULT_SCREEN_RENDER_THEME: RenderTheme;
|
|
79
79
|
/** A monochrome theme for callers that render paper-first surfaces. */
|
|
80
80
|
export declare const DEFAULT_PRINT_RENDER_THEME: RenderTheme;
|
|
81
|
+
/**
|
|
82
|
+
* How a score is packed onto the surface it is drawn on.
|
|
83
|
+
*
|
|
84
|
+
* Declared as an array with the type read off it, not as a bare union: a
|
|
85
|
+
* TypeScript union has no runtime form, so a picker offering these — and there
|
|
86
|
+
* is one in each app's toolbar — would otherwise have to write the list out
|
|
87
|
+
* again, which is how one of them comes to offer a mode the renderer no longer
|
|
88
|
+
* has.
|
|
89
|
+
*/
|
|
90
|
+
export declare const LAYOUT_MODES: readonly ["page", "continuous"];
|
|
91
|
+
export type LayoutMode = (typeof LAYOUT_MODES)[number];
|
|
81
92
|
export type RenderOptions = {
|
|
82
93
|
/** Linear scale factor applied to the whole render (measure width, stave height, font size). */
|
|
83
94
|
zoom: number;
|
|
84
95
|
/** "page" wraps systems to fit `width`; "continuous" lays out every measure in one long system. */
|
|
85
|
-
layoutMode:
|
|
96
|
+
layoutMode: LayoutMode;
|
|
86
97
|
/**
|
|
87
98
|
* Drawing target. Screen renders use the full UI state palette; print
|
|
88
99
|
* renders suppress transient editor state and draw notation in one ink.
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,oGAAoG;AACpG,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,CAAC;AAE9E,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE5C,KAAK,oBAAoB,GAAG;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,UAAU,CAIvE;AAED,yEAAyE;AACzE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAE1E;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;OAUG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,oHAAoH;IACpH,KAAK,EAAE,MAAM,CAAC;IACd;;;;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ED
|
@@ -53,4 +53,14 @@ export const DEFAULT_PRINT_RENDER_THEME = {
|
|
|
53
53
|
caret: PRINT_INK,
|
|
54
54
|
printForeground: PRINT_INK,
|
|
55
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* How a score is packed onto the surface it is drawn on.
|
|
58
|
+
*
|
|
59
|
+
* Declared as an array with the type read off it, not as a bare union: a
|
|
60
|
+
* TypeScript union has no runtime form, so a picker offering these — and there
|
|
61
|
+
* is one in each app's toolbar — would otherwise have to write the list out
|
|
62
|
+
* again, which is how one of them comes to offer a mode the renderer no longer
|
|
63
|
+
* has.
|
|
64
|
+
*/
|
|
65
|
+
export const LAYOUT_MODES = ['page', 'continuous'];
|
|
56
66
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,OAA6B;IACzD,OAAO,CACL,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,aAAa,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAC7E,CAAC;AACJ,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,mBAAmB,CAAC,OAA6B;IAC/D,OAAO,OAAO,CAAC,aAAa,IAAI,aAAa,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;AACtE,CAAC;AAiDD,uCAAuC;AACvC,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC;AAEnC;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAgB;IACtD,UAAU,EAAE,SAAS;IACrB,UAAU,EAAE,SAAS;IACrB,YAAY,EAAE,SAAS;IACvB,YAAY,EAAE,SAAS;IACvB,eAAe,EAAE,SAAS;IAC1B,WAAW,EAAE,SAAS;IACtB,gBAAgB,EA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EAAE,SAAS;IACxB,KAAK,EAAE,SAAS;IAChB,eAAe,EAAE,SAAS;CAC3B,CAAC;AAEF,uEAAuE;AACvE,MAAM,CAAC,MAAM,0BAA0B,GAAgB;IACrD,UAAU,EAAE,SAAS;IACrB,UAAU,EAAE,SAAS;IACrB,YAAY,EAAE,SAAS;IACvB,YAAY,EAAE,SAAS;IACvB,eAAe,EAAE,SAAS;IAC1B,WAAW,EAAE,SAAS;IACtB,gBAAgB,EAAE,SAAS;IAC3B,WAAW,EAAE,SAAS;IACtB,aAAa,EAAE,SAAS;IACxB,KAAK,EAAE,SAAS;IAChB,eAAe,EAAE,SAAS;CAC3B,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,YAAY,CAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudobility/music_drawing",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "Canvas score rendering for Moosiac: layout, VexFlow drawing and the paint loop.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -10,15 +10,18 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
|
-
"import": "./dist/index.js"
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"default": "./dist/index.js"
|
|
14
15
|
},
|
|
15
16
|
"./skia": {
|
|
16
17
|
"types": "./dist/skia/index.d.ts",
|
|
17
|
-
"import": "./dist/skia/index.js"
|
|
18
|
+
"import": "./dist/skia/index.js",
|
|
19
|
+
"default": "./dist/skia/index.js"
|
|
18
20
|
},
|
|
19
21
|
"./test": {
|
|
20
22
|
"types": "./dist/test/index.d.ts",
|
|
21
|
-
"import": "./dist/test/index.js"
|
|
23
|
+
"import": "./dist/test/index.js",
|
|
24
|
+
"default": "./dist/test/index.js"
|
|
22
25
|
}
|
|
23
26
|
},
|
|
24
27
|
"files": [
|
|
@@ -41,11 +44,11 @@
|
|
|
41
44
|
"vexflow": "^4.2.5"
|
|
42
45
|
},
|
|
43
46
|
"peerDependencies": {
|
|
44
|
-
"@sudobility/music_types": "^0.13.
|
|
47
|
+
"@sudobility/music_types": "^0.13.10"
|
|
45
48
|
},
|
|
46
49
|
"devDependencies": {
|
|
47
50
|
"@eslint/js": "^9.38.0",
|
|
48
|
-
"@sudobility/music_types": "^0.13.
|
|
51
|
+
"@sudobility/music_types": "^0.13.10",
|
|
49
52
|
"@sudobility/types": "^1.9.66",
|
|
50
53
|
"@tonejs/midi": "^2.0.28",
|
|
51
54
|
"@types/jsdom": "^30.0.0",
|