@dsebastien/music-notation 0.25.0 → 0.26.1
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 +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +361 -18
- package/dist/index.js.map +9 -8
- package/dist/music-notation.publish.min.js +36 -36
- package/dist/music-notation.tab.min.js +7 -7
- package/dist/playback/controls.d.ts +28 -0
- package/dist/playback/effects.d.ts +142 -0
- package/dist/playback/player.d.ts +14 -0
- package/dist/publish/index.js +354 -14
- package/dist/publish/index.js.map +8 -7
- package/dist/tab/index.d.ts +7 -0
- package/dist/tab/index.js +468 -4
- package/dist/tab/index.js.map +8 -6
- package/dist/tab/room.d.ts +45 -0
- package/dist/theory/suffix.d.ts +6 -0
- package/dist/voicings/index.js +8 -3
- package/dist/voicings/index.js.map +4 -4
- package/package.json +5 -5
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* alphaTab's sound through the library's room and ceiling (#103). alphaTab has no reverb of its
|
|
3
|
+
* own and gives no place to plug one in: each time it starts to play, it makes an output node and
|
|
4
|
+
* connects it to its context's `destination`.
|
|
5
|
+
*
|
|
6
|
+
* So the context gets a `destination` of its own (a property on the object, over the browser's):
|
|
7
|
+
* at each start alphaTab reads it and connects its node to what it gets, the chain's entry for
|
|
8
|
+
* this play, or the speakers for `dry`. The node never sounds outside the chain. A first version
|
|
9
|
+
* moved the node after alphaTab had connected it: the first 20 ms of each play went out
|
|
10
|
+
* directly, then jumped into the chain (whose limiter, gone since, was 6 ms late).
|
|
11
|
+
*
|
|
12
|
+
* When the property can't be set, or the context was made too late for the first play, the node
|
|
13
|
+
* is moved as before. It is in a field alphaTab keeps to itself, and its name differs between
|
|
14
|
+
* alphaTab's builds (the minified one shortens it). So the node is found by what it is: the one
|
|
15
|
+
* audio node the output holds besides its `source` (a public field, like `context`). When nothing
|
|
16
|
+
* is found (another alphaTab, another output), nothing is changed: the sound stays as it was.
|
|
17
|
+
* `room.spec.ts` fails when the alphaTab in use no longer has those public fields, or no longer
|
|
18
|
+
* connects to its context's `destination`.
|
|
19
|
+
*/
|
|
20
|
+
import type * as AT from '@coderline/alphatab';
|
|
21
|
+
import { type PlayEffects } from '../playback/effects.js';
|
|
22
|
+
import type { GuitarTone } from '../playback/guitar-tone.js';
|
|
23
|
+
/** What plays now, read when alphaTab starts: its effects, and its guitar for the amplifier. */
|
|
24
|
+
export interface RoomOf {
|
|
25
|
+
effects: () => PlayEffects | null | undefined;
|
|
26
|
+
/** The one guitar that plays (the diagrams' player); none for a score with its own tracks. */
|
|
27
|
+
guitar?: () => GuitarTone | null | undefined;
|
|
28
|
+
}
|
|
29
|
+
/** The output node alphaTab made for this play, and its context; null when it isn't there (yet). */
|
|
30
|
+
export declare function outputNodeOf(player: unknown): {
|
|
31
|
+
ctx: BaseAudioContext;
|
|
32
|
+
node: AudioNode;
|
|
33
|
+
} | null;
|
|
34
|
+
/** alphaTab's context, when it has one already (it makes it when its player opens). */
|
|
35
|
+
export declare function contextOf(player: unknown): BaseAudioContext | null;
|
|
36
|
+
/**
|
|
37
|
+
* Sends what alphaTab plays through the room and the ceiling, from now on: at each start, its
|
|
38
|
+
* new output node goes to the chain (through an electric guitar's amplifier when one is asked for
|
|
39
|
+
* and one guitar plays). `dry` gives it the speakers. `look` checks it now, for a play alphaTab
|
|
40
|
+
* starts without saying so (the one-time plays of the diagrams' player); `stop` ends it.
|
|
41
|
+
*/
|
|
42
|
+
export declare function throughRoom(api: AT.AlphaTabApi, playing: (state: unknown) => boolean, room: RoomOf, win: Pick<Window, 'setTimeout' | 'clearTimeout'>): {
|
|
43
|
+
look: () => void;
|
|
44
|
+
stop: () => void;
|
|
45
|
+
};
|
package/dist/theory/suffix.d.ts
CHANGED
|
@@ -4,5 +4,11 @@
|
|
|
4
4
|
* parentheses or commas don't form such groups (`C,`, `C()`, `C(b9`): that isn't a chord symbol.
|
|
5
5
|
*/
|
|
6
6
|
export declare function withoutParentheses(suffix: string): string | null;
|
|
7
|
+
/**
|
|
8
|
+
* Lead sheets write minor as `mi` and major as `ma`, in capitals too (Cmi7, CMA7): the suffix with
|
|
9
|
+
* `m` and `maj` instead, so they read and draw like the other spellings (#157). `min` before an
|
|
10
|
+
* alteration reads the same way (Cmin7b5 = Cm7b5).
|
|
11
|
+
*/
|
|
12
|
+
export declare const leadSheetSuffix: (suffix: string) => string;
|
|
7
13
|
/** The canonical suffix (m(maj7) has its own entry; other parentheses are dropped first). */
|
|
8
14
|
export declare function canonicalSuffix(suffix: string): string;
|
package/dist/voicings/index.js
CHANGED
|
@@ -104,7 +104,11 @@ function withoutParentheses(suffix) {
|
|
|
104
104
|
return null;
|
|
105
105
|
return suffix.replace(/[(),\s]/g, "");
|
|
106
106
|
}
|
|
107
|
+
var leadSheetSuffix = (suffix) => suffix.replace(/^(?:mi|MI|min|MIN)(?![A-Za-z])/, "m").replace(/^(?:ma|MA)(?![A-Za-z])/, "maj");
|
|
107
108
|
function canonicalSuffix(suffix) {
|
|
109
|
+
const lead = leadSheetSuffix(suffix);
|
|
110
|
+
if (lead !== suffix)
|
|
111
|
+
return canonicalSuffix(lead);
|
|
108
112
|
const direct = CANONICAL.get(suffix);
|
|
109
113
|
if (direct !== undefined)
|
|
110
114
|
return direct;
|
|
@@ -1532,9 +1536,10 @@ function parseChord(symbol) {
|
|
|
1532
1536
|
return null;
|
|
1533
1537
|
const trimmed = symbol.trim();
|
|
1534
1538
|
const { root, bass } = parts;
|
|
1535
|
-
const
|
|
1539
|
+
const lead = leadSheetSuffix(parts.suffix);
|
|
1540
|
+
const suffix = withoutParentheses(lead);
|
|
1536
1541
|
let quality = null;
|
|
1537
|
-
for (const written of suffix === null || suffix ===
|
|
1542
|
+
for (const written of suffix === null || suffix === lead ? [lead] : [lead, suffix]) {
|
|
1538
1543
|
for (const [re, label] of QUALITY_SUFFIXES) {
|
|
1539
1544
|
const hit = re.exec(written);
|
|
1540
1545
|
if (hit) {
|
|
@@ -3704,5 +3709,5 @@ export {
|
|
|
3704
3709
|
voicingCount
|
|
3705
3710
|
};
|
|
3706
3711
|
|
|
3707
|
-
//# debugId=
|
|
3712
|
+
//# debugId=3165804919086D5E64756E2164756E21
|
|
3708
3713
|
//# sourceMappingURL=index.js.map
|