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.
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!
This appears to differ from the Janko layout, though they both apparently share the feature that "if you know the shape of a particular chord or scale, you can automatically play the same thing in another key just by moving your hand" (so long as you have five rows of buttons, in the accordion layout.)
There are many ways to skin this cat apparently, though as with QWERTY, established convention is hard to change.
Changing keys on standard keyboards just seems unnecessarily difficult.
My primary instrument is piano so it's definitely involved rewiring my concept of which notes are 'close' and 'far' to match the circle of fifths. Until now I never noticed how in addition to the usual cadences, many tunes have further rising/falling sequences of 5ths in the bass.
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
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.
As a non-musician it really made me appreciate how little I know about the technical side of music.
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.
For example Stevie actually plays the main melody of the main riff of Superstition distributed to both of his hands. This allows him to simultaneously play some bass notes with his left and some higher chords with his right hand while completely avoiding to move his hands away from their basic position. His hands never jump. Playing the melody with both hands is unusual and not what most Superstition tutorials show, but it is actually very pleasant and safe because everything just lies under your fingers.
The other side of the same coin is that Stevie never had to worry if his music is easy to write and read. That also facilitates playability and maybe emphasizes pleasant movements over looks on a sheet of paper.
http://bluefunk.rocks/NonBandPictures/FunkKeyStuff(JoshPaxto...
Depending how strictly you’re using “pentatonic” there, I don’t think you’re correct, unless I’m misunderstanding. In the wider classical and jazz repertoire there’s plenty of music written in Eb, Gb etc, heavy on the black notes.
For example, Debussy’s piano music often uses keys with lots of flats (or lots of sharps). Chopin supposedly played the black keys with his thumbs in some cases, against the accepted style at the time.
In jazz, Billy Strayhorn (who I think was strongly influenced by Debussy) seemed to be very fond of writing in Db.
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.
[0] https://en.wikipedia.org/wiki/Stretched_tuning#Intervals_and...
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.
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....
[1] http://www.math.umbc.edu/~jbell/pde_notes/20_Beam%20Equation...
Well, I think of and hear a major third as the loveliest interval on a piano, not "rough stuttering"!
Basically, the harmonics that rise off of piano strings aren't exact multiples of the fundamental -- they're a little bit off, because piano strings don't behave entirely like ideal strings, they behave like metal cylinders. In the mid-range they're pretty pretty close to plain equal temperament, but in the high treble the strings get shorted but the string gauge stays almost the same, which means the ratio of diameter to length increases and they act less like strings and more like cylinders. The bass has similar issues with single and double wound strings. So, the fix is to just stretch the octave enough so that the harmonics of low notes line up better with the fundamentals of higher notes, and so on. (What we perceive as "out of tune-ness" is the wobbly sound of two frequencies played together that almost but don't quite line up, creating a beat frequency.)
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.
RTFA derives directly from RTFM ("Read The ... Manual"), which I always interpret with the full force of the embedded expletive.
This is the essential point of critique that makes TFA an exercise in assembling loose hypotheses for publication on the InterWobbles.
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.
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!