Code Monkey home page Code Monkey logo

volume-meter

Renders the dynamic range of a MediaStream waveform slice as a percentage in a requestAnimationFrame callback.

npm

Why

Not a particularly complicated task, but it requires more code than you might expect. Also being able to control how the output is tweened (in and out independently!) allows you to get a custom look and feel pretty easily 😎

How

Web Audio API's AnalyserNode#getByteTimeDomainData()

Example

var volumemeter = require('volume-meter')
var getusermedia = require('getusermedia')

var ctx = new AudioContext()
var el = document.querySelector('.meter')

var meter = volumemeter(ctx, { tweenIn: 2, tweenOut: 6 }, function (volume) {
  el.style.height = volume + '%'
})

getusermedia({ audio: true, video: false }, function (err, stream) {
  if (err) return console.error(err)
  
  var src = ctx.createMediaStreamSource(stream)
  src.connect(meter)
  src.connect(ctx.destination)
  stream.onended = meter.stop.bind(meter)
})

A slightly more full featured example can be found here. You can run it by doing:

$ npm run example

Install

$ npm install volume-meter

Require

var volumemeter = require('volume-meter')

Constructor

var meter = volumemeter(context, [opts], onenterframe)

Instance methods

meter.stop()

Releases

The latest stable release is published to npm.

  • 2.0.0
  • Make display logarithmically proportional to the dynamic range
  • 1.0.0
  • First pass.

License

Copyright © 2014 Jesse Tane [email protected]

This work is free. You can redistribute it and/or modify it under the terms of the WTFPL.

No Warranty. The Software is provided "as is" without warranty of any kind, either express or implied, including without limitation any implied warranties of condition, uninterrupted use, merchantability, fitness for a particular purpose, or non-infringement.

Zoltán Marić's Projects

atlite icon atlite

Atlite: A Lightweight Python Package for Calculating Renewable Power Potentials and Time Series

cdas2 icon cdas2

Climate Data Analytic Service provider built on scala, Spark, Akka, Haddop, and python tools such as UVCDAT, etc.

coppersushi icon coppersushi

Optimal power flow visualisation based on pypsa-eur

cronish icon cronish

A cron dsl to be used anywhere and everywhere.

exchangerates icon exchangerates

A set of scripts collecting statistics on currency exchange rates

goeuro icon goeuro

A Java command-line client for consuming a simple REST API

h264-fer icon h264-fer

Automatically exported from code.google.com/p/h264-fer

hulaaki icon hulaaki

An Elixir library (driver) for clients communicating with MQTT brokers(via the MQTT 3.1.1 protocol).

playrest icon playrest

A sample project for testing a REST API with geolocation searching

projectcher icon projectcher

Automatically exported from code.google.com/p/projectcher

pypsa icon pypsa

PyPSA: Python for Power System Analysis

pypsa-eur icon pypsa-eur

PyPSA-Eur: An Open Optimisation Model of the European Transmission System

railsrest icon railsrest

A sample Rails project for testing a REST API with geolocation searching

rootbeer1 icon rootbeer1

Rootbeer GPU Compiler - Java GPU Programming

scrapeyard icon scrapeyard

A simple REST API for scheduling asynchronous batches of flight searches

slike icon slike

Photo hosting with in-browser client-side encryption

smartmeters icon smartmeters

A naive implementation of a real-time reporting system for smart meter readings.

specs2 icon specs2

Software Specifications for Scala

stringmetric icon stringmetric

:dart: String metrics and phonetic algorithms for Scala (e.g. Dice/Sorensen, Hamming, Jaccard, Jaro, Jaro-Winkler, Levenshtein, Metaphone, N-Gram, NYSIIS, Overlap, Ratcliff/Obershelp, Refined NYSIIS, Refined Soundex, Soundex, Weighted Levenshtein).

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.