@grame/faustwasm 0.12.2 → 0.13.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.
Files changed (81) hide show
  1. package/.prettierrc +5 -0
  2. package/README.md +21 -3
  3. package/assets/standalone/faustwasm/index.d.ts +38 -16
  4. package/assets/standalone/faustwasm/index.js +1574 -404
  5. package/assets/standalone/faustwasm/index.js.map +2 -2
  6. package/dist/cjs/index.d.ts +38 -16
  7. package/dist/cjs/index.js +1573 -404
  8. package/dist/cjs/index.js.map +2 -2
  9. package/dist/cjs-bundle/index.d.ts +38 -16
  10. package/dist/cjs-bundle/index.js +1576 -406
  11. package/dist/cjs-bundle/index.js.map +2 -2
  12. package/dist/esm/index.d.ts +38 -16
  13. package/dist/esm/index.js +1574 -404
  14. package/dist/esm/index.js.map +2 -2
  15. package/dist/esm-bundle/index.d.ts +38 -16
  16. package/dist/esm-bundle/index.js +1576 -406
  17. package/dist/esm-bundle/index.js.map +2 -2
  18. package/eslint.config.js +11 -0
  19. package/package.json +57 -51
  20. package/sound.cpp +163 -0
  21. package/sound.dsp +4 -0
  22. package/sound.json +1 -0
  23. package/sound.wasm +0 -0
  24. package/src/FaustAudioWorkletCommunicator.ts +150 -143
  25. package/src/FaustAudioWorkletNode.ts +173 -75
  26. package/src/FaustAudioWorkletProcessor.ts +218 -90
  27. package/src/FaustCmajor.ts +9 -3
  28. package/src/FaustCompiler.ts +112 -35
  29. package/src/FaustDspGenerator.ts +561 -117
  30. package/src/FaustDspInstance.ts +58 -24
  31. package/src/FaustFFTAudioWorkletProcessor.ts +822 -612
  32. package/src/FaustOfflineProcessor.ts +187 -56
  33. package/src/FaustScriptProcessorNode.ts +156 -49
  34. package/src/FaustSensors.ts +426 -96
  35. package/src/FaustSvgDiagrams.ts +18 -5
  36. package/src/FaustWasmInstantiator.ts +224 -70
  37. package/src/FaustWebAudioDsp.ts +1060 -349
  38. package/src/LibFaust.ts +13 -4
  39. package/src/SoundfileReader.ts +175 -131
  40. package/src/WavDecoder.ts +42 -20
  41. package/src/WavEncoder.ts +35 -21
  42. package/src/copyWebStandaloneAssets.d.ts +20 -5
  43. package/src/copyWebStandaloneAssets.js +203 -75
  44. package/src/exports-bundle.ts +5 -5
  45. package/src/exports.ts +24 -24
  46. package/src/faust2CmajorFiles.d.ts +7 -3
  47. package/src/faust2cmajorFiles.js +10 -8
  48. package/src/faust2svgFiles.d.ts +7 -3
  49. package/src/faust2svgFiles.js +9 -7
  50. package/src/faust2wasmFiles.d.ts +10 -5
  51. package/src/faust2wasmFiles.js +34 -17
  52. package/src/faust2wavFiles.d.ts +12 -3
  53. package/src/faust2wavFiles.js +25 -12
  54. package/src/index-bundle-iife.ts +2 -2
  55. package/src/index-bundle.ts +1 -1
  56. package/src/index.ts +1 -1
  57. package/src/instantiateFaustModule.ts +43 -36
  58. package/src/instantiateFaustModuleFromFile.ts +30 -14
  59. package/src/types.ts +101 -25
  60. package/test/faustlive-wasm/faustwasm/index.d.ts +38 -16
  61. package/test/faustlive-wasm/faustwasm/index.js +1574 -404
  62. package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
  63. package/test/web/create-faust-node.html +53 -0
  64. package/test/web/create-faust-node.js +186 -0
  65. package/test/organ/create-node.js +0 -252
  66. package/test/organ/dsp-meta.json +0 -131
  67. package/test/organ/dsp-module.wasm +0 -0
  68. package/test/organ/faust-pwa.js +0 -344
  69. package/test/organ/faust-ui/index.css +0 -442
  70. package/test/organ/faust-ui/index.css.map +0 -1
  71. package/test/organ/faust-ui/index.d.ts +0 -1
  72. package/test/organ/faust-ui/index.js +0 -3756
  73. package/test/organ/faust-ui/index.js.map +0 -1
  74. package/test/organ/faustwasm/index.d.ts +0 -1705
  75. package/test/organ/faustwasm/index.js +0 -4773
  76. package/test/organ/faustwasm/index.js.map +0 -7
  77. package/test/organ/icon.png +0 -0
  78. package/test/organ/index.html +0 -76
  79. package/test/organ/index.js +0 -69
  80. package/test/organ/manifest.json +0 -17
  81. package/test/organ/service-worker.js +0 -165
@@ -10,25 +10,30 @@ export interface IFaustDspInstance {
10
10
  * @param $inputs - the input audio buffer as in index in wasm memory
11
11
  * @param $output - the output audio buffer as in index in wasm memory
12
12
  */
13
- compute($dsp: number, count: number, $inputs: number, $output: number): void;
13
+ compute(
14
+ $dsp: number,
15
+ count: number,
16
+ $inputs: number,
17
+ $output: number
18
+ ): void;
14
19
 
15
20
  /**
16
21
  * Give the number of inputs of a Faust wasm instance.
17
- *
22
+ *
18
23
  * @param $dsp - the DSP pointer
19
24
  */
20
25
  getNumInputs($dsp: number): number;
21
26
 
22
27
  /**
23
28
  * Give the number of outputs of a Faust wasm instance.
24
- *
29
+ *
25
30
  * @param $dsp - the DSP pointer
26
31
  */
27
32
  getNumOutputs($dsp: number): number;
28
33
 
29
34
  /**
30
35
  * Give a parameter current value.
31
- *
36
+ *
32
37
  * @param $dsp - the DSP pointer
33
38
  * @param index - the parameter index
34
39
  * @return the parameter value
@@ -37,7 +42,7 @@ export interface IFaustDspInstance {
37
42
 
38
43
  /**
39
44
  * Give the Faust wasm instance sample rate.
40
- *
45
+ *
41
46
  * @param $dsp - the DSP pointer
42
47
  * @return the sample rate
43
48
  */
@@ -54,34 +59,34 @@ export interface IFaustDspInstance {
54
59
  init($dsp: number, sampleRate: number): void;
55
60
 
56
61
  /** Init instance state (delay lines...).
57
- *
62
+ *
58
63
  * @param $dsp - the DSP pointer
59
64
  */
60
65
  instanceClear($dsp: number): void;
61
66
 
62
67
  /** Init instance constant state.
63
- *
68
+ *
64
69
  * @param $dsp - the DSP pointer
65
70
  * @param sampleRate - the sampling rate in Hertz
66
71
  */
67
72
  instanceConstants($dsp: number, sampleRate: number): void;
68
73
 
69
74
  /** Init instance state.
70
- *
75
+ *
71
76
  * @param $dsp - the DSP pointer
72
77
  * @param sampleRate - the sampling rate in Hertz
73
78
  */
74
79
  instanceInit($dsp: number, sampleRate: number): void;
75
80
 
76
81
  /** Init default control parameters values.
77
- *
82
+ *
78
83
  * @param $dsp - the DSP pointer
79
84
  */
80
85
  instanceResetUserInterface($dsp: number): void;
81
86
 
82
87
  /**
83
88
  * Set a parameter current value.
84
- *
89
+ *
85
90
  * @param $dsp - the DSP pointer
86
91
  * @param index - the parameter index
87
92
  * @param value - the parameter value
@@ -94,7 +99,12 @@ export interface IFaustDspInstance {
94
99
  */
95
100
  export interface IFaustMixerInstance {
96
101
  clearOutput(bufferSize: number, chans: number, $outputs: number): void;
97
- mixCheckVoice(bufferSize: number, chans: number, $inputs: number, $outputs: number): number;
102
+ mixCheckVoice(
103
+ bufferSize: number,
104
+ chans: number,
105
+ $inputs: number,
106
+ $outputs: number
107
+ ): number;
98
108
  fadeOut(bufferSize: number, chans: number, $outputs: number): void;
99
109
  }
100
110
 
@@ -123,17 +133,41 @@ export interface FaustPolyDspInstance {
123
133
  export class FaustDspInstance implements IFaustDspInstance {
124
134
  private readonly fExports: IFaustDspInstance;
125
135
 
126
- constructor(exports: IFaustDspInstance) { this.fExports = exports; }
127
-
128
- compute($dsp: number, count: number, $input: number, $output: number) { this.fExports.compute($dsp, count, $input, $output); }
129
- getNumInputs($dsp: number) { return this.fExports.getNumInputs($dsp); }
130
- getNumOutputs($dsp: number) { return this.fExports.getNumOutputs($dsp); }
131
- getParamValue($dsp: number, index: number) { return this.fExports.getParamValue($dsp, index); }
132
- getSampleRate($dsp: number) { return this.fExports.getSampleRate($dsp); }
133
- init($dsp: number, sampleRate: number) { this.fExports.init($dsp, sampleRate); }
134
- instanceClear($dsp: number) { this.fExports.instanceClear($dsp); }
135
- instanceConstants($dsp: number, sampleRate: number) { this.fExports.instanceConstants($dsp, sampleRate); }
136
- instanceInit($dsp: number, sampleRate: number) { this.fExports.instanceInit($dsp, sampleRate); }
137
- instanceResetUserInterface($dsp: number) { this.fExports.instanceResetUserInterface($dsp); }
138
- setParamValue($dsp: number, index: number, value: number) { this.fExports.setParamValue($dsp, index, value); }
136
+ constructor(exports: IFaustDspInstance) {
137
+ this.fExports = exports;
138
+ }
139
+
140
+ compute($dsp: number, count: number, $input: number, $output: number) {
141
+ this.fExports.compute($dsp, count, $input, $output);
142
+ }
143
+ getNumInputs($dsp: number) {
144
+ return this.fExports.getNumInputs($dsp);
145
+ }
146
+ getNumOutputs($dsp: number) {
147
+ return this.fExports.getNumOutputs($dsp);
148
+ }
149
+ getParamValue($dsp: number, index: number) {
150
+ return this.fExports.getParamValue($dsp, index);
151
+ }
152
+ getSampleRate($dsp: number) {
153
+ return this.fExports.getSampleRate($dsp);
154
+ }
155
+ init($dsp: number, sampleRate: number) {
156
+ this.fExports.init($dsp, sampleRate);
157
+ }
158
+ instanceClear($dsp: number) {
159
+ this.fExports.instanceClear($dsp);
160
+ }
161
+ instanceConstants($dsp: number, sampleRate: number) {
162
+ this.fExports.instanceConstants($dsp, sampleRate);
163
+ }
164
+ instanceInit($dsp: number, sampleRate: number) {
165
+ this.fExports.instanceInit($dsp, sampleRate);
166
+ }
167
+ instanceResetUserInterface($dsp: number) {
168
+ this.fExports.instanceResetUserInterface($dsp);
169
+ }
170
+ setParamValue($dsp: number, index: number, value: number) {
171
+ this.fExports.setParamValue($dsp, index, value);
172
+ }
139
173
  }