@grame/faustwasm 0.8.0 → 0.9.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 (67) hide show
  1. package/assets/standalone/create-node.js +46 -9
  2. package/assets/standalone/faust-ui/index.js +2 -2
  3. package/assets/standalone/faust-ui/index.js.map +1 -1
  4. package/assets/standalone/faustwasm/index.d.ts +42 -2
  5. package/assets/standalone/faustwasm/index.js +117 -66
  6. package/assets/standalone/faustwasm/index.js.map +2 -2
  7. package/assets/standalone/index-pwa.js +125 -90
  8. package/assets/standalone/index-template.js +43 -22
  9. package/assets/standalone/index.js +36 -19
  10. package/assets/standalone/service-worker.js +58 -5
  11. package/dist/cjs/index.d.ts +42 -2
  12. package/dist/cjs/index.js +117 -66
  13. package/dist/cjs/index.js.map +2 -2
  14. package/dist/cjs-bundle/index.d.ts +42 -2
  15. package/dist/cjs-bundle/index.js +117 -66
  16. package/dist/cjs-bundle/index.js.map +2 -2
  17. package/dist/esm/index.d.ts +42 -2
  18. package/dist/esm/index.js +117 -66
  19. package/dist/esm/index.js.map +2 -2
  20. package/dist/esm-bundle/index.d.ts +42 -2
  21. package/dist/esm-bundle/index.js +117 -66
  22. package/dist/esm-bundle/index.js.map +2 -2
  23. package/package.json +2 -2
  24. package/src/FaustAudioWorkletNode.ts +14 -30
  25. package/src/FaustAudioWorkletProcessor.ts +16 -0
  26. package/src/FaustOfflineProcessor.ts +2 -0
  27. package/src/FaustScriptProcessorNode.ts +6 -30
  28. package/src/FaustWebAudioDsp.ts +88 -0
  29. package/src/copyWebStandaloneAssets.js +14 -0
  30. package/test/faustlive-wasm/faust-ui/index.js +2 -2
  31. package/test/faustlive-wasm/faust-ui/index.js.map +1 -1
  32. package/test/faustlive-wasm/faustwasm/index.d.ts +42 -2
  33. package/test/faustlive-wasm/faustwasm/index.js +117 -66
  34. package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
  35. package/test/midi/create-node.js +177 -0
  36. package/test/midi/dsp-meta.json +133 -0
  37. package/test/midi/dsp-module.wasm +0 -0
  38. package/test/midi/faust-ui/index.css +442 -0
  39. package/test/midi/faust-ui/index.css.map +1 -0
  40. package/test/midi/faust-ui/index.d.ts +1 -0
  41. package/test/midi/faust-ui/index.js +3729 -0
  42. package/test/midi/faust-ui/index.js.map +1 -0
  43. package/test/midi/faustwasm/index.d.ts +1680 -0
  44. package/test/midi/faustwasm/index.js +4884 -0
  45. package/test/midi/faustwasm/index.js.map +7 -0
  46. package/test/midi/icon.png +0 -0
  47. package/test/midi/index.html +76 -0
  48. package/test/midi/index.js +183 -0
  49. package/test/midi/manifest.json +17 -0
  50. package/test/midi/service-worker.js +165 -0
  51. package/test/midi.dsp +8 -1
  52. package/test/organ1/create-node.js +177 -0
  53. package/test/organ1/dsp-meta.json +126 -0
  54. package/test/organ1/dsp-module.wasm +0 -0
  55. package/test/organ1/faust-ui/index.css +442 -0
  56. package/test/organ1/faust-ui/index.css.map +1 -0
  57. package/test/organ1/faust-ui/index.d.ts +1 -0
  58. package/test/organ1/faust-ui/index.js +3729 -0
  59. package/test/organ1/faust-ui/index.js.map +1 -0
  60. package/test/organ1/faustwasm/index.d.ts +1656 -0
  61. package/test/organ1/faustwasm/index.js +4783 -0
  62. package/test/organ1/faustwasm/index.js.map +7 -0
  63. package/test/organ1/icon.png +0 -0
  64. package/test/organ1/index.html +76 -0
  65. package/test/organ1/index.js +203 -0
  66. package/test/organ1/manifest.json +17 -0
  67. package/test/organ1/service-worker.js +181 -0
@@ -625,6 +625,20 @@ export interface IFaustBaseWebAudioDsp {
625
625
  * @param value - the MIDI controller value (0..16383)
626
626
  */
627
627
  pitchWheel(chan: number, value: number): void;
628
+ /**
629
+ * Handle MIDI keyOn messages.
630
+ * @param channel
631
+ * @param pitch
632
+ * @param velocity
633
+ */
634
+ keyOn(channel: number, pitch: number, velocity: number): void;
635
+ /**
636
+ * Handle MIDI keyOn messages.
637
+ * @param channel
638
+ * @param pitch
639
+ * @param velocity
640
+ */
641
+ keyOff(channel: number, pitch: number, velocity: number): void;
628
642
  /**
629
643
  * Set parameter value.
630
644
  *
@@ -774,6 +788,24 @@ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
774
788
  min: number;
775
789
  max: number;
776
790
  }[][];
791
+ protected fMidiKeyLabel: {
792
+ path: string;
793
+ chan: number;
794
+ min: number;
795
+ max: number;
796
+ }[][];
797
+ protected fMidiKeyOnLabel: {
798
+ path: string;
799
+ chan: number;
800
+ min: number;
801
+ max: number;
802
+ }[][];
803
+ protected fMidiKeyOffLabel: {
804
+ path: string;
805
+ chan: number;
806
+ min: number;
807
+ max: number;
808
+ }[][];
777
809
  protected fPathTable: {
778
810
  [address: string]: number;
779
811
  };
@@ -833,6 +865,8 @@ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
833
865
  getNumOutputs(): number;
834
866
  midiMessage(data: number[] | Uint8Array): void;
835
867
  ctrlChange(channel: number, ctrl: number, value: number): void;
868
+ keyOn(channel: number, pitch: number, velocity: number): void;
869
+ keyOff(channel: number, pitch: number, velocity: number): void;
836
870
  pitchWheel(channel: number, wheel: number): void;
837
871
  setParamValue(path: string, value: number): void;
838
872
  getParamValue(path: string): number;
@@ -842,11 +876,11 @@ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
842
876
  getUI(): FaustUIDescriptor;
843
877
  getDescriptors(): FaustUIInputItem[];
844
878
  hasSoundfiles(): boolean;
879
+ startSensors(): void;
880
+ stopSensors(): void;
845
881
  start(): void;
846
882
  stop(): void;
847
883
  destroy(): void;
848
- startSensors(): void;
849
- stopSensors(): void;
850
884
  }
851
885
  export declare class FaustMonoWebAudioDsp extends FaustBaseWebAudioDsp implements IFaustMonoWebAudioDsp {
852
886
  private fInstance;
@@ -1187,6 +1221,8 @@ export declare class FaustOfflineProcessor<Poly extends boolean = false> {
1187
1221
  midiMessage(data: number[] | Uint8Array): void;
1188
1222
  ctrlChange(chan: number, ctrl: number, value: number): void;
1189
1223
  pitchWheel(chan: number, value: number): void;
1224
+ keyOn(channel: number, pitch: number, velocity: number): void;
1225
+ keyOff(channel: number, pitch: number, velocity: number): void;
1190
1226
  setParamValue(path: string, value: number): void;
1191
1227
  getParamValue(path: string): number;
1192
1228
  getParams(): string[];
@@ -1381,6 +1417,8 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
1381
1417
  midiMessage(data: number[] | Uint8Array): void;
1382
1418
  ctrlChange(channel: number, ctrl: number, value: number): void;
1383
1419
  pitchWheel(channel: number, wheel: number): void;
1420
+ keyOn(channel: number, pitch: number, velocity: number): void;
1421
+ keyOff(channel: number, pitch: number, velocity: number): void;
1384
1422
  get hasAccInput(): boolean;
1385
1423
  propagateAcc(accelerationIncludingGravity: NonNullable<DeviceMotionEvent["accelerationIncludingGravity"]>, invert?: boolean): void;
1386
1424
  get hasGyrInput(): boolean;
@@ -1448,6 +1486,8 @@ export declare class FaustScriptProcessorNode<Poly extends boolean = false> exte
1448
1486
  midiMessage(data: number[] | Uint8Array): void;
1449
1487
  ctrlChange(chan: number, ctrl: number, value: number): void;
1450
1488
  pitchWheel(chan: number, value: number): void;
1489
+ keyOn(channel: number, pitch: number, velocity: number): void;
1490
+ keyOff(channel: number, pitch: number, velocity: number): void;
1451
1491
  setParamValue(path: string, value: number): void;
1452
1492
  getParamValue(path: string): number;
1453
1493
  getParams(): string[];
@@ -6188,6 +6188,14 @@ var getFaustAudioWorkletProcessor = (dependencies, faustData, register = true) =
6188
6188
  this.pitchWheel(msg.data[0], msg.data[1]);
6189
6189
  break;
6190
6190
  }
6191
+ case "keyOn": {
6192
+ this.keyOn(msg.data[0], msg.data[1], msg.data[2]);
6193
+ break;
6194
+ }
6195
+ case "keyOff": {
6196
+ this.keyOff(msg.data[0], msg.data[1], msg.data[2]);
6197
+ break;
6198
+ }
6191
6199
  case "param": {
6192
6200
  this.setParamValue(msg.data.path, msg.data.value);
6193
6201
  break;
@@ -6234,6 +6242,12 @@ var getFaustAudioWorkletProcessor = (dependencies, faustData, register = true) =
6234
6242
  pitchWheel(channel, wheel) {
6235
6243
  this.fDSPCode.pitchWheel(channel, wheel);
6236
6244
  }
6245
+ keyOn(channel, pitch, velocity) {
6246
+ this.fDSPCode.keyOn(channel, pitch, velocity);
6247
+ }
6248
+ keyOff(channel, pitch, velocity) {
6249
+ this.fDSPCode.keyOff(channel, pitch, velocity);
6250
+ }
6237
6251
  propagateAcc(accelerationIncludingGravity, invert = false) {
6238
6252
  this.fDSPCode.propagateAcc(accelerationIncludingGravity, invert);
6239
6253
  }
@@ -8114,6 +8128,10 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8114
8128
  // MIDI handling
8115
8129
  this.fPitchwheelLabel = [];
8116
8130
  this.fCtrlLabel = new Array(128).fill(null).map(() => []);
8131
+ // array of MIDI key handlers; array index is the MIDI note number
8132
+ this.fMidiKeyLabel = new Array(128).fill(null).map(() => []);
8133
+ this.fMidiKeyOnLabel = new Array(128).fill(null).map(() => []);
8134
+ this.fMidiKeyOffLabel = new Array(128).fill(null).map(() => []);
8117
8135
  this.fPathTable = {};
8118
8136
  this.fUICallback = (item) => {
8119
8137
  if (item.type === "hbargraph" || item.type === "vbargraph") {
@@ -8126,6 +8144,7 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8126
8144
  if (!item.meta)
8127
8145
  return;
8128
8146
  item.meta.forEach((meta) => {
8147
+ var _a, _b, _c, _d, _e, _f;
8129
8148
  const { midi, acc, gyr } = meta;
8130
8149
  if (midi) {
8131
8150
  const strMidi = midi.trim();
@@ -8139,10 +8158,25 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8139
8158
  } else {
8140
8159
  const matched2 = strMidi.match(/^ctrl\s(\d+)\s(\d+)/);
8141
8160
  const matched1 = strMidi.match(/^ctrl\s(\d+)/);
8161
+ const matchedKey = strMidi.match(/^key\s+(\d+)(?:\s+(\d+))?$/);
8162
+ const matchedKeyOn = strMidi.match(/^keyon\s+(\d+)(?:\s+(\d+))?$/);
8163
+ const matchedKeyOff = strMidi.match(/^keyoff\s+(\d+)(?:\s+(\d+))?$/);
8142
8164
  if (matched2) {
8143
8165
  this.fCtrlLabel[parseInt(matched2[1])].push({ path: item.address, chan: parseInt(matched2[2]), min: item.min, max: item.max });
8144
8166
  } else if (matched1) {
8145
8167
  this.fCtrlLabel[parseInt(matched1[1])].push({ path: item.address, chan: 0, min: item.min, max: item.max });
8168
+ } else if (matchedKey) {
8169
+ const note = parseInt(matchedKey[1]);
8170
+ const channel = matchedKey[2] ? parseInt(matchedKey[2]) : 0;
8171
+ this.fMidiKeyLabel[note].push({ path: item.address, chan: channel, min: (_a = item.min) != null ? _a : 0, max: (_b = item.max) != null ? _b : 1 });
8172
+ } else if (matchedKeyOn) {
8173
+ const note = parseInt(matchedKeyOn[1]);
8174
+ const channel = matchedKeyOn[2] ? parseInt(matchedKeyOn[2]) : 0;
8175
+ this.fMidiKeyOnLabel[note].push({ path: item.address, chan: channel, min: (_c = item.min) != null ? _c : 0, max: (_d = item.max) != null ? _d : 1 });
8176
+ } else if (matchedKeyOff) {
8177
+ const note = parseInt(matchedKeyOff[1]);
8178
+ const channel = matchedKeyOff[2] ? parseInt(matchedKeyOff[2]) : 0;
8179
+ this.fMidiKeyOffLabel[note].push({ path: item.address, chan: channel, min: (_e = item.min) != null ? _e : 0, max: (_f = item.max) != null ? _f : 1 });
8146
8180
  }
8147
8181
  }
8148
8182
  }
@@ -8404,6 +8438,15 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8404
8438
  return this.ctrlChange(channel, data1, data2);
8405
8439
  if (cmd === 14)
8406
8440
  return this.pitchWheel(channel, data2 * 128 + data1);
8441
+ if (cmd === 9) {
8442
+ if (data2 > 0)
8443
+ return this.keyOn(channel, data1, data2);
8444
+ else
8445
+ return this.keyOff(channel, data1, data2);
8446
+ }
8447
+ if (cmd === 8) {
8448
+ return this.keyOff(channel, data1, data2);
8449
+ }
8407
8450
  }
8408
8451
  ctrlChange(channel, ctrl, value) {
8409
8452
  if (this.fPlotHandler)
@@ -8419,6 +8462,46 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8419
8462
  });
8420
8463
  }
8421
8464
  }
8465
+ keyOn(channel, pitch, velocity) {
8466
+ if (this.fPlotHandler)
8467
+ this.fCachedEvents.push({ type: "keyOn", data: [channel, pitch, velocity] });
8468
+ this.fMidiKeyOnLabel[pitch].forEach((key) => {
8469
+ const { path, chan } = key;
8470
+ if (chan === 0 || channel === chan - 1) {
8471
+ this.setParamValue(path, _FaustBaseWebAudioDsp.remap(velocity, 0, 127, key.min, key.max));
8472
+ if (this.fOutputHandler)
8473
+ this.fOutputHandler(path, this.getParamValue(path));
8474
+ }
8475
+ });
8476
+ this.fMidiKeyLabel[pitch].forEach((key) => {
8477
+ const { path, chan } = key;
8478
+ if (chan === 0 || channel === chan - 1) {
8479
+ this.setParamValue(path, _FaustBaseWebAudioDsp.remap(velocity, 0, 127, key.min, key.max));
8480
+ if (this.fOutputHandler)
8481
+ this.fOutputHandler(path, this.getParamValue(path));
8482
+ }
8483
+ });
8484
+ }
8485
+ keyOff(channel, pitch, velocity) {
8486
+ if (this.fPlotHandler)
8487
+ this.fCachedEvents.push({ type: "keyOff", data: [channel, pitch, velocity] });
8488
+ this.fMidiKeyOffLabel[pitch].forEach((key) => {
8489
+ const { path, chan } = key;
8490
+ if (chan === 0 || channel === chan - 1) {
8491
+ this.setParamValue(path, _FaustBaseWebAudioDsp.remap(velocity, 0, 127, key.min, key.max));
8492
+ if (this.fOutputHandler)
8493
+ this.fOutputHandler(path, this.getParamValue(path));
8494
+ }
8495
+ });
8496
+ this.fMidiKeyLabel[pitch].forEach((key) => {
8497
+ const { path, chan } = key;
8498
+ if (chan === 0 || channel === chan - 1) {
8499
+ this.setParamValue(path, 0);
8500
+ if (this.fOutputHandler)
8501
+ this.fOutputHandler(path, this.getParamValue(path));
8502
+ }
8503
+ });
8504
+ }
8422
8505
  pitchWheel(channel, wheel) {
8423
8506
  if (this.fPlotHandler)
8424
8507
  this.fCachedEvents.push({ type: "pitchWheel", data: [channel, wheel] });
@@ -8454,6 +8537,12 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8454
8537
  hasSoundfiles() {
8455
8538
  return this.fSoundfiles.length > 0;
8456
8539
  }
8540
+ startSensors() {
8541
+ this.startSensors();
8542
+ }
8543
+ stopSensors() {
8544
+ this.stopSensors();
8545
+ }
8457
8546
  start() {
8458
8547
  this.fProcessing = true;
8459
8548
  }
@@ -8466,12 +8555,6 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8466
8555
  this.fComputeHandler = null;
8467
8556
  this.fPlotHandler = null;
8468
8557
  }
8469
- startSensors() {
8470
- this.startSensors();
8471
- }
8472
- stopSensors() {
8473
- this.stopSensors();
8474
- }
8475
8558
  };
8476
8559
  var FaustMonoWebAudioDsp = class extends FaustBaseWebAudioDsp {
8477
8560
  constructor(instance, sampleRate, sampleSize, bufferSize, soundfiles) {
@@ -9055,6 +9138,12 @@ var FaustOfflineProcessor = class {
9055
9138
  pitchWheel(chan, value) {
9056
9139
  this.fDSPCode.pitchWheel(chan, value);
9057
9140
  }
9141
+ keyOn(channel, pitch, velocity) {
9142
+ this.fDSPCode.keyOn(channel, pitch, velocity);
9143
+ }
9144
+ keyOff(channel, pitch, velocity) {
9145
+ this.fDSPCode.keyOff(channel, pitch, velocity);
9146
+ }
9058
9147
  setParamValue(path, value) {
9059
9148
  this.fDSPCode.setParamValue(path, value);
9060
9149
  }
@@ -9920,42 +10009,14 @@ var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null)
9920
10009
  async startSensors() {
9921
10010
  if (this.hasAccInput) {
9922
10011
  if (window.DeviceMotionEvent) {
9923
- if (typeof window.DeviceMotionEvent.requestPermission === "function") {
9924
- try {
9925
- const response = await window.DeviceMotionEvent.requestPermission();
9926
- if (response === "granted") {
9927
- window.addEventListener("devicemotion", this.handleDeviceMotion, true);
9928
- } else if (response === "denied") {
9929
- alert("You have denied access to motion and orientation data. To enable it, go to Settings > Safari > Motion & Orientation Access.");
9930
- throw new Error("Unable to access the accelerometer.");
9931
- }
9932
- } catch (error) {
9933
- console.error(error);
9934
- }
9935
- } else {
9936
- window.addEventListener("devicemotion", this.handleDeviceMotion, true);
9937
- }
10012
+ window.addEventListener("devicemotion", this.handleDeviceMotion, true);
9938
10013
  } else {
9939
10014
  console.log("Cannot set the accelerometer handler.");
9940
10015
  }
9941
10016
  }
9942
10017
  if (this.hasGyrInput) {
9943
10018
  if (window.DeviceMotionEvent) {
9944
- if (typeof window.DeviceOrientationEvent.requestPermission === "function") {
9945
- try {
9946
- const response = await window.DeviceOrientationEvent.requestPermission();
9947
- if (response === "granted") {
9948
- window.addEventListener("deviceorientation", this.handleDeviceOrientation, true);
9949
- } else if (response === "denied") {
9950
- alert("You have denied access to motion and orientation data. To enable it, go to Settings > Safari > Motion & Orientation Access.");
9951
- throw new Error("Unable to access the gyroscope.");
9952
- }
9953
- } catch (error) {
9954
- console.error(error);
9955
- }
9956
- } else {
9957
- window.addEventListener("deviceorientation", this.handleDeviceOrientation, true);
9958
- }
10019
+ window.addEventListener("deviceorientation", this.handleDeviceOrientation, true);
9959
10020
  } else {
9960
10021
  console.log("Cannot set the gyroscope handler.");
9961
10022
  }
@@ -10019,6 +10080,10 @@ var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null)
10019
10080
  this.ctrlChange(channel, data1, data2);
10020
10081
  else if (cmd === 14)
10021
10082
  this.pitchWheel(channel, data2 * 128 + data1);
10083
+ if (cmd === 8 || cmd === 9 && data2 === 0)
10084
+ this.keyOff(channel, data1, data2);
10085
+ else if (cmd === 9)
10086
+ this.keyOn(channel, data1, data2);
10022
10087
  else
10023
10088
  this.port.postMessage({ type: "midi", data });
10024
10089
  }
@@ -10030,6 +10095,14 @@ var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null)
10030
10095
  const e = { type: "pitchWheel", data: [channel, wheel] };
10031
10096
  this.port.postMessage(e);
10032
10097
  }
10098
+ keyOn(channel, pitch, velocity) {
10099
+ const e = { type: "keyOn", data: [channel, pitch, velocity] };
10100
+ this.port.postMessage(e);
10101
+ }
10102
+ keyOff(channel, pitch, velocity) {
10103
+ const e = { type: "keyOff", data: [channel, pitch, velocity] };
10104
+ this.port.postMessage(e);
10105
+ }
10033
10106
  get hasAccInput() {
10034
10107
  return __privateGet(this, _hasAccInput);
10035
10108
  }
@@ -10193,42 +10266,14 @@ var FaustScriptProcessorNode = class extends (globalThis.ScriptProcessorNode ||
10193
10266
  async startSensors() {
10194
10267
  if (this.hasAccInput) {
10195
10268
  if (window.DeviceMotionEvent) {
10196
- if (typeof window.DeviceMotionEvent.requestPermission === "function") {
10197
- try {
10198
- const response = await window.DeviceMotionEvent.requestPermission();
10199
- if (response === "granted") {
10200
- window.addEventListener("devicemotion", this.handleDeviceMotion, true);
10201
- } else if (response === "denied") {
10202
- alert("You have denied access to motion and orientation data. To enable it, go to Settings > Safari > Motion & Orientation Access.");
10203
- throw new Error("Unable to access the accelerometer.");
10204
- }
10205
- } catch (error) {
10206
- console.error(error);
10207
- }
10208
- } else {
10209
- window.addEventListener("devicemotion", this.handleDeviceMotion, true);
10210
- }
10269
+ window.addEventListener("devicemotion", this.handleDeviceMotion, true);
10211
10270
  } else {
10212
10271
  console.log("Cannot set the accelerometer handler.");
10213
10272
  }
10214
10273
  }
10215
10274
  if (this.hasGyrInput) {
10216
10275
  if (window.DeviceMotionEvent) {
10217
- if (typeof window.DeviceOrientationEvent.requestPermission === "function") {
10218
- try {
10219
- const response = await window.DeviceOrientationEvent.requestPermission();
10220
- if (response === "granted") {
10221
- window.addEventListener("deviceorientation", this.handleDeviceOrientation, true);
10222
- } else if (response === "denied") {
10223
- alert("You have denied access to motion and orientation data. To enable it, go to Settings > Safari > Motion & Orientation Access.");
10224
- throw new Error("Unable to access the gyroscope.");
10225
- }
10226
- } catch (error) {
10227
- console.error(error);
10228
- }
10229
- } else {
10230
- window.addEventListener("deviceorientation", this.handleDeviceOrientation, true);
10231
- }
10276
+ window.addEventListener("deviceorientation", this.handleDeviceOrientation, true);
10232
10277
  } else {
10233
10278
  console.log("Cannot set the gyroscope handler.");
10234
10279
  }
@@ -10281,6 +10326,12 @@ var FaustScriptProcessorNode = class extends (globalThis.ScriptProcessorNode ||
10281
10326
  pitchWheel(chan, value) {
10282
10327
  this.fDSPCode.pitchWheel(chan, value);
10283
10328
  }
10329
+ keyOn(channel, pitch, velocity) {
10330
+ this.fDSPCode.keyOn(channel, pitch, velocity);
10331
+ }
10332
+ keyOff(channel, pitch, velocity) {
10333
+ this.fDSPCode.keyOff(channel, pitch, velocity);
10334
+ }
10284
10335
  setParamValue(path, value) {
10285
10336
  this.fDSPCode.setParamValue(path, value);
10286
10337
  }