@dsebastien/music-notation 0.19.1 → 0.20.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/README.md +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +558 -3
- package/dist/index.js.map +8 -5
- package/dist/music-notation.css +35 -0
- package/dist/music-notation.publish.min.js +70 -35
- package/dist/music-notation.tab.min.js +42 -7
- package/dist/playback/bar-parts.d.ts +3 -0
- package/dist/playback/player.d.ts +5 -0
- package/dist/playback/sampled.d.ts +42 -0
- package/dist/playback/soundfont.d.ts +82 -0
- package/dist/playback/soundfont.fixture.d.ts +28 -0
- package/dist/publish/index.js +5 -3
- package/dist/publish/index.js.map +4 -4
- package/dist/tab/full-screen.d.ts +19 -0
- package/dist/tab/index.d.ts +14 -0
- package/dist/tab/index.js +364 -17
- package/dist/tab/index.js.map +7 -5
- package/dist/tab/instruments.d.ts +63 -0
- package/package.json +6 -2
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One soundfont per instrument (#108, #124): a folder made by `scripts/sounds/split-soundfont.ts`
|
|
3
|
+
* holds a small soundfont for each General MIDI program (`p025.sf3`), the drum kit, the
|
|
4
|
+
* metronome's click alone, and an `index.json` that names them. A score, or the diagrams' player,
|
|
5
|
+
* loads only the files of what it plays: a chord diagram one guitar (about 110 KB with
|
|
6
|
+
* GeneralUser GS), where a whole bank is megabytes.
|
|
7
|
+
*
|
|
8
|
+
* Nothing here knows alphaTab: `instrumentSounds` finds and reads the files, its caller loads them.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Where the instrument files are: the URL of their folder (web pages), or a function that reads
|
|
12
|
+
* one of them by its name, `index.json` included (an app that ships them or keeps them in a
|
|
13
|
+
* vault); it gives null for a file it doesn't have.
|
|
14
|
+
*/
|
|
15
|
+
export type InstrumentSource = string | ((file: string) => Promise<Uint8Array | null>);
|
|
16
|
+
/**
|
|
17
|
+
* A web page's instrument folder: `play: { instruments: '<folder URL>' }` in its options
|
|
18
|
+
* (`window.musicNotationOptions`). The library has no address of its own for the sounds (#124):
|
|
19
|
+
* a page says where its folder is (its own site, or any host), else the whole soundfont plays.
|
|
20
|
+
*/
|
|
21
|
+
export declare function pageInstruments(options: unknown): string | undefined;
|
|
22
|
+
/** The folder's `index.json`, as far as playing needs it. */
|
|
23
|
+
export interface InstrumentIndex {
|
|
24
|
+
/** By General MIDI program, 0 to 127. */
|
|
25
|
+
programs: Record<string, {
|
|
26
|
+
file: string;
|
|
27
|
+
} | undefined>;
|
|
28
|
+
drums?: {
|
|
29
|
+
file: string;
|
|
30
|
+
} | null;
|
|
31
|
+
/** The kit's metronome click alone, for scores without drums. */
|
|
32
|
+
click?: {
|
|
33
|
+
file: string;
|
|
34
|
+
} | null;
|
|
35
|
+
}
|
|
36
|
+
/** What something plays: its programs, and whether it has drums. */
|
|
37
|
+
export interface Sounds {
|
|
38
|
+
programs: number[];
|
|
39
|
+
drums: boolean;
|
|
40
|
+
/** False leaves the click out: it is loaded already (sounds added to a player later). */
|
|
41
|
+
click?: boolean;
|
|
42
|
+
}
|
|
43
|
+
/** The programs and the drums of a score's tracks. */
|
|
44
|
+
export declare function soundsOfScore(score: {
|
|
45
|
+
tracks: {
|
|
46
|
+
isPercussion: boolean;
|
|
47
|
+
playbackInfo: {
|
|
48
|
+
program: number;
|
|
49
|
+
};
|
|
50
|
+
}[];
|
|
51
|
+
}): Sounds;
|
|
52
|
+
/**
|
|
53
|
+
* The files `sounds` needs, in the order they load: each program's, then the drum kit, or the
|
|
54
|
+
* click alone when nothing plays drums (the metronome and the count-in need it). Null when the
|
|
55
|
+
* folder lacks one of the programs or the kit: the whole soundfont plays then.
|
|
56
|
+
*/
|
|
57
|
+
export declare function filesOf(index: InstrumentIndex, sounds: Sounds): string[] | null;
|
|
58
|
+
/**
|
|
59
|
+
* Reads the instrument files of `source` for `sounds`: the bytes of each, in loading order. Null
|
|
60
|
+
* when the index or one file can't be read, or the folder lacks a sound: nothing is half loaded,
|
|
61
|
+
* the caller plays its whole soundfont. Never throws.
|
|
62
|
+
*/
|
|
63
|
+
export declare function instrumentSounds(source: InstrumentSource, sounds: Sounds, win: Window): Promise<Uint8Array[] | null>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsebastien/music-notation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Chord diagrams, piano keyboards, fretboards and ChordPro charts rendered as SVG and HTML, with no framework. Works in Obsidian, on Obsidian Publish and on any web page.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Sébastien Dubois",
|
|
@@ -145,11 +145,15 @@
|
|
|
145
145
|
"tmp": "0.2.7"
|
|
146
146
|
},
|
|
147
147
|
"peerDependencies": {
|
|
148
|
-
"@coderline/alphatab": "^1.9.0"
|
|
148
|
+
"@coderline/alphatab": "^1.9.0",
|
|
149
|
+
"@dsebastien/music-notation-sounds": "^0.1.1"
|
|
149
150
|
},
|
|
150
151
|
"peerDependenciesMeta": {
|
|
151
152
|
"@coderline/alphatab": {
|
|
152
153
|
"optional": true
|
|
154
|
+
},
|
|
155
|
+
"@dsebastien/music-notation-sounds": {
|
|
156
|
+
"optional": true
|
|
153
157
|
}
|
|
154
158
|
}
|
|
155
159
|
}
|