Coder Social home page Coder Social logo

pitchdetect's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pitchdetect's Issues

Phone

Does anyone have this working on the iPhone?

Sound Engineer Feedback

My brother is a sound engineer and he was very happy to have a handy lightweight web widget like this while working. One thing he mentioned on topic of only working with monotones:

Maybe try subtracting the 'overtone series' from a sound when analyzing through a frequency spectrum, might help with the monophonic sound problem

Live demo does not work in contemporary Chrome and Firefox

Live demo does not work in contemporary Chrome and Firefox

Firefox: 120.0.1 (64-bit)
Chrome: Version 119.0.6045.200 (Official Build) (64-bit)

It asks for permission for microphone and the buttons work, but the display shows just blank - Hz.

A way to increase buffer size

Hi,

I'm writing another pitch detection from microphone input and while I use another algorithm (YIN), I follow the same processing flow.
(Extract buffer with getFloatTimeDomainData, process it and use requestAnimationFrame)

Now, if I want a buffer bigger than 2048 (for lower frequency detection as example):

  • I can't use the AnalyserNode because the fftsize is limited to 2048.
  • I can use a ScriptProcessorNode with getChannelData (even if it's not really convenient because I don't control the execution and multiple onaudioprocess are added to queue) but it's now deprecated in favor of AudioWorkerNode where it seems we can't have fixed buffer size.

So, what would be the perfect way to have a bigger buffer size?

Downloaded zip, program wont work

When I try the live input or anything else for that matter, it stays blank and will not do anything. Please help, this program would be so cool if it would work in places other than your demo website.

Pitch detection is inaccurate

Not too sure about the maths for the pitch detection portion, but I decided to generate various oscillators to test the pitch. I noticed that most of the notes are not detected accurately even when generating an oscillator at a fixed frequency (even the live instance is off by a cent for the default A4).

When you reach B6 it is quite drastic with pitch being detected incorrectly by 49 cents (flat).

sourceNode.frequency.value = 1976; // set the oscillator's frequency to B6
pitch_off

var notes = [];
/* C C# D Eb E F F# G G# A Bb B*/
notes[0] = [65.41, 69.30, 73.42, 77.78, 82.41, 87.31, 92.50, 98.00, 103.8, 110.0, 116.5, 123.5]; //2

notes[1] = [130.8, 138.6, 146.8, 155.6, 164.8, 174.6, 185.0, 196.0, 207.7, 220.0, 233.1, 246.9]; //3

notes[2] = [261.6, 277.2, 293.7, 311.1, 329.6, 349.2, 370.0, 392.0, 415.3, 440.0, 466.2, 493.9]; //4

notes[3] = [523.3, 554.4, 587.3, 622.3, 659.3, 698.5, 740.0, 784.0, 830.6, 880.0, 932.3, 987.8]; //5

notes[4] = [1047, 1109, 1175, 1245, 1319, 1397, 1480, 1568, 1661, 1760, 1865, 1976]; //6

Mic won't work first time

I used the toggleLiveInput() function to activate the microphone on a Cordova CLI project built by Intel XDK. For some reason, the app ignores the microphone on the first launch. After a second launch, everything works normally. Does anyone know why? Thanks in advance!

How to get this to work with lower notes?

This code works great for notes in the upper register! Unfortunately, it doesn't seem to work well with lower notes. For example, often times mistakes a C3 for a C4..etc. Any advice/solutions on how to improve this? Anyway to gate/ignore upper harmonics once a fundamental frequency is detected?

I need some explanation

Hi, i'm using your code for my course work (you can check it here or play here (you'll need a translator)) and i want to understand how your script work
The main question is: what are these numbers and how did you get them

function noteFromPitch( frequency ) {
        var noteNum = 12 * (Math.log( frequency / 440 )/Math.log(2) );
        return Math.round( noteNum ) + 69;
}
function frequencyFromNoteNumber( note ) {
        return 440 * Math.pow(2,(note-69)/12);
}
function centsOffFromPitch( frequency, note ) {
        return Math.floor( 1200 * Math.log( frequency / frequencyFromNoteNumber( note ))/Math.log(2) );
}

or can you send a link to materials where i can read about it all?

Stream generation failed?

On clicking use live audio, stream generation fails on chrome without asking permission to use my mic?!

Doubt about this code in function **autoCorrelate**:

Doubt about this code in function autoCorrelate:
image
Since "buf" is not changed in this loop:
for (var j=0; j<SIZE-i; j++)
c[i] = c[i] + buf[j]*buf[j+i];
'buf[j]*buf[j+i]' should always be the same result, so every element in the 'c' array should be equal, Am I understanding it wrong? Looking forward to your reply!

Thank you, this is awesome!

I mainly compose through whistling and I've been meaning to make a little whistle detector that will jot down a melody for me so I can develop it further in the browser.

I'd like to use this and build it out. Now that it's a few years down the line, can you comment on the efficacy of your pitch detection approach and if there are other approaches to consider?

Thank you! Never stop making music :)

error: failed to set the 'buffer' property

Getting an error whenever I try to run the program in "use demo audio" mode:

from line 187 -
Uncaught TypeError: Failed to set the 'buffer' property on 'AudioBufferSourceNode': The provided value is not of type 'AudioBuffer'.

Not working on mobile

It's not working on Safari on IOS 11.3 Iphone 6+. Havent test for the others or Android

Stream generation failed

I get Stream generation failed alert when using live input. I think, https is problem. Is it possible to use live input via http? On localhost works perfect.

getShadowHosts Error in Chrome

Hi,

Thank you for this amazing effort towards a better understanding the approach to code for sound detection on the Web.

I am getting this following error from my Chrome Inspect area. Would you happen to know how to get rid of it?

Uncaught TypeError: Cannot read properties of null (reading 'getShadowHosts')
    at MutationObserver.<anonymous> (kwift.CHROME.js:3:639176)

Certain Frequencies

Various Frequencies such show the wrong pitch - especially higher frequencies. 880A does shows G - how does one go about fixing this?

"Stream Generation Failed Error"

Please give me a support.
I got "Stream generation failed" error alert when I put this code in my Server.
when I Access it from

What should I do?
Please support ... 👍

Stream Generation Failed?

Tried to run this on your site, it said "stream generation failed". I tried to use live input.

Not sure why.

Adjusting the microphone input level

It seems that Firefox is somehow able to automatically control the microphone input volume level on my computer, and in the real-time it adjusts the mic level to either low & high, depending on my how loud I speak on the mic.

calc2

I used your link to test for this feature: https://webaudiodemos.appspot.com/pitchdetect/index.html

How can I achieve the same on the Chrome? Is there a special Chrome setup for this? Or, is there a Chrome plugin for this, or even a 3rd-party plugin? Also, is it possible to accomplish this using any of the your audio libraries after the end-user has granted the browser access to the microphone?

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.