spessasynth_lib 3.26.10 → 3.26.12

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 CHANGED
@@ -7,6 +7,13 @@
7
7
 
8
8
  *This is a WebAudioAPI wrapper for the [spessasynth_core](https://github.com/spessasus/spessasynth_core) library.*
9
9
 
10
+ **Project index**
11
+
12
+ - [spessasynth_core](https://github.com/spessasus/spessasynth_core) - SF2/DLS/MIDI library
13
+ - spessasynth_lib (you are here) – spessasynth_core wrapper optimized for browsers and WebAudioAPI
14
+ - [SpessaSynth](https://github.com/spessasus/SpessaSynth) - online/local web player/editor application
15
+
16
+
10
17
  > **TIP:**
11
18
  > Looking for a bare JS version that works without WebAudioAPI? Try [spessasynth_core](https://github.com/spessasus/spessasynth_core)!
12
19
 
@@ -38,6 +45,11 @@ document.getElementById("button").onclick = async () =>
38
45
  }
39
46
  ```
40
47
 
48
+ *Audio may sometimes sound distorted in Chromium-based browsers: Chrome, Edge, Brave,
49
+ etc. due to a **[Chromium Bug](https://issues.chromium.org/issues/367304685).**
50
+ I can't do anything about it, only hope that it gets fixed.
51
+ Please consider voting for it on the bug tracker to get it fixed!*
52
+
41
53
  ## Current Features
42
54
 
43
55
  ### [All the features of spessasynth_core!](https://github.com/spessasus/spessasynth_core?#current-features)
@@ -51,7 +63,7 @@ document.getElementById("button").onclick = async () =>
51
63
  - **Export audio files** using [OfflineAudioContext](https://developer.mozilla.org/en-US/docs/Web/API/OfflineAudioContext)
52
64
  - **Written using AudioWorklets:**
53
65
  - Runs in a **separate thread** for maximum performance
54
- - Doesn't stop playing even when the main thread is frozen
66
+ - Does not stop playing even when the main thread is frozen
55
67
  - Supported by all modern browsers
56
68
  - **High-performance mode:** Play Rush E! *note: may kill your browser ;)*
57
69
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spessasynth_lib",
3
- "version": "3.26.10",
3
+ "version": "3.26.12",
4
4
  "description": "MIDI and SoundFont2/DLS library for the browsers with no compromises",
5
5
  "browser": "index.js",
6
6
  "type": "module",
@@ -4,5 +4,6 @@
4
4
  export const DEFAULT_SEQUENCER_OPTIONS = {
5
5
  skipToFirstNoteOn: true,
6
6
  autoPlay: true,
7
- preservePlaybackState: false
7
+ preservePlaybackState: false,
8
+ initialPlaybackRate: 1
8
9
  };
@@ -41,6 +41,7 @@ import { DEFAULT_SEQUENCER_OPTIONS } from "./default_sequencer_options.js";
41
41
  * @property {boolean|undefined} autoPlay - if true, the sequencer will automatically start playing the MIDI
42
42
  * @property {boolean|unescape} preservePlaybackState - if true,
43
43
  * the sequencer will stay paused when seeking or changing the playback rate
44
+ * @property {number|undefined} initialPlaybackRate - the initial playback rate, defaults to 1.0 (normal speed)
44
45
  */
45
46
 
46
47
  // noinspection JSUnusedGlobalSymbols
@@ -174,6 +175,11 @@ export class Sequencer
174
175
  */
175
176
  this._preservePlaybackState = options?.preservePlaybackState ?? false;
176
177
 
178
+ if (options?.initialPlaybackRate !== 1)
179
+ {
180
+ this.playbackRate = options?.initialPlaybackRate ?? 1;
181
+ }
182
+
177
183
  if (this._skipToFirstNoteOn === false)
178
184
  {
179
185
  // setter sends message
@@ -200,6 +200,7 @@ class WorkletSpessaProcessor extends AudioWorkletProcessor
200
200
  );
201
201
  this.sequencer.skipToFirstNoteOn = seqOptions.skipToFirstNoteOn;
202
202
  this.sequencer.preservePlaybackState = seqOptions.preservePlaybackState;
203
+ this.sequencer.playbackRate = seqOptions.initialPlaybackRate;
203
204
  // autoplay is ignored
204
205
  try
205
206
  {