@grame/faustwasm 0.0.29 → 0.0.32

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
@@ -16,12 +16,29 @@ git clone https://github.com/grame-cncm/faustwasm.git
16
16
  cd faustwasm
17
17
  ```
18
18
 
19
+ Install development dependencies:
20
+
21
+ ```bash
22
+ npm install
23
+ ```
24
+
25
+ Possibly:
26
+
27
+ ```bash
28
+ npm update
29
+ ```
30
+
19
31
  Build the files:
20
32
  ```bash
21
33
  npm run build
22
34
  ```
23
35
 
36
+ ### Versioning
37
+
38
+ You'll have to raise the package version number in `package.json` before `npm run build` to properly work.
39
+
24
40
  #### Generate WebAssembly version of a Faust DSP
41
+
25
42
  For example:
26
43
  ```bash
27
44
  rm -rf test/out # make sure you are under the faustwasm directory.
@@ -39,6 +56,7 @@ node scripts/faust2wasm.js test/rev.dsp test/out -standalone
39
56
  ```
40
57
 
41
58
  #### Generate SVG Diagrams of a Faust DSP
59
+
42
60
  For example:
43
61
  ```bash
44
62
  rm -rf test/out # make sure you are under the faustwasm directory.
@@ -47,6 +65,7 @@ node scripts/faust2svg.js test/mono.dsp test/out
47
65
  The main diagram should be in `test/out/process.svg`.
48
66
 
49
67
  #### Generate or process audio files
68
+
50
69
  Options:
51
70
  - `-bs <num>` to setup the rendering buffer size in frames (default: 64)
52
71
  - `-bd 16|24|32` to setup the output file bit-depth (default: 16)
@@ -128,6 +147,7 @@ process = ba.pulsen(1, 10000) : pm.djembe(60, 0.3, 0.4, 1);
128
147
  ```
129
148
 
130
149
  ### Use in a web browser
150
+
131
151
  ```JavaScript
132
152
 
133
153
  (async () => {
@@ -195,13 +215,13 @@ process = ba.pulsen(1, 10000) : pm.djembe(60, 0.3, 0.4, 1);
195
215
  - [Important note](#note)
196
216
 
197
217
 
198
- ## Organisation of the API <a name="org"></a>
218
+ ### Organisation of the API <a name="org"></a>
199
219
 
200
220
  The API is organised from low to high level as illustrated by the figure below.
201
221
 
202
222
  <img src="rsrc/overview.png" class="mx-auto d-block" width="60%">
203
223
 
204
- ### Faust Compiler WebAssembly module <a name="module"></a>
224
+ #### Faust Compiler WebAssembly module <a name="module"></a>
205
225
 
206
226
  The first level is the Faust compiler compiled as a wasm library named `libfaust-wasm`.
207
227
  It consists in 3 different files:
@@ -221,7 +241,7 @@ It provides *classic* Faust compilation services, which output is a raw WebAssem
221
241
 
222
242
  This level takes a WebAssembly module produced by the Faust compiler or a precompiled module loaded from a file, and builds an instance of this module with the proper Wasm memory layout, ready to run. It is described in `FaustDspGenerator.ts`, `FaustWasmInstantiator.ts`, `FaustWebAudioDsp.ts` and `FaustDspInstance.ts` files.
223
243
 
224
- ### Faust Audio Nodes Instances and Offline Processor <a name="audio"></a>
244
+ #### Faust Audio Nodes Instances and Offline Processor <a name="audio"></a>
225
245
 
226
246
  This level takes a Faust Wasm instance to build an audio node. [AudioWorklet](https://developer.mozilla.org/fr/docs/Web/API/AudioWorklet) and [ScriptProcessor](https://developer.mozilla.org/en-US/docs/Web/API/ScriptProcessorNode) nodes are supported. It is described in `FaustAudioWorkletNode.ts` and `FaustAudioWorkletProcessor.ts` files.
227
247
 
@@ -233,18 +253,18 @@ By default, and to save CPU, created audio nodes are not processing audio buffer
233
253
 
234
254
  An offline processor to render a DSP in a non real-time context and get the computed frames is available. It is described in `FaustOfflineProcessor.ts`. It will automatically use the `start` and `stop` methods internally to activate actual rendering in its `plot` method.
235
255
 
236
- ### High-level API <a name="high"></a>
256
+ #### High-level API <a name="high"></a>
237
257
 
238
258
  A high-level API is available to compile a DSP program and create the audio node, either monophonic or polyphonic using `createNode`. Offline processing monophonic or polyphonic nodes can be created using `createOfflineProcessor`. FFT processing nodes can be created using `createFFTNode`. It is described in `FaustDspGenerator.ts`.
239
259
 
240
- ### How to use with typescript <a name="tsuse"></a>
260
+ #### How to use with typescript <a name="tsuse"></a>
241
261
 
242
262
  Simply include the following to get access to types and functions:
243
263
  ~~~~~~~~~~~~~~~
244
264
  ///<reference types="@grame/faustwasm"/>
245
265
  ~~~~~~~~~~~~~~~
246
266
 
247
- ## Dynamic and Static Instances <a name="ds"></a>
267
+ ### Dynamic and Static Instances <a name="ds"></a>
248
268
 
249
269
  The Faust Wasm and Audio Node levels make it possible to generate instances from Faust dsp code as well as from pre-compiled WebAssembly modules.
250
270
  In the latter case, it is not necessary to include the `libfaust-wasm.js` library, `index.js` is sufficient to provide the required services.
@@ -255,7 +275,7 @@ This allows to generate lighter and faster-loading HTML pages.
255
275
  - `FaustSvgDiagrams.ts`: provides facilities to browse Faust generated SVG diagrams
256
276
  - `FaustFFTAudioWorkletProcessor`: provides FFT processing
257
277
 
258
- ## Important note <a name="note"></a>
278
+ ### Important note <a name="note"></a>
259
279
 
260
280
  Html pages embedding the Faust compiler must be served using https, unless using http://localhost.
261
281
 
@@ -1748,7 +1748,7 @@ var FaustWasmInstantiator = class {
1748
1748
  _min_f: Math.min,
1749
1749
  _remainderf: (x, y) => x - Math.round(x / y) * y,
1750
1750
  _powf: Math.pow,
1751
- _roundf: Math.fround,
1751
+ _roundf: Math.round,
1752
1752
  _sinf: Math.sin,
1753
1753
  _sqrtf: Math.sqrt,
1754
1754
  _tanf: Math.tan,
@@ -1776,7 +1776,7 @@ var FaustWasmInstantiator = class {
1776
1776
  _min_: Math.min,
1777
1777
  _remainder: (x, y) => x - Math.round(x / y) * y,
1778
1778
  _pow: Math.pow,
1779
- _round: Math.fround,
1779
+ _round: Math.round,
1780
1780
  _sin: Math.sin,
1781
1781
  _sqrt: Math.sqrt,
1782
1782
  _tan: Math.tan,