Coder Social home page Coder Social logo

elm-flow's Introduction

elm-flow

A library for expressing precisely coordinated activities in the browser - for example, animation and audio events that need to be in perfect sync.

A "flow" can be used to produce a sequence of time stamped messages whose structure and function are left open. These "messages" could be Html msg or Cmd msg or any such effects. They are then expected to be passed on to a subsystem that will perform the effects at the indicated time stamps.

Note that the implementation of these time stamps can be different for different subsystems. For example, a Html msg can be rendered only to within an accuracy of 15ms, whereas an audio event can be rendered with an accuracy of 0.02ms (1/48KHz sampling rate). It is possible to use a high precision time stamp to cover both cases because the WebAudio API spec recently added support for converting between sample time and DOMHiresTimeStamp.

Another issue that I expect elm-flow to address is the synchronization of just-in-time scheduled visuals and sounds. Since the perception of audio is sensitive to breakups, audio is usually scheduled in a double-buffered manner, where one buffer of, say, 512 sample frames is computed while another buffer is being played out of the audio subsystem. Here we trade off low latency response for continuous audio. Visual displays, however, need to necessarily complete computation within about 15ms and there is not as significant a perceptual penalty for a skipped frame. So display latency can be kept within about 15ms. This means we're usually computing and scheduling audio a bit ahead of the corresponding frame to display. Furthermore, the audio output pipeline can impose its own latencies. If you use a bluetooth speaker, for example, you can incur an additional audio latency of about 300ms. That's 20 frames of visuals! So a mechanism where we're able to precompute and schedule visual frames as well as audio can be useful for such applications.

This is CONCEPTUAL/EXPERIMENTAL work in progress and needs to be considered in conjunction with appropriate timed execution backends.

These concepts are based on the Steller library - https://github.com/srikumarks/steller

elm-flow's People

Contributors

srikumarks avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar

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.