Is there a way to detect audio frequency in HTML 5 web audio API?

web audio api example
web audio api download
javascript audio stream
web audio api get amplitude
web audio api effects
javascript audiocontext
web audio api mobile
chrome web audio api

I would like to know is there a way we can detect audio frequency from microphone in html 5 web audio. I wish to make an online guitar tuner, and I need to have the audio frequency in hertz, from the sound input. I've seen some EQ and filters effects, but I didn't see anything about frequency recognition.

EDIT: I found this: The 2nd point (analyser node) is really interesting. I seen his source code, but I can't figure how to connect the analyser to the microphone input. He calls a playSound() function when the mp3 file starts to play, and there he draws his canvas. But I do not have a playSound() like function...

I wrote a web audio library which, among other things, can detect frequency from mic input. Check it out at

var voice = new Wad({source : 'mic' });
var tuner = new Wad.Poly();

tuner.updatePitch() // The tuner is now calculating the pitch and note name of its input 60 times per second. These values are stored in tuner.pitch and tuner.noteName.

var logPitch = function(){
    console.log(tuner.pitch, tuner.noteName)
// If you sing into your microphone, your pitch will be logged to the console in real time.

tuner.stopUpdatingPitch(); // Stop calculating the pitch if you don't need to know it anymore.

Is there a way to detect audio frequency in HTML 5 web audio API?, I wrote a web audio library which, among other things, can detect frequency from mic input. Check it out at Web Audio API target audience. The Web Audio API can seem intimidating to those that aren't familiar with audio or music terms, and as it incorporates a great deal of functionality it can prove difficult to get started if you are a developer.

You should be able to use BiquadFilterNode.

Example code from the link:

var audioCtx = new AudioContext();
var biquadFilter = audioCtx.createBiquadFilter();

Web Audio API, The Web Audio API provides a powerful and versatile system for the way digital audio works, specifically in the realm of the API. It is an AudioNode audio-​processing module that causes a given frequency of wave to be created. an audio source consisting of an HTML5 <audio> or <video> element. It  The Web Audio API is a high-level JavaScript API for processing and synthesizing audio in web applications. The goal of this API is to include capabilities found in modern game audio engines and some of the mixing, processing, and filtering tasks that are found in modern desktop audio production applications. What follows is a gentle

You can use the following code to get the frequencies from the mic.

  var audioContext = new(window.AudioContext || window.webkitAudioContext)();
  var input = audioContext.createMediaStreamSource(localStream);
  var analyser = audioContext.createAnalyser();
  var scriptProcessor = audioContext.createScriptProcessor();
  // Some analyser setup
  analyser.smoothingTimeConstant = 0;
  analyser.fftSize = 64;

  var getAverageVolume  =  function( array){
      var length = array.length;
      var values = 0;
      var i = 0;
     for (; i < length; i++) {
        values += array[i];
    return values / length;
  var onAudio = function(){
    var tempArray = new window.Uint8Array(analyser.frequencyBinCount);
    var latestFrequency = (getAverageVolume(tempArray));
    //use latestFrequency
  scriptProcessor.onaudioprocess = onAudio;
  //Handle error

Visualizations with Web Audio API, One of the most interesting features of the Web Audio API is the ability to extract frequency, waveform, and other data from your audio source, which Note: You can find working examples of all the code snippets in our to visualize it however we like, for example by plotting it onto an HTML5 <canvas> . There is no way for us to make a sound in Web Audio that's, say, "ten times louder than a mosquite flying 3 m away". This is because the sound volume that a user actually hears depends on the air pressure changes caused by soundwaves reaching their eardrums. And there's no JavaScript API for that!

Getting Started with Web Audio API, While audio on the web no longer requires a plugin, the audio tag brings The Web Audio API is a high-level JavaScript API for processing and sounds that an audio application or game would use–here's one way The low-pass filter keeps the lower frequency range, but discards high frequencies. Pizzicato.js – Pizzicato aims to simplify the way you create and manipulate sounds via the Web Audio API; webaudiox.js – webaudiox.js is a bunch of helpers that will make working with the WebAudio API easier; howler.js – Javascript audio library for the modern web; WAD – Use the HTML5 Web Audio API for dynamic sound synthesis. It’s

Introduction to Web Audio API, Web Audio API lets us make sound right in the browser. It is very similar to how we would create a context to draw inside with the <canvas> element. If you want to know the frequencies of notes in hertz, you can find them here. I've created a playground, containing all the required HTML and CSS, and  Learn more advanced front-end and full-stack development at: In this tech talk I dive into the details of the Html 5 Web Audio API, a powerful tool for

Web Audio API, This is the Editor's Draft of the Web Audio API specification. The introduction of the audio element in HTML5 is very important, allowing for basic streaming audio playback. Temporarily neuter the audioData ArrayBuffer in such a way that JavaScript The second element (index 1) represents the fundamental frequency. The AnalyserNode interface represents a node able to provide real-time frequency and time-domain analysis information. It is an AudioNode that passes the audio stream unchanged from the input to the output, but allows you to take the generated data, process it, and create audio visualizations.