Git Product home page Git Product logo

Comments (2)

petersalomonsen avatar petersalomonsen commented on May 25, 2024 1

Hi, thanks for the feedback :)

Regarding your questions:

  1. The best approach here is to use AudioWorklet which is what I use in this project. AudioWorklet renders buffers of 128 frames and send to the audio hardware ( via a AudioWorkletNode ). This is the approach used in this project to obtain low latency and realtime playback.

  2. The AudioWorkletProcessor has to be written in JS but it can call into WASM for rendering the buffer of 128 frames.

  3. The heart of the code generating the audio in this project is the fillSampleBuffer method ( https://github.com/petersalomonsen/javascriptmusic/blob/master/wasmaudioworklet/synth1/assembly/index.ts#L173 ). This code of course takes into account that you should be able to control the notes from the outside and also use multiple instruments. In order to just make the simple basic example, you'd just make sure that your process method of the AudioWorklet calls into WebAssembly ( or even just does it in JS ) to something that just returns samples of a sine. Also read about AudioWorklet here: https://developer.chrome.com/blog/audio-worklet/

from javascriptmusic.

brian-hay avatar brian-hay commented on May 25, 2024

Thanks for the great advice and links @petersalomonsen !

from javascriptmusic.

Related Issues (9)

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.