Giter Site home page Giter Site logo

mcanthony / beatmap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bbc/beatmap

1.0 2.0 0.0 784 KB

Javascript audio visualization element based on tiled bitmap images

License: GNU General Public License v3.0

JavaScript 59.97% HTML 37.42% Shell 2.61%

beatmap's Introduction

BeatMap

A Javascript audio visualization element based on tiled bitmap images. For a vector-based waveform visualization, see peaks.js.

Installation

BeatMap can be installed using bower

bower install beatmap

or by copying beatmap.js and KineticJS into your working directory.

Examples

Two working examples are supplied:

  • example/example.html implements a single display with three zoom levels and selection functionality
  • example/example-dual.html is as above, but includes a second zoomed display with lines to indicate which part of the recording the zoomed display is showing

Generating tiles

Firstly, generate images from your audio data using something like Vampeyer. The images then need to be cut into tiles and given filenames in the format filename_0.jpg, filename_1.jpg etc. The supplied ImageMagick script tilecut.sh chops an image into equally-spaced tiles and names them appropriately. For example:

./tilecut.sh filename.jpg 240

Usage

In the <head> section of your web page, insert:

<script src="bower_components/kineticjs/kinetic.min.js"></script>
<script src="bower_components/beatmap/beatmap.js"></script>

Add a <div> element where you would like the display to go.

<div id="display"></div>

In a <script> element, declare an array containing the image metadata:

var images = [
  {
    src: 'filenameA',
    width: 960,
    tilewidth: 240,
    format: 'jpg'
  },
  {
    src: 'filenameB',
    width: 4800,
    tilewidth: 240,
    format: 'jpg'
  }
];

Initialize a BeatMap object:

var bm = new BeatMap(document.getElementById("display"),
                     960,           // width of div element in pixels
                     images,        // image metadata array
                     240,           // height of images in pixels
                     60,            // length of recording in seconds
                     0,             // index of image to use (default=0)
                     true);         // display timeline markers (default=true)

and finally create a drawing loop:

window.setInterval("bm.draw(0);",   // drawing function with cursor position in seconds
                   50);             // milliseconds between refreshs

Documentation

To generate the full documentation, use JSDoc:

jsdoc -d=doc beatmap.js

License

See COPYING

Authors

Copyright

Copyright 2014 British Broadcasting Corporation

beatmap's People

Contributors

chrisbaume avatar

Stargazers

 avatar

Watchers

 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.