@dsebastien/music-notation 0.21.1 → 0.22.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/blocks/properties.d.ts +4 -0
- package/dist/cli.js +1 -1
- package/dist/index.js +54 -3
- package/dist/index.js.map +3 -3
- package/dist/music-notation.css +42 -0
- package/dist/music-notation.publish.min.js +72 -30
- package/dist/music-notation.tab.min.js +49 -7
- package/dist/publish/index.js +12 -3
- package/dist/publish/index.js.map +3 -3
- package/dist/tab/index.d.ts +8 -0
- package/dist/tab/index.js +148 -6
- package/dist/tab/index.js.map +5 -4
- package/dist/tab/tempo.d.ts +53 -0
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type TempoUnit = 'bpm' | 'percent';
|
|
2
|
+
/** The speeds the bar allows, as before (25 to 150 %). */
|
|
3
|
+
export declare const SPEED_MIN = 0.25;
|
|
4
|
+
export declare const SPEED_MAX = 1.5;
|
|
5
|
+
/** One step of − and + in percent. */
|
|
6
|
+
export declare const PERCENT_STEP = 5;
|
|
7
|
+
/** A tempo change: from `tick` on, `tempo` BPM. */
|
|
8
|
+
export interface TempoChange {
|
|
9
|
+
tick: number;
|
|
10
|
+
tempo: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The tempo at `tick`: the last change at or before it, in the bars of alphaTab's tick lookup
|
|
14
|
+
* (each with its start, end and tempo changes); `fallback` (the score's tempo) before the first.
|
|
15
|
+
*/
|
|
16
|
+
export declare function tempoAt(bars: readonly {
|
|
17
|
+
start: number;
|
|
18
|
+
end: number;
|
|
19
|
+
tempoChanges: readonly TempoChange[];
|
|
20
|
+
}[], tick: number, fallback: number | null): number | null;
|
|
21
|
+
/** The speed that plays `bpm` when the score is at `tempo`, within the bar's limits. */
|
|
22
|
+
export declare function speedFor(bpm: number, tempo: number): number;
|
|
23
|
+
/** The tempo `speed` plays at, rounded as the bar shows it. */
|
|
24
|
+
export declare const bpmOf: (speed: number, tempo: number) => number;
|
|
25
|
+
/** The speed one step slower (-1) or faster (+1): 1 BPM, or 5 % on the 5 % grid. */
|
|
26
|
+
export declare function stepped(speed: number, direction: 1 | -1, unit: TempoUnit, tempo: number | null): number;
|
|
27
|
+
/** What the bar writes: the value in the unit shown, and the other one. */
|
|
28
|
+
export declare function written(speed: number, unit: TempoUnit, tempo: number | null): {
|
|
29
|
+
value: string;
|
|
30
|
+
unit: string;
|
|
31
|
+
other: string;
|
|
32
|
+
};
|
|
33
|
+
/** A typed value as a speed, in the unit shown; null when it isn't a number. */
|
|
34
|
+
export declare function typed(text: string, unit: TempoUnit, tempo: number | null): number | null;
|
|
35
|
+
export interface TempoControl {
|
|
36
|
+
/** What goes on the bar. */
|
|
37
|
+
field: HTMLElement;
|
|
38
|
+
/** The speed set (0.25 to 1.5). */
|
|
39
|
+
speed(): number;
|
|
40
|
+
/** The tempo where the music is changed (a tempo change in the score): written again. */
|
|
41
|
+
refresh(): void;
|
|
42
|
+
}
|
|
43
|
+
export interface TempoOptions {
|
|
44
|
+
/** The unit shown first; BPM by default, percent when the tempo isn't known. */
|
|
45
|
+
unit?: TempoUnit;
|
|
46
|
+
/** The tempo where the music is, or null. */
|
|
47
|
+
tempo: () => number | null;
|
|
48
|
+
/** A new speed was set. */
|
|
49
|
+
set: (speed: number) => void;
|
|
50
|
+
/** The reader switched the unit (an app may remember it). */
|
|
51
|
+
unitChanged?: (unit: TempoUnit) => void;
|
|
52
|
+
}
|
|
53
|
+
export declare function tempoControl(doc: Document, options: TempoOptions): TempoControl;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsebastien/music-notation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.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",
|