cwilso / pitchdetect Goto Github PK
View Code? Open in Web Editor NEWPitch detection in Web Audio using autocorrelation
Home Page: https://cwilso.github.io/PitchDetect/
License: MIT License
Pitch detection in Web Audio using autocorrelation
Home Page: https://cwilso.github.io/PitchDetect/
License: MIT License
Various Frequencies such show the wrong pitch - especially higher frequencies. 880A does shows G - how does one go about fixing this?
Hello. Your app is really cool. It was working for me on my Windows 10 PC the other day via Chrome, and now it no longer works. I received the error provided in the title when I when to your app site, http://webaudiodemos.appspot.com/pitchdetect/, and clicked on the 'use live input' button. I tried using Microsoft Edge and the issue still occurred there as well.
I'm impressed by this demo, and made a bower package of some of the code https://github.com/tirithen/PitchDetector , however in both your and mine version the connection to the microphone closes after ~ 5 - 30 seconds. The icon beside the address field in the browser disappears but I cannot find a way to detect any error happening.
Did you experience the same problem (using Firefzox 32.0.1)?
On clicking use live audio, stream generation fails on chrome without asking permission to use my mic?!
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.
Tried to run this on your site, it said "stream generation failed". I tried to use live input.
Not sure why.
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?
seems local demo try to fetch "../sounds/whistling3.ogg" but not there
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.
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?
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.
I got "Stream generation failed" error alert when I use this code on Safari IPhones.
I would love to get your support!
I am using Chrome browser in Pixel 5. There is not response in live audio module.
Doubt about this code in function autoCorrelate:
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!
plz help it didnt work on safary, any solution ?
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.
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 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
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
It's not working on Safari on IOS 11.3 Iphone 6+. Havent test for the others or Android
Would it be possible to use this library to detect a pitch of Wav samples, decoded audio buffers, without actually playing the audio? Thank you!
Does anyone have this working on the iPhone?
Now that we have it in the Web Audio spec...
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
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):
So, what would be the perfect way to have a bigger buffer size?
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!
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 :)
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)
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 ... 👍
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.