Git Product home page Git Product logo

Comments (5)

mrkev avatar mrkev commented on July 19, 2024

I had a quick look and I think I know what's creating at least the immediate exception in my app. There's this cache for modules, so that modules that have already been added aren't added again.

const existing = processorModules[url];
if (existing) {
return existing;
}
processorModules[url] = context.audioWorklet.addModule(url);
return processorModules[url];
}

This cache doesn't consider the context they were added to, just the URL. So it returns a module that has been initialized to another context in my application (since I use a normal AudioContext at initialization, but am trying to initialize these modules with in OfflineAudioContext afterwards, when the user tries to bounce the tracks).

This explains at least one of the errors I get:

loadProcessor.js:144 DOMException: Failed to construct 'AudioWorkletNode': AudioWorkletNode cannot be created: The node name 'Panner' is not defined in AudioWorkletGlobalScope.

The node is certainly not defined in AudioWorkletGlobalScope, because we skipped that part and returned one that's defined in another audio context!

I'll try to fiddle with this (maybe not today though).

from faust-loader.

mrkev avatar mrkev commented on July 19, 2024

Last update, I ended up commenting out the lines that check the cache real quick:

// if (existing) { 
//     return existing; 
// } 

No exceptions! The bounce works! Unfortunately it generates a buffer with no audio; it's a completely mute wav. I guess I just confirmed at least API-wise one could swap the AudioContext for the OfflineAudioContext and get no errors, but getting no audio back seems to be back in the realm of "could OfflineAudioContext acutally be used though?". Logging off for real now though. ✌️

from faust-loader.

Smona avatar Smona commented on July 19, 2024

I had been eyeing the NPM downloads, but I'm elated to hear for certain that someone besides me is getting use out of the package!

I appreciate the investigation; we should definitely be caching per-context as well. The loader should support N contexts, and absolutely should support Faust nodes in an OfflineAudioContext.

I had built this loader as part of a much larger project so I moved on once it reached MVP level, but you've prompted me to take a look at cleaning it up a bit. Right now I'm updating the FaustAudioProcessorNode code to pass type checks and expand the typing for the returned node. After that I'll look at creating a working test case for multiple (possibly offline) audio contexts.

In the meantime, if you're able to get offline rendering audio output working, PRs are absolutely welcome!

from faust-loader.

Smona avatar Smona commented on July 19, 2024

I just published v1.2.2, which fixes this. I also added a simple test case rendering audio from a faust node in an OfflineAudioContext and confirmed that it works, at least with a trivial processor.

from faust-loader.

mrkev avatar mrkev commented on July 19, 2024

Awesome @Smona! I haven't worked on the project in question since I posted this issue, but I'm looking forward to trying it out. Thanks for looking into this 🙏

from faust-loader.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.