GithubHelp home page GithubHelp logo

Comments (7)

jariseon avatar jariseon commented on August 19, 2024

would it be possible to have option whether to use "standard" AWP (where DSP is rendered in audio thread) or "powerhouse" (where DSP is rendered in Worker) implementation ?

i think powerhouse has definite use cases (like sample streaming from a virtual file system), but my concern is that since worker thread has lower priority than audio thread, it might be affected by what is going on in main thread. Also, SABs introduce latency (in chrome this is one buffer, in Firefox it at least used to be > 1 buffer) which needs to be compensated. edit: could also be because of worker thread priorities differ in browsers, might not be result of different SAB latencies.

from iplug2.

olilarkin avatar olilarkin commented on August 19, 2024

i guess what really needs to be done is to profile the current implementation. I currently have this hack, which is not right and the main thing i want to fix..., how do you think I could have an equivalent of OnIdle() on the main thread in AWP

from iplug2.

olilarkin avatar olilarkin commented on August 19, 2024

in answer to your question it may well be possible... need to experiment with this stuff

from iplug2.

jariseon avatar jariseon commented on August 19, 2024

iiuc you want to inform main thread that AWP is idle? AWP used to have state member and a notification message from AWP -> AWN. it was removed from spec, can't remember why that was, but i guess one workaround option is to call postMessage("set", "state", "idle") to notify the main thread Controller. And post another message when state changes, i.e., not for each buffer. Another way is to use a SAB, but then you'd need to poll in main thread.

from iplug2.

olilarkin avatar olilarkin commented on August 19, 2024

OnIdle() is a regular poll on the main thread. Not sure how to set that up within AudioWorkletGlobalScope

from iplug2.

jariseon avatar jariseon commented on August 19, 2024

right, so host calls OnIdle() ? Web Audio API calls AWP periodically: first it checks if there are any messages, and if so, it invokes AWP.port.onmessage() for each message from main thread. right after that it invokes AWP.process(). currently there's only one thread in AudioWorkletGlobalScope, so it is impossible to do any processing between onmessage and process calls.

unless setTimeout is available in AWGS, but even if it is, it might not be a good idea to steal processing time from other AWPs.

from iplug2.

olilarkin avatar olilarkin commented on August 19, 2024

closing this. may reopen in the future to provide powerhouse pattern as an option

from iplug2.

Related Issues (20)

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.