Skip to content

Having trouble Using hook / handle MIDI-related event data #18

@ridleytech

Description

@ridleytech

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions