[HN Gopher] Show HN: Are you playing your violin (viola, guitar,...
___________________________________________________________________
Show HN: Are you playing your violin (viola, guitar, etc.) in tune?
Author : ctrager
Score : 43 points
Date : 2021-01-26 17:25 UTC (5 hours ago)
(HTM) web link (ctrager.github.io)
(TXT) w3m dump (ctrager.github.io)
| analog31 wrote:
| I'll check it out with my cello when I'm not in a meeting. ;-) Of
| course we'll eventually need tenor and bass clefs, but certainly
| not an obstacle.
| jtchang wrote:
| Cool. I tried it with my viola but noticed the notes didn't
| appear correctly on the staff. Also it did jump a bit when I was
| playing a C major scale.
|
| Could you make the staff and notes a big larger? The colors also
| are really difficult to discern.
|
| I like it!
| ctrager wrote:
| I'm not any sort of scientist - everything I know about the
| topic I learned from trying to code this thing - but don't
| think of the sound wave coming from your viola as a simple sine
| wave. It's way more complex than that, with all the
| overtones/harmonics happening in addition to the note you think
| you are playing. The logic for deciding which pitch you are
| playing is fuzzy, and you can tweak the logic with the settings
| at the bottom of the page.
| aspaceman wrote:
| Nah you got 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.
| klyrs wrote:
| This is quite interesting stuff! A bowed string is nowhere
| near a sine wave -- it's approximately a sawtooth wave! The
| reason for this is that the string sticks to the bow
| (traveling relatively slowly) until the tension of the string
| overwhelms the coefficient of static friction, where it
| quickly slips (the jump discontinuity) across the bow until
| the relative velocity of the string drops enough to stick
| again.
|
| https://www.physicscentral.com/explore/action/fiddle.cfm
| ctrager wrote:
| I wrote this for my wife who is learning to play viola (I play
| violin at a barely endurable amateur level). It was to help her
| improve her intonation. As you play it draws the notes that you
| are playing on the musical staff, coloring them black for in
| tune, red for sharp, blue for flat. It's one single
| html/javascript file, no server.
|
| 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.
| jtanderson wrote:
| Very nice work! There seem to be some issues for me with the
| lower strings on guitar: the low E registers as a B, for
| example. Higher strings seem to work well though. Not totally
| sure what's going on, but could probably be attributed to mic
| quality :)
|
| 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?
| InitialLastName wrote:
| You need a longer FFT window to discern lower frequencies.
| Assuming a 44.1k sample rate and the default window size of
| 4096, you only get 10Hz buckets. Given that the low E is
| 82Hz, you effectively can't distinguish it from the D# at
| 78Hz and the F at 87Hz
| ctrager wrote:
| FFT is configurable at the bottom of the page, but for me
| it gets unpleasantly laggy if I make it bigger than 4096
| InitialLastName wrote:
| Yep, that's the tradeoff. As with seemingly everything
| else, you can thank Claude Shannon for that.
| 2data222 wrote:
| Hey, just wanted to let you know that this worked on my Android
| phone (Pixel 4 XL running stock Android 11 and in Chrome) after
| I granted microphone permissions. I whistled a few bars and was
| grossly out of tune so I know it's working ;)
| loco5niner wrote:
| Way cool. Just tried it with my voice, and it actually tracked
| really well. Impressively kept up with me on the scales, but
| mostly red and blue, lol.
| ctrager wrote:
| You must have a very pure voice!
| toxik wrote:
| I'm a complete novice, but I remember hearing that we actually
| like to hear music ever so slightly off key. What does this
| analysis tool say for expert recordings?
| ctrager wrote:
| I think what you are referring to is "temperment", and a TLDR
| version of that topic would be that for tuning a piano so that
| it can sound in tune no matter what key, it is tuned to be
| evenly out of tune everywhere, aka, "equal temperment". This
| little app follows equal temperment. A string player playing
| unaccompanied solo might tend to play in a way that sounds
| better, aka, "just temperment", and so would seem to be out of
| tune according to this tool.
| singingfish wrote:
| does it support transposing instruments? The sax - especially the
| soprano - can be very tricky to play consistently in tune.
| InitialLastName wrote:
| You'll be unlikely to be more than a quarter-tone out of tune
| though, no? I used to practice saxophone with a tuner to
| enforce intonation consistency; I could intentionally bend
| notes further, but I don't recall the tuner ever picking me up
| on the wrong note when I was playing naturally.
| ctrager wrote:
| Just FYI, notice the configurable "Sensitivity" setting. The
| default of 12 let's you miss by about a quarter of a tone
| (half step) either way.
| InitialLastName wrote:
| I'm just saying that if they're playing moderately
| accurately, the note will read transposed, but it will be
| correctly annotated as sharp or flat.
| ctrager wrote:
| I coded for transposing up or down by an octave, but not by
| other intervals. I imagine it wouldn't be hard for somebody to
| fork/modify the code to transpose by thirds, etc.
| cousin_it wrote:
| Note that the most natural way to sing or play a fretless
| instrument isn't exactly 12 tone equal temperament. For example,
| if you try playing a major triad C-E-G as harmoniously as
| possible without referring to the piano, the frequency ratios
| C:E:G will be 4:5:6, which means 386 cents for C-E and 316 for
| E-G, instead of 400 and 300. The difference is quite audible. So
| be careful telling people they're 15 cents sharp or flat, as it's
| actually what makes the thirds and sixths in classical music
| sound so sweet!
| ctrager wrote:
| Yes, sure. And TBH, even though I wrote this for my wife
| learning viola, I have since banned her from using it (don't
| worry - I have no power, she completely ignores my ban). I
| encourage her to use her ears rather than her eyes for
| monitoring her pitch, cuz, irl, that's what has to happen.
| matiasb wrote:
| Awesome!
___________________________________________________________________
(page generated 2021-01-26 23:00 UTC)