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
I attempted using the hookPlayerMIDIEventsByName method but I'm getting this error. How do I go about fixing this?
synth = new JSSynth.AudioWorkletNodeSynthesizer(); synth.init(context.sampleRate); if (!node) { node = synth.createAudioNode(context); node.connect(context.destination); synth.hookPlayerMIDIEventsByName('myHookPlayerEvents', { secondSFont: soundfontbuffer }); }
I added this code to js-synthesizer.worklet.min.js
AudioWorkletGlobalScope.myHookPlayerEvents = function (s, type, event, data) { if (type === 0xc0) { if (event.getProgram() === 0) { s.midiProgramSelect(event.getChannel(), data.secondSFont, 0, 0); return true; } } return false; };
js-synthesizer.min.js:312 Uncaught (in promise) Error: Name not found
at js-synthesizer.worklet.min.js:1298
at T (js-synthesizer.worklet.min.js:1199)
at js-synthesizer.worklet.min.js:1188
The text was updated successfully, but these errors were encountered:
If the problem persists, please use js-synthesizer.worklet.js (non-.min file), set breakpoint around L1901 (the line const fn = (AudioWorkletGlobalScope[name]); in doHookPlayerMIDIEvents method), call synth.hookPlayerMIDIEventsByName (will hit the breakpoint), and dump Object.keys(AudioWorkletGlobalScope). You can verify whether the function myHookPlayerEvents is correctly registered.
(I tried with Google Chrome; I could not debug audio worklet with Firefox.)
P.S. I found the bug around the audio worklet in js-synthesizer and update the package. Please use the version v1.8.4.
I attempted using the hookPlayerMIDIEventsByName method but I'm getting this error. How do I go about fixing this?
synth = new JSSynth.AudioWorkletNodeSynthesizer(); synth.init(context.sampleRate); if (!node) { node = synth.createAudioNode(context); node.connect(context.destination); synth.hookPlayerMIDIEventsByName('myHookPlayerEvents', { secondSFont: soundfontbuffer }); }
I added this code to js-synthesizer.worklet.min.js
AudioWorkletGlobalScope.myHookPlayerEvents = function (s, type, event, data) { if (type === 0xc0) { if (event.getProgram() === 0) { s.midiProgramSelect(event.getChannel(), data.secondSFont, 0, 0); return true; } } return false; };
js-synthesizer.min.js:312 Uncaught (in promise) Error: Name not found
at js-synthesizer.worklet.min.js:1298
at T (js-synthesizer.worklet.min.js:1199)
at js-synthesizer.worklet.min.js:1188
The text was updated successfully, but these errors were encountered: