@grame/faustwasm 0.6.1 → 0.6.3
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/assets/standalone/index-pwa.js +18 -24
- package/package.json +1 -1
- package/test/organ.dsp +2 -2
- package/test/organ1.dsp +1 -1
|
@@ -50,11 +50,8 @@ audioContext.suspend();
|
|
|
50
50
|
await connectToAudioInput(audioContext, null, faustNode, null);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
// Activate sensor listeners
|
|
54
|
-
await faustNode.listenSensors();
|
|
55
|
-
|
|
56
53
|
// Function to initialize MIDI
|
|
57
|
-
function initMIDI(
|
|
54
|
+
function initMIDI() {
|
|
58
55
|
// Check if the browser supports the Web MIDI API
|
|
59
56
|
if (navigator.requestMIDIAccess) {
|
|
60
57
|
navigator.requestMIDIAccess().then(
|
|
@@ -72,28 +69,25 @@ audioContext.suspend();
|
|
|
72
69
|
}
|
|
73
70
|
}
|
|
74
71
|
|
|
75
|
-
//
|
|
76
|
-
|
|
77
|
-
initMIDI(faustNode);
|
|
78
|
-
}
|
|
72
|
+
// Function to resume AudioContext, activate MIDI and Sensors on user interaction
|
|
73
|
+
function activateAudioMIDISensors() {
|
|
79
74
|
|
|
80
|
-
|
|
75
|
+
// Resume the AudioContext
|
|
76
|
+
if (audioContext.state === 'suspended') {
|
|
77
|
+
audioContext.resume();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Activate sensor listeners
|
|
81
|
+
faustNode.listenSensors();
|
|
81
82
|
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
// Initialize the MIDI setup
|
|
84
|
+
if (FAUST_DSP_VOICES > 0) {
|
|
85
|
+
initMIDI();
|
|
86
|
+
}
|
|
86
87
|
}
|
|
87
|
-
}
|
|
88
88
|
|
|
89
|
-
// Add event listeners for user interactions
|
|
90
|
-
window.addEventListener('click',
|
|
91
|
-
window.addEventListener('touchstart',
|
|
89
|
+
// Add event listeners for user interactions
|
|
90
|
+
window.addEventListener('click', activateAudioMIDISensors);
|
|
91
|
+
window.addEventListener('touchstart', activateAudioMIDISensors);
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
audioContext.onstatechange = function () {
|
|
95
|
-
if (audioContext.state === 'running') {
|
|
96
|
-
window.removeEventListener('click', resumeAudioContext);
|
|
97
|
-
window.removeEventListener('touchstart', resumeAudioContext);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
93
|
+
})();
|
package/package.json
CHANGED
package/test/organ.dsp
CHANGED
|
@@ -2,7 +2,7 @@ import("stdfaust.lib");
|
|
|
2
2
|
|
|
3
3
|
timbre(f) = os.osc(f)*0.5 + os.osc(f*2)*0.25 + os.osc(f*3)*0.125;
|
|
4
4
|
|
|
5
|
-
process = timbre(hslider("freq [midi:ctrl 7]", 440, 20,
|
|
6
|
-
* hslider("gain
|
|
5
|
+
process = timbre(hslider("freq [midi:ctrl 7]", 440, 20, 3000, 1))
|
|
6
|
+
* hslider("gain", 0.5, 0, 1, 0.01)
|
|
7
7
|
* (button("gate") : en.adsr(0.1,0.1,0.98,1.5));
|
|
8
8
|
|
package/test/organ1.dsp
CHANGED
|
@@ -3,6 +3,6 @@ import("stdfaust.lib");
|
|
|
3
3
|
timbre(f) = os.osc(f)*0.5 + os.osc(f*2)*0.25 + os.osc(f*3)*0.125;
|
|
4
4
|
effect = _*(hslider("Left", 0.1, 0, 1, 0.01)), _*(hslider("Right", 0.1, 0, 1, 0.01));
|
|
5
5
|
|
|
6
|
-
process = timbre(hslider("freq", 440, 20,
|
|
6
|
+
process = timbre(hslider("freq", 440, 20, 3000, 1))
|
|
7
7
|
* hslider("gain", 0.5, 0, 1, 0.01)
|
|
8
8
|
* (button("gate") : en.adsr(0.1,0.1,0.98,1.5));
|