You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-14Lines changed: 14 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,10 @@ js-synthesizer
5
5
6
6
js-synthesizer is a library that generates audio data (frames). [WebAssembly (wasm) version of FluidSynth](https://github.com/jet2jet/fluidsynth-emscripten) is used as a core synthesizer engine.
(Above example uses Web Audio API, but you can use `Synthesizer` without Web Audio, by using `render()` method.)
71
75
72
-
If you prefer to load js-synthesizer as an ES module, you can use `import` statement such as `import * as JSSynth from 'js-synthesizer'`.
76
+
js-synthesizer is built as UMD module. If you prefer to load js-synthesizer as a CommonJS / ES module, you can use `import` statement such as `import * as JSSynth from 'js-synthesizer'` by using bundlers (such as webpack).
73
77
74
78
Notes:
75
79
76
80
*`js-synthesizer.js` intends the ES2015-supported environment. If you need to run the script without errors on non-ES2015 environment such as IE11 (to notify 'unsupported'), you should load those scripts dynamically, or use transpiler such as babel.
77
-
* When just after the scripts loaded, some APIs may fail since libfluidsynth is not ready. To avoid this, you can use the Promise object returned by `JSSynth.waitForReady`.
78
-
* libfluidsynth JS file is not `import`-able and its license (LGPL v2.1) is differ from js-synthesizer's (BSD-3-Clause).
81
+
* When just after the scripts loaded, some APIs may fail since libfluidsynth is not ready. To avoid this, you can use the Promise object returned by `JSSynth.waitForReady` as above example.
82
+
* libfluidsynth JS file is not `import`-able and its license (LGPL v2.1) is different from js-synthesizer's (BSD-3-Clause).
(You can also load js-synthesizer as an ES Module from the Web Worker.)
122
-
123
125
Note that since the Web Audio is not supported on the Web Worker, the APIs/methods related to the Web Audio will not work. If you want to use both Web Worker and AudioWorklet, you should implement AudioWorkletProcessor manually as followings:
124
126
125
127
* main thread -- create AudioWorkletNode and establish connections between Web Worker and AudioWorklet
126
-
* You must transfer rendered audio frames from Web Worker to AudioWorklet because AudioWorklet environment does not support creating Web Worker. By creating `MessageChannel` and sending its port instances to Web Worker and AudioWorklet, they can communicate each other directly.
128
+
* You need to transfer rendered audio frames from Web Worker to AudioWorklet, but AudioWorklet environment does not support creating Web Worker. By creating `MessageChannel` and sending its port instances to Web Worker and AudioWorklet, they can communicate each other directly.
127
129
* Web Worker thread -- render audio frames into raw buffers and send it for AudioWorklet thread
128
-
* AudioWorklet thread -- receive audio frames and 'render' it in the `process` method
130
+
* AudioWorklet thread -- receive audio frames (and queue) and 'render' it in the `process` method
129
131
130
132
## API
131
133
@@ -137,7 +139,7 @@ These classes implement the interface named `JSSynth.ISynthesizer`.
137
139
* Creates the general synthesizer instance. No parameters are available.
The sequencer also supports 'user-defined client' to handle event data.
202
202
203
203
* For sequncer instance created by `Synthesizer.createSequencer`, use `Synthesizer.registerSequencerClient` static method.
204
-
* You can use `Synthesizer.sendEventNow` static method to event data processed by the synthesizer or another clients.
204
+
* You can use `Synthesizer.sendEventNow` static method to send event data, processed by the synthesizer or clients, to another clients/synthesizers.
205
205
* For sequncer instance created by `createSequencer` of `AudioWorkletNodeSynthesizer`, use `registerSequencerClientByName` instance method.
206
206
* The callback function must be added to 'AudioWorkletGlobalScope' like `hookPlayerMIDIEventsByName`'s callback.
207
207
* To re-send event data, use `Synthesizer.sendEventNow` in the worklet. `Synthesizer` constructor is available via `AudioWorkletGlobalScope.JSSynth.Synthesizer`.
208
-
* You can rewrite event data passed to the callback, with using `JSSynth.rewriteEventData` (`AudioWorkletGlobalScope.JSSynth.rewriteEventData` for worklet).
208
+
* You can rewrite event data passed to the callback, by using `JSSynth.rewriteEventData` (`AudioWorkletGlobalScope.JSSynth.rewriteEventData` for worklet).
0 commit comments