This page works on my Thinkpad/Ubuntu laptop, but won't work on my Android phone, I don't know why. It probably won't work if you try to sing into it rather than play an instrument because the human voice is so complex, in terms of its wave form. I guess. I'm a barely endurable amateur in this domain too. But if you have a musical instrument handy, it might entertain you for a few minutes.
At first I too was tempted to build an app just like this, but when I mentioned this to my teacher, she made it very plain that the only way to learn intonation is: hear, move fingers, repeat. Anything that gets in the way of making that feedback loop as tight as possible---devices, tuners, even conscious thought---is a distraction. In hindsight I think she's right. Though I too am still a barely endurable amateur, my intonation has improved to the extent that it feels like I have grown a new organ in my brain that connects my ears directly to my fingers.
I found for me that with sensitivity at 20 I can hit every note perfectly! This is a fun tool to quickly go from a melody idea to a DAW now.
I'm very impressed, I've shared with my social as well because I thought it was so cool! Thank you for sharing your work.
Edit: after more playing around (heh) it does start to pick up the almost-E notes, F, G, etc. but is a little inconsistent. I tried monitoring the mic and even recording to play back what got picked up, and it sounds just as clear as the higher notes. Maybe something numerical happening in the Javascript fft?
It looks like the app uses 12-tone equal temperament as the standard for "in tune". For violin it would probably be better to use a just intonation scale as the reference rather than ET. (ET major and minor thirds and sixths differ from just by about 15 cents.) Even better would be to be able to toggle between JI and ET.
A pretty good 12-tone just scale is to use 1:1, 9:8, 16:15, 6:5, 5:4, 4:3, 45:32, 3:2, 8:5, 5:3, 9:5, 15:9, and 2:1 is the octave. (Multiply the ratio by the frequency of whatever your root note is.) Though notably on a violin you run into a complication with the open E string. If the G string is 1:1 and the strings are all tuned in fifths, they're 1:1, 3:2, 9:4, and 27:8. 27:8 is octave-equivalent to the pythagorean major sixth 27:16 rather than the simpler 5:3 major sixth that goes better with the rest of the scale. So, if you go with a just scale there's a potential for people to be confused about why their open E string seems to be out of tune (and the answer is that unless they're deliberately trying to play a pythagorean major sixth it probably is).
The good thing about just intonation is that it's always the same. No configuration.
It's a tradeoff between convenience and optimally consonant harmonies. ET makes a lot of sense for guitar because you have fixed frets (though JI guitars do exist), but violin can be played in any intonation so there's less reason to use ET unless you're accompanying an ET instrument like piano or guitar.
Pianos are "out of tune" so that they sound well to humans.
Yet, modern science still can't measure the harmoniousness of a song at a given point or overall -- we have neither the theory nor the math to do so. It is an active area of scientific research! I find that so cool.
* hypothesis-driven empirical test of a mathematical model
What about consonance and dissonance? We have both the math and the music theory for those. Wouldn't that be a measure of harmoniousness?
I do highly recommend getting a clip-on electronic tuner, because if you want to change tunings quickly or you want to do drop D on a floating bridge, you are gonna need it!
If you can re-tune (fourth line 'F') after you've warmed up the instrument. You do that on that F because it is roughly in the middle of the range of the instrument meaning you'll be off the minimum on the other notes. If you tuned it on the highest or lowest note the other end would be off considerably.
The sax is a wonderful instrument but it is definitely a finicky one, I've never found one that had all the notes in tune when played without corrective measures, and I'm not even sure that it could be done, the flexibility you get in making it go sharp or flat on purpose comes with the price of having to correct almost every note you play.
What's more important is thinking about what has to happen. It requires your ears, brain, and body, to all work together, to put the right finger in the right place, consistently. Because you can't be in tune without being consistently in tune. Developing consistency is also what makes it possible to figure out what you're actually doing wrong, and correct it.
I think singing is a good exercise for ear training. There are YouTube recordings of virtually the entire student violin repertoire. Sing along. Get the tune in your head. Also, you can work on this any time, even away from the instrument.
Often overlooked is that intonation is intimately tied to technique because of the consistency factor. There are many schools of technique, but if you just pick one -- typically your teacher's -- and correct yourself when you deviate from it, you will become more consistent, and this will put you in control of playing in tune.
When I'm playing, and notice that I'm out of tune in a particular passage, I analyze what I'm doing wrong with my technique. This is something that never becomes "good enough," but is a lifelong compulsion. They interviewed Ray Brown near the end of his life, and asked why he still needed to practice. He said: "I still need to improve my intonation." That was from a master whose intonation was considered to be impeccable.
Now here's my contrarian view about temperaments. Engineers get worked up about them, but most musicians are ambivalent. Intonation transcends temperament because it has to do with controlling your body and sounding good. Only keyboard and electronic instruments have definite temperaments. String instruments have useful harmonic intervals in some keys (the "fiddle keys") but not others. Wind instruments are all over the place. I don't think there's a meaningful concept of "temperament" in an orchestra or jazz band. But when everybody is in tune, the band has a more powerful sound.
As a final comment: An adult should not expect to make progress at the rate that kids can. And I advise adult beginners to just avoid double stops -- they are not important enough to justify the mental and physical trauma.
Could you make the staff and notes a big larger? The colors also are really difficult to discern.
I like it!
There's a form of synthesizers where you start with simple sin waves that sounds electronic and mechanical. You layer various overtones on it to create more realistic sounds. Gettign the same richnesss as a real instrument is tough since there tends to be aspects of "sub-structure" for lack of another word. Really cool stuff.
As others have commented, it seems to struggle with the low E and A strings of guitar. Thinking about this:
1. The smallest note interval is from open low E (82Hz) up to the next semitone (82*(2^(1/12) -1)), which is about 5Hz. This gives the maximum bin width.
2. The guitar range is approx 4 octaves, ie up to about 330Hz. The min sampling freq must be double this.
3.In practice the bin edges wont line up with the semitone boundaries, so we ought to aim for bin widths smaller than half of 5Hz above, say 2Hz. This guarantees that a bin exists that doesn't cross semitone boundaries.
4. As lower frequencies probably wont be sampled across an integer number of cycles, spectral smearing will occur. This can be reduced by making the binwidth even smaller, and by use of windowing in the time domain.
5. My environment has background noise (eg computer fan). Unless the noise is filtered out pre-sampling (which it probably isn't for most users) then this will fold back into the signal of interest. Sampling at a higher rate than 2 x 330Hz would allow separation of the noise from the signal. I'm not sure what sample rate is used in the app. If the noise goes up to 4kz (I'm guessing) then this implies a sample rate of 8kHz to remove it.
6. From the above: sample at 8kHz for 1 second, use a window funtion to reduce spectral leakage. 8192 samples is a handy power of 2. Smaller sized ffts are likely to struggle to identify the right bin at lower frequencies, and/or have more noise in the signal band to confuse the peak detector.
7. An oscilloscope display would be handy to verify that signal levels were ok, and that noise isn't too intrusive.
If done in software then a simple implementation of autocorrelation is O(n^2). An efficient implemementation is O(n.log(n)) (it uses two ffts).
The remaining figures still look ok though.
It's not free, but I think the functionality is a bit better than this. It handles fast passages and can change temperament, show how off you were, etc.
So something like a variance of pitch per note measured at the end.
In particular, something like Bach's cello suites tend to highlight these sort of intonation issues.