GithubHelp home page GithubHelp logo

reactjs-metronome's Introduction

Metronome

React Metronome

A ReactJS Metronome component inspired by Google's implementation

Uses the Web Audio API and Web Worker API to create a metronome that doesn't drift and doesn't suffer from the non-guaranteed nature of Javascript's setInterval function.

Prerequisites

Installing

npm install @kevinorriss/react-metronome

Usage

Import the component

import Metronome from '@kevinorriss/react-metronome'
...

<!-- JSX -->
<div className="your-container">
    <Metronome />
</div>

Props

All of the Metronome props are optional, providing the ability to make style and functional changes

Name Datatype Default Description
playPauseStyle Object {} The style to apply to the PLAY / PAUSE button
bpmStyle Object {} The style to apply to the BPM number
bpmTagStyle Object {} The style to apply to the 'BPM' text after the number
plusStyle Object {} The style to apply to the PLUS BPM [+] button
minusStyle Object {} The style to apply to the MINUS BPM [-] button
handleStyle Object {} The style to apply to the slider handle
trackStyle Object {} The style to apply to the slider track
railStyle Object {} The style to apply to the slider rail
sliderStyle Object {} The style to apply to the DIV containing the slider and +/- buttons
minBpm Number 40 The minimum BPM that can be set via the slider and buttons
maxBpm Number 200 The maximum BPM that can be set via the slider and buttons
startBpm Number 100 The default BPM
volume Number 0.1 The volume of the metronome (between 0 and 1)
frequency Number 440 The frequency (in hertz) of the beep

Development

This repo comes with a react app for development purposes. To get started, open a terminal in the root of the project and then:

Link the component to the app

cd ./component
npm link

cd ..
npm link @kevinorriss/react-metronome

Start the app

npm start

Start the rollup watcher

cd ./component
npm run dev

Whenever you make a change to the component code, the react app will update.

Tests

cd component
npm test

This project uses Jest and Enzyme for its unit tests, simply run the above code to run the test suites.

Author

License

This project is licensed under the ISC License

reactjs-metronome's People

Contributors

kevinorriss avatar

Watchers

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.