GithubHelp home page GithubHelp logo

cwilso / metronome Goto Github PK

View Code? Open in Web Editor NEW
576.0 24.0 192.0 23 KB

Web Audio metronome example to show scheduling.

Home Page: https://cwilso.github.io/metronome/

License: MIT License

CSS 14.51% JavaScript 73.38% HTML 12.11%

metronome's Introduction

Web Audio Metronome

This application shows how to use a collaboration between a setTimeout scheduler and the Web Audio scheduler to properly implement rock-solid timing for audio applications.

I added some code to this demo after writing the article on web audio scheduling that now resides at https://web.dev/audio-scheduling/.

This code was added because Chrome (and other browsers) made a power-saving change to throttle JS timers at one point, so if the page was not visible (e.g. a tab that you tabbed away from), it would only have setTimeout timers delivered once a second. Timers in worker threads were not throttled, so I set up a worker thread to ping the main thread (which does the audio scheduling).

Since that time, I believe the code I wrote is actually no longer necessary, because based on ANOTHER change audible audio should prevent the throttling, so for this application setTimeout on the main thread would work just fine. (Jake Archibald wrote an article in early 2021 outlining the current state of affairs at https://developer.chrome.com/blog/timer-throttling-in-chrome-88/.) I have not yet tested this assumption or removed the code yet, however.

Check it out, feel free to submit issues or requests, fork, submit pull requests, etc.

The live app is at https://cwilso.github.io/metronome/.

-Chris

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.