19 ms·
Deriving the piano keyboard from biological principles using clustering
- vnorilo 6y ago(disclaimer: music degree) I often huff and puff at articles like TFA, but here I found myself nodding: the method is sound and makes sense. Some comments I must leave though: Clustering is not the point of black and white keys. Rather it is the facility to pick an anatomically reachable, desired subset of 12 keys available per octave. As a simplified European tradition baseline, that is the white keys transposed by some number of semitones. The salient thing here is to have a row of keys which are mostly two semitones apart but have a one semitone gap at strategic locations to produce the scale. Much of the music in the world operates roughly on the pentatonic scale which coincides with the black keys, or the complement of "European" scales in a 12 step equally tempered octave. Pentatonic scales are mostly two semitone steps with strategic 3 semitone steps. Finally, the harmonic model in TFA does not resemble the piano very much. Would be interesting to see how different harmonic models and temperaments in various historical keyboard instruments interact with the computation. The modern piano is equally tempered. In a harpsichord, that would generate a lot of roughness for the thirds which are way out of tune. The modern piano mitigates this by having the hammers strike strings at a position that avoids exciting the 5th harmonic (which produces a justly intoned third on top of fundamental frequency). Would be interesting to see what kind of difference to the roughness calculation it would make to omit the 5th harmonic!
- tomsmeding 6y ago> The modern piano mitigates this by having the hammers strike strings at a position that avoids exciting the 5th harmonic This is fascinating! I always wondered why a piano could work so well despite in reality having slightly ill-tuned thirds. Thanks for sharing the tidbit.
- yesenadam 6y agoBut isn't everything in equal temperament "ill-tuned"? The fifths aren't real (3/2x frequency) fifths, etc. Everything except octaves - but piano tuners tell me that octaves that are "too big" (>2x) sound better![0] [0] https://en.wikipedia.org/wiki/Stretched_tuning#Intervals_and_inharmonicity https://en.wikipedia.org/wiki/Stretched_tuning#Intervals_and...
- vnorilo 6y agoYes, but while fifths are off by 2/100, major seconds by 4/100, thirds are by 14/100 or 16/100. The former create gentle swirling interference, the latter a rough stuttering. If you hit a fifth on a piano and listen carefully, you can hear the slow cycle in the sound. The stretched octaves are due to high string tension causing some inharmonicity, ie. sharpening higher harmonics.
- HPsquared 6y agoThe inharmonicity is caused by the strings not being 'ideal' mathematical strings: they have stiffness, due to having some thickness - and require some additional force to bend them back and forth, beyond that of the string tension. This bending stiffness is more evident in higher harmonics than in the fundamental (tighter radius of curvature), manifesting in increased 'apparent stiffness' and therefore a higher frequency, at the higher harmonics, compared to the lower harmonics. Not sure if I've explained it well, but vibrations of an ideal string (no bending stiffness) can be described by a second-order partial differential equation [0], whereas a real string with nonzero bending stiffness is actually more of a 'vibrating beam' problem, which is a fourth-order PDE [1]. EDIT: this is why low notes have greater inharmonicity (thicker strings). [0] https://jmahaffy.sdsu.edu/courses/s17/math531/beamer/string.pdf https://jmahaffy.sdsu.edu/courses/s17/math531/beamer/string.... [1] http://www.math.umbc.edu/~jbell/pde_notes/20_Beam%20Equation.pdf http://www.math.umbc.edu/~jbell/pde_notes/20_Beam%20Equation...
- salty_biscuits 6y agoI don't think bending modes are the usual culprit, it is more often the frequency mismatch between axial and transverse modes that cause inharmonic tones. I'd need to get a real piano and make some spectra and do some maths to show it though.
- weinzierl 6y agoPiano tuning is a science in its own. Google for Railsback Curve if you want to fall down a rabbit hole.
- magicalhippo 6y agoYour post reminded me of this video[1] by Adam Neely, where he tries various tuning systems around A = 432 Hz. As a non-musician it really made me appreciate how little I know about the technical side of music. [1]: https://www.youtube.com/watch?v=ghUs-84NAAU https://www.youtube.com/watch?v=ghUs-84NAAU
- weinzierl 6y ago> "Much of the music in the world operates roughly on the pentatonic scale which coincides with the black keys, [..]" I think there is not so much music in the pentatonic that is formed by the black keys, or a related scale. Off the top of my head only Paul Desmond's Take Five comes to my mind. I think this mainly because it is horrible to read and write in traditional notation. Coincidentally I played a bit of Stevie Wonder's music recently which was all in E-flat minor. I have to say it is very pleasant to play, especially if you use Steve's often unusual fingerings. Reading it OTOH was not so pleasant. This hints to me that our music is not only influenced by the way it sounds and the way it can be played but also by what is convenient to write down and read - and sometimes it takes a blind artist to overcome this limitations.
- vnorilo 6y agoSurely not related to black keys, that is what I tried to say. Most pentatonic music traditiona predate keyboards.
- jmrm 6y agoAFAIK Stevie's songs uses a lot of black keys due to being easier to him to locate them using touch instead of sight.
- carlob 6y agoI highly doubt that anyone with that level of musical training really needs to look at the keyboard...just like you probably don't while you type.
- weinzierl 6y agoWhile similar in some ways you can't compare a computer keyboard with a piano keyboard. The piano is linear and long and sometimes you cannot avoid to jump with your hands. No matter how good you are, the further the jump the higher the risk to miss. Performance is a lot about risk reduction, so even the best of the best have a glance sometimes.
- pantulis 6y agoYou mention "TFA" a couple of times, what is it?
- vnorilo 6y agoThe featured article.
- pantulis 6y agoThanks!
- mxmilkiib 6y agoRead The Featured Manual
- meowface 6y agoI always considered the middle word something slightly different...
- pertymcpert 6y agoYeah. I thought it was odd to use the term TFA when you're not trying to attack the piece.
- meowface 6y agoSame. When I'm trying to be neutral, I usually just say "the article" / "the submitted article". TFA to me carries the same kind of connotation as "TFM" in "RTFM".
- mannykannot 6y agoIt's a context-sensitive grammar (OK, not strictly...)
- jfengel 6y agoOld joke explained: RTFA means Read The Fine Article -- except that F doesn't really stand for fine. It's usually meant as a crabby way of saying "The article answers your question". From that, "TFA" just means "The Article", but without any of the crabbiness, and without the F really standing for anything. That's just a shortcut, and a nice instance where a bit of Internet lore became nicer rather than meaner.
- heresie-dabord 6y ago> Clustering is not the point of black and white keys. Rather it is the facility to pick an anatomically reachable, desired subset of 12 keys available per octave. This is the essential point of critique that makes TFA an exercise in assembling loose hypotheses for publication on the InterWobbles.
- sideshowb 6y agoHi, author of TFA here. Thanks for your comments :) You're right the harmonic model used is a bit of a bodge. I didn't know that about hammer position, very interesting. Let me know if you ever get around to trying different timbres in the code. I think we are more in agreement than you think on clustering, though. Although I neglected to discuss what's anatomically reachable, and also the nuances of history, my point is that the desired subset you mention can be defined by using clustering to pick a subset that sounds good.
- vnorilo 6y agoThank you for writing it! I think perhaps the way I would state the subset problem is that white keys are in a way the "subset that sounds good" to the culture where the piano keyboard arose. More in the vein of discussion than suggesting you'd need to change anything :) The black keys are means of transposing that subset. It is a very interesting but in a way unrelated insight that the black keys also form a consonant group. And then music and musicians naturally coevolve with instruments and do whatever they please!
- jacquesm 6y agoAre you aware of the Janko keyboard?
- recursive 6y agoI had not heard of it. It looks similarly motivated the harmonic table layout. https://en.wikipedia.org/wiki/Harmonic_table_note_layout https://en.wikipedia.org/wiki/Harmonic_table_note_layout
- jacquesm 6y agoIt's a bit different actually, the same keys repeat multiple times 'above' each other, in two alternating rows with half overlap. I've built a little device that you set on top of a regular piano keyboard to experiment with it but that wasn't very satisfactory. Doing a full scale conversion would be quite a job.
- moralestapia 6y agoDisclaimer: I do not have a music degree. I thought (read) that the distribution of black and white keys came to be like that to provide a visual pattern which allows you to easily distinguish the different octaves.
- elihu 6y ago> The modern piano mitigates this by having the hammers strike strings at a position that avoids exciting the 5th harmonic... I think it's actually the 7th harmonic that pianos avoid, if I remember correctly. (I guess one could verify this by measuring the hammer position on a piano string and figure out if it's hitting the node at 1/5 of the string length or 1/7th). This random google result agrees with me: https://pages.mtu.edu/~suits/badnote.html https://pages.mtu.edu/~suits/badnote.html I have a theory that pianos and guitars have become the dominant musical instruments of the last hundred years or so simply because you can get away with mis-tuning them and they still sound pretty good. (I once had the opportunity to play a 15-tone equal tempered guitar, and it still sounded good, which led me to believe that you can get away with almost anything with a guitar.) Which isn't to say that guitars don't sound better in just intonation, they do. On the other hand organs and accordions, for instance, sound amazing in just intonation but not nearly so good in 12-tone equal temperament. The notes (especially thirds and sixths) clash with each other too much. It's tolerable, but not great. I've been working with a group of people converting guitars to 41 tone equal temperament; they have a nicer third (off by about 5 cents instead of about 15) and a closer 4th and 5th (off by about half a cent instead of 2) and can approximate 7-limit just intonation intervals pretty closely. The trick to make it playable is to omit half the frets, so it's fretted for 20.5-tone equal temperament, and any notes not available on one string are available on the string next to it. It sounds like it shouldn't work, but it does. https://kiteguitar.com/ https://kiteguitar.com/
- vanderZwan 6y ago> Roughness and smoothness is all very well, but if you want to write some music, the conventional way to do it is to pick a subset of all possible frequencies to use for your notes and use these as the building blocks for your tune. Actually most musicians don't even do that, they just work with the notes others have picked already. This is unoriginal, perhaps, but convenient for working together. Is this a tongue-in-cheek comment on unreasonable expectations of originality from artists, given that most programmers don't do their work by constructing their own programming language from the ground up either?
- billynomates111 6y agoIf you want to make an apple pie you must first invent the universe.
- sideshowb 6y agoThe tone of the whole thing is fairly flippant, really (an experiment with a different style of writing which I haven't used since!). I certainly wouldn't criticize anyone for using a standard tuning, indeed I do so myself most of the time. Like I said for one thing it makes collaboration (with other musicians or instrument-makers) easier, then there's the fact that the standard tunings themselves form part of the cultural background we're building on when we make more music. For example if we take the roughness plot in the article as representative (which vnorilo rightly calls into question, but still) we see that any interval in the continuous range between an 5th and octave is evaluated as smoother than a minor third. But we don't perceive it that way, I suspect because of our cultural background.
- codeulike 6y agoWe know that notes with simple ratios to their frequencies sound 'good' together (e.g. an octave is a 2:1 frequency ratio, a 'fifth' is more or less a 3:2 frequency ratio), a perfect fourth is 4:3 ratio - https://en.wikipedia.org/wiki/Interval_ratio https://en.wikipedia.org/wiki/Interval_ratio Equal temperament messes with that a little but its still approximately there. So why should simple ratios sound good? From what I've read, its probably overtones, and the way overtones excite the cilia in our inner ear. If you plot the overtones from the two notes of an octave or a fifth, they co-incide a lot. And then why the pattern of notes on the piano keyboard? (More precisely 'why does the major scale use those 7 semitones?') ... I think with that scale, and the other scales, its something to do with squeezing the most amount of 'relationships' possible from a subset of notes without muddying the waters by having too many in play. Music is all about patterns and a mix of repetition and progression, and so having a finite number of notes that have intersting relationships with each other gives a good canvas to work with. (Any why 12 semitones? Again, to do with getting the most interesting relationships without muddying things ... I think its possible to divide the octave into 19 or 43 parts and get some interesting ratios/relationships, but then it gets quite fiddly)
- jedimastert 6y agoI'll just put in that I think things like 12 tone scales and 7 note diatonic scales were local minima in a vast landscape that we happen to hit upon and settle into. The more I look at what music is from a neurological perspective, the more it feels/seems like the deepening and establishing of patterns is the main mode.
- analog31 6y ago12 tones is the smallest approximately rational scale. There's a technological reason for preferring this. Up until fairly recent times, a musician had to be able to tune and maintain their own instrument. Also, we can't grow more fingers. There may also be a benefit to more widely spaced notes, notably (!) that it's easier to distinguish if you're playing a "real" note or not, and if it's the same note as the one you're hearing someone else play. This would make it easier to learn musical ideas and pass them on to others, giving 12 tone music (fewer tones if using an agreed upon scale) a built in error correction code, and a sort of evolutionary advantage over time if you will.
- Valodim 6y agoI can relatedly recommend eevee's post "Music theory for nerds". I'm sure it's one of those that experts will huff and puff about, but it made a bunch of concepts between sound perception and music theory "click" for me: https://eev.ee/blog/2016/09/15/music-theory-for-nerds/ https://eev.ee/blog/2016/09/15/music-theory-for-nerds/
- teambob 6y agoHow applicable is this to eastern musical scales?
- sideshowb 6y agoI don't know enough about e.g. Indian ragas to say, but you can certainly derive plenty of other scales from exploring relations of the form (a/b)^c == (d/e)^f + error, for integers a-f, while trying to balance small a,b,c,d,e,f against a small error. Any such derivation can be clustered to a piano keyboard of sorts, obviously with a different shape. I remember doing this once (though I forget which for) and making a keyboard that looked much like ours i.e. mostly alternating black/white notes, but the number in each "group" of "consecutive" blacks was different, e.g. 3+4 rather than the 3+2 we all know.
- tantalor 6y ago> there's a good chance these sounds come from the same object, due to the physical principle of resonance. And so our perception of sound evolved to reflect this... we discovered that making decent music increases the odds of mating It is likely we did evolve this unique ability, which our cousins do not have, but we have no idea why. These hypotheses about "same object" and "music -> sex" is unsourced speculation. https://www.medicalnewstoday.com/articles/325444 https://www.medicalnewstoday.com/articles/325444
- alok-g 6y agoThanks a lot for sharing this. Loved reading.
- sideshowb 6y agoHi, author here. Thanks for the link. You're right I have no expertise in the hypotheses you mention, for the post I intended them as light hearted framing. I'd be interested to know how the MRI results you link would compare for any bird species which use songs as a mating call/indicator of fitness. That would be another piece of the puzzle I guess. IIRC there has also been work by musicians attempting to link our notions of beauty to processes of pattern matching/learning, though again more in the realm of speculation than neuroscience. And for the record I like to think my own interest in music is at least slightly more profound than the quote above implies ;-)
- d_rc 6y agoHere is the notebook code in Deepnote if anyone wants to play with it: https://deepnote.com/project/JupyterNotes-zXwE7yVJSLeJx4aNp3IL_g https://deepnote.com/project/JupyterNotes-zXwE7yVJSLeJx4aNp3...
- yummypaint 6y agoExtending further into 2 dimentions creates some interesting possibilities. I have become a big fan of the wicki-hayden isomorphic layout (hex grid). It ends up grouping western scales into vertical bands. Moving horizontally changes by two semitones, moving another direction changes the note by fifths. I built a keyboard with this layout because it's such a convenient way to conceptualize arrangement of notes, but there are certainly tradeoffs when it comes to actually playing. You end up with duplicate notes, so you can play in unison with yourself like on most string instruments. The isomorphic nature of it is one of the strongest points: you only need to train your muscle memory once for each chord (major, minor, etc), and you can use that exact shape anywhere on the keyboard. Its good for jamming and discovery, but i cant imagine being able to play as many notes/second as a normal piano. See figure 11: http://rainboard.shiverware.com/images/0/08/Isomorphic_Tessellations_For_Musical_Keyboards.pdf http://rainboard.shiverware.com/images/0/08/Isomorphic_Tesse...
- pierrec 6y agoThere are lots of things to love here. The interval roughness function based on the harmonic series is interesting, and I wonder if it could be used to give some kind of score to chords or tuning systems, and maybe even generate them. The article also made me realize that there are two different ways of arriving to 12 tones per octave: - The pythagorean way: you keep iterating the "pythagorean tuning algorithm" described in the article until it gives you a note that's almost exactly like one you already have (I believe this is a less convoluted way of describing the "useful coincidence" hinted at by the author). It gives you a scale made of 12 notes, with more or less complex natural relationships between them. - The logarithmic way: you test all n-tone equal (logarithmic) divisions of the octave, up to some large n where notes end up too close together. You compare how much they deviate against the most important natural intervals: pure 2nd, 3rd and 5th. You'll find that 12-tone equal temperament forms a deep local minimum. Historically, ancient scales were constructed using methods similar to the first. My interpretation is that musicians desired to freely transpose melodies without making them sound bad, so scales got more refined, and those that maintained 12 notes to the octave started approximating equal division. Eventually, logarithmic tuning satisfied that demand exactly. I'd say the more interesting coincidence is that this transition could (theoretically) be smoothly done between obvious natural and equal temperaments - precisely because the above two methods result in the same number of notes. Of course, history isn't smooth, and alternative systems can be found in all periods. Maybe the dominion of 12 will even come to an end at some point.
- sideshowb 6y agoI like your simplification of the pythagorean tuning algorithm and would run with that if explaining this again. On your first point I think there exists a vst that tunes each chord you play to be as consonant as possible. A related side project I had was to take a midi file and through optimization specific to that file, define a scale to play it on which is makes a trade-off between 1. making the original tune as recognizable as possible, 2. as different to a western scale as possible, 3. as consonant as possible. I've yet to make it sound good!
- ciconia 6y agoThis is not the first time that I come across an article where the author derives harmonic rules from purely physical or mathematical principles. I always find it a pity that the author has apparently not made the effort of reading up a bit on the history of musical theory. The actual harmonic rules employed today in all kinds of western music, especially as they relate to musical notation and the physical layouts (the UI so to speak) of various western musical instruments, have as much to do with the evolution of music theory as with the physical behavior of sound waves and human perception thereof. Case in point, the layout of white and black keys on the keyboard: the disposition of white and black keys has more to do with the theory of hexachords developed in the 12th century. The hexachord system used to notate and transmit music was originally comprised of three overlapping hexachords, each including 6 notes (ut-re-mi-fa-sol-la) , which together cover in total 8 notes to the octave: The natural hexachord C D E F G A, the soft (molle) hexachord F G A Bb C D, and the hard (durum) hexachord G A B C D E. I should add that this system was superimposed on the greek modes of gregorian chant, made of two tetrachords for 7 notes to the octave. So the soft hexachord starts on fa - the fourth tone of the natural hexachord, and the hard hexachord starts on sol - the fifth tone of the natural hexachord. And if you you play a melody and you want to go to Bb - the B flat (B-molle / bémol) is actually a fa on the soft hexachord. Likewise, a B natural (B-durum - bécarre) would be a mi on the hard hexachord. The terms bémol and bécarre (Bb and B natural) actually derive from the soft and hard hexachords (soft - round, hard - square). So the Bb was in fact the first "black" key (although some of the earliest keyboards have 8 "white" keys to the octave, with the Bb looking just like its neighbors). Later, from the 14th century on, as music changed, more hexachords were introduced starting at different places on the natural hexachord, for more harmonic complexity. Along with those hexachords, more "black" keys were introduced. Actually some baroque keyboards include more than 12 keys to the octave, for use with meantone tuning: they would have split "black" keys in order to play the fa or mi of the note, for example Eb or D#, which in meantone tuning are not equivalent. But as composers and keyboardists started exploring both equal temperament and irregular temperaments, those distinctions were lost. The modern keyboard with its 7 white keys and 5 black keys is rather a consequence of the evolution of western music over long centuries, not of any kind of absolute natural phenomenon.
- anamexis 6y ago
- tester13 6y agoo"><img src=x>
- tester13 6y agobing.com
- deleted 6y ago[deleted]
- jng 6y agoNext to this interesting article and comments, I think mention should be made of von Helmholtz's XIX century book "On the sensations of tone". He is considered to be the father of acoustics, and derived the consonance/dissonance of the notes in the diatonic scale from first physical principles. He extracted and computed what is described as "roughness" here as the amount of "beats" between the upper partials of the notes - where beats are the slow phase oscillations caused by two vibrations of very close frequencies. But of course, he first had to study strings and pipes for 8 years, and come up with the (then) innovative concept of upper partials (harmonics). I'm a software person by trade, amateur but very dedicated musician, read this book many years ago, thoroughly enjoyed it, and I heartily recommend it today.
- SeanLuke 6y ago12-note equal temperament is a reasonable local minimum but it is by no means the best in the sense of roughness: 31-note is better. Not to promote 31-note (which I do not use), but how is it that this article can arrive at 12-note in some sense of optimality with regard to roughness criteria when it is clearly not?
- HPsquared 6y agoCould a 31-note scale be enhanced further by adding more notes?
- SeanLuke 6y agoNope.
- sideshowb 6y agoHello. I wasn't suggesting 12 is optimal, so much as trying to explain the link between clustering and pianos. I guess by going for 2^7~=(3/2)^12 over other such correspondences I'm bringing some history to the table, intentionally or not.
- leethargo 6y agoNice article and application idea (clustering). After reading about the dissonance theory by Sethares [1] used as the basis of TFA, I also did some related experiments of finding the most consonant 3-note chords in different scales (not limited to 12 tone equal temperament) [2]. This whole topic (scales, microtonal music) is a huge rabbit hole for nerds with some musical curiosity and I can highly recommend the text book by Sethares on the topic. [1] https://sethares.engr.wisc.edu/consemi.html https://sethares.engr.wisc.edu/consemi.html [2] https://rschwarz.github.io/posts/consonant-triads https://rschwarz.github.io/posts/consonant-triads
- sideshowb 6y agoIIRC there's a vst out there that retunes itself on the fly to make each chord as consonant as possible