Hello, I am trying to develop a plugin which should run Spessa-Synth_lib (/spessasynth_lib) to generate audio. From the docs of spessa i see that we need a audioworklet. i already have imported the spessa_lib, but i cannot create a synth instance because i need to fetch a .js file in runtime to initialize the Worklet. the problem is:
Blockquote async function addWorkletHelper(context)
{
await context.audioWorklet.addModule(“./worklet_processor.min.js”)
} I tried all kind of things to load the file " worklet_processor.min.js" which is in my plugins root, as well as in the /asstes folder. i have declared it in manifest… but when running the code it always fails to fetch the file. Is this really some sort of security resitriction from Obsidian itself? Can someone please help me with this? This is my code that fails: // Step 2: Create AudioContext
this.audioContext = new AudioContext();
console.log(“AudioContext created”, { state: this.audioContext.state, sampleRate: this.audioContext.sampleRate });
// Step 3: Load AudioWorklet via CSP-safe Blob
const workletUrl = `/plugins/${PLUGIN_ID}/assets/worklet_processor.min.js`;
console.log("Step 2: Loading worklet from", workletUrl);
Console: spessasynth_lib module: { DEFAULT_SYNTH_CONFIG: [Getter],
FancyChorus: [Getter],
MIDIDeviceHandler: [Getter],
Sequencer: [Getter],
Synthetizer: [Getter],
WORKLET_URL_ABSOLUTE: [Getter],
WebMIDILinkHandler: [Getter],
audioBufferToWav: [Getter],
getReverbProcessor: [Getter] }
AudioContext created { state: ‘running’, sampleRate: 48000 }
Step 2: Loading worklet from ‘/plugins/music-code-blocks1/worklet_processor.min.js’
SpessaSynth init failed: ‘Failed to fetch’
Spessasynth initialized: false