Giter Site home page Giter Site logo

pitch.js's Introduction

pitch.js

pitch.js is a pitch detection library written in JavaScript. It is based on the excellent code used in performous. While mainly aimed for human voice, it can also be used with other instruments.

Usage

For pitch.js to work, you'll also need to include fft.js.

pitch.js ships one namespace, called PitchAnalyzer from which all the functionality is available:

/* Create a new pitch detector */
var pitch = new PitchAnalyzer(sampleRate);

/* Copy samples to the internal buffer */
pitch.input(audioBuffer);
/* Process the current input in the internal buffer */
pitch.process();

var tone = pitch.findTone();

if (tone === null) {
	console.log('No tone found!');
} else {
	console.log('Found a tone, frequency:', tone.freq, 'volume:', tone.db);
}

Notes

  • The audioBuffer must be mono.
  • The internal buffer is 4096 samples long, so if you input more than that without processing in between, you might get incorrect results.

Authors

pitch.js is brought to you by Audiocogs. Please see ./docs/AUTHORS.md for more details.

License

This code is ported from original C++ code by Lasse Kärkkäinen, hence licensed under GPLv2, as is the original. Please see pitch.js/docs/LICENSE.txt for further information.

pitch.js's People

Contributors

jussi-kalliokoski avatar crackofdusk avatar

Watchers

Jason Paul Cole avatar James Cloos 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.