@dsebastien/music-notation 0.10.1 → 0.11.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.
@@ -36,6 +36,8 @@ export interface StrumEventOptions {
36
36
  tail?: number;
37
37
  /** Varies the small differences between strums from pass to pass (the pass's number). */
38
38
  seed?: number;
39
+ /** The most time between a strum's strings, in seconds: 0.012 by default (0 a block). */
40
+ spread?: number;
39
41
  }
40
42
  /**
41
43
  * MIDI velocities: a down strum (`normal`), an up strum, an accent, a ghost strum, a muted one
@@ -106,6 +108,17 @@ export interface StrumFollower {
106
108
  heard(): void;
107
109
  stop(): void;
108
110
  }
111
+ /** One pass of a piece played in time: its notes, its length in seconds, and what to light. */
112
+ export interface Pass {
113
+ events: NoteEvent[];
114
+ /** Seconds until the next pass starts when it loops (the last note's ring not counted). */
115
+ length: number;
116
+ strums: StrumTiming[];
117
+ /** When each bar starts and how long it lasts (`slot` is the bar's index), when known. */
118
+ bars?: StrumTiming[];
119
+ }
120
+ /** What each pass is made from: the settings read at that pass, the first pass or not, its number. */
121
+ export type PassMaker = (settings: StrumSettings, first: boolean, id: number) => Pass;
109
122
  /**
110
123
  * Plays a score through `player`, pass after pass while `settings().loop` is on. Each next pass
111
124
  * is started on a timer at the exact end of the previous one, counted from the first pass's start
@@ -117,6 +130,11 @@ export interface StrumFollower {
117
130
  * them from the moment they sound.
118
131
  */
119
132
  export declare function runStrum(score: StrumScore, player: () => NotePlayer, settings: () => StrumSettings, timers: Pick<Window, 'setTimeout' | 'clearTimeout'>, onEnd?: () => void, follow?: (strums: StrumTiming[], player: NotePlayer) => StrumFollower): PlayHandle;
133
+ /**
134
+ * Plays the passes `make` returns, as `runStrum` plays a strumming pattern's (see there): the
135
+ * timing of progressions (#46) and picking patterns (#51) too.
136
+ */
137
+ export declare function runPasses(make: PassMaker, player: () => NotePlayer, settings: () => StrumSettings, timers: Pick<Window, 'setTimeout' | 'clearTimeout'>, onEnd?: () => void, follow?: (strums: StrumTiming[], player: NotePlayer, pass: Pass) => StrumFollower): PlayHandle;
120
138
  export interface PlayStrumOptions {
121
139
  /** Beats a minute: the pattern's `tempo:`, else 90 (60 dotted quarters in compound time). */
122
140
  bpm?: number;
@@ -108,6 +108,11 @@ export interface TabResult {
108
108
  }>;
109
109
  /** The alphaTab API, for exports and playback. */
110
110
  api: AT.AlphaTabApi | null;
111
+ /**
112
+ * The speed set on the player bar (0.25 to 1.5; 1 without a bar). alphaTab's `playbackSpeed`
113
+ * takes it only once the player starts (the first Play), so an app reads it here.
114
+ */
115
+ speed(): number;
111
116
  destroy(): void;
112
117
  }
113
118
  /**
package/dist/tab/index.js CHANGED
@@ -1721,6 +1721,7 @@ function playerBar(doc, api, alphaTab, assets) {
1721
1721
  });
1722
1722
  return {
1723
1723
  bar,
1724
+ speed: () => state.speed,
1724
1725
  failed: (message) => {
1725
1726
  cantStart?.();
1726
1727
  play.disabled = true;
@@ -1783,6 +1784,7 @@ function renderTab(language, source, host, options) {
1783
1784
  const el = html(doc, "div", `mn-block mn-block-${language} mn-tab`);
1784
1785
  host.appendChild(el);
1785
1786
  let api = null;
1787
+ let speedOf = () => 1;
1786
1788
  let gone = false;
1787
1789
  let settled = false;
1788
1790
  let settle = () => {};
@@ -1854,6 +1856,7 @@ function renderTab(language, source, host, options) {
1854
1856
  return;
1855
1857
  if (options.player !== false) {
1856
1858
  bar = playerBar(doc, current, at, assets);
1859
+ speedOf = bar.speed;
1857
1860
  el.appendChild(bar.bar);
1858
1861
  if (options.views !== false && tablature)
1859
1862
  bar.bar.appendChild(viewControl(doc, own, (staves) => {
@@ -1910,6 +1913,7 @@ function renderTab(language, source, host, options) {
1910
1913
  get api() {
1911
1914
  return api;
1912
1915
  },
1916
+ speed: () => speedOf(),
1913
1917
  destroy() {
1914
1918
  gone = true;
1915
1919
  try {
@@ -2086,5 +2090,5 @@ export {
2086
2090
  textTabToAlphaTex
2087
2091
  };
2088
2092
 
2089
- //# debugId=7EA581924096D5C364756E2164756E21
2093
+ //# debugId=2EE54AC69188D00D64756E2164756E21
2090
2094
  //# sourceMappingURL=index.js.map