しくみ
- 運指: 隣りあう2音を弾く指の組ごとに「楽な開き」の表があり、外れると罰点。親指くぐり・弱い指(4・5)・親指で黒鍵にも罰点。合計がいちばん小さい並びを、動的計画法で選びます。
- 手首: 押している指(と、もうすぐ押す指)が届く位置へ近づけながら、急に動かないようになめらかにつなぎます。届かない瞬間があれば、そこを重くして計算し直します。
- 手首の回転: 手首から先を水平に回す向きも一緒に決めます(親指の側へ 20 度・小指の側へ 30 度まで)。親指くぐりでは、手を回しながら横へずらすと、親指が遠くまで届きます。
- 先回り・力の抜け方: 押していない指は鍵の表面に軽く触れて休み、次に押す鍵の上へ低く移ります。持ち上げるのは約1音前からで、高さは曲の速さと音の強さで変わります(ゆっくり・弱い所は触れたまま押す)。
- 指: 指先の目標から関節の角度を逆算(IK)。関節は人の範囲で止め、先の2つの関節は連動させます。
- 打鍵: 指は下りてくる勢いのまま鍵を押し下げ、底で止まります(鍵の上でいったん止まらない)。動きは、速さも加速度も 0 から始まって 0 で終わるなめらかな曲線(最小ジャーク)です。
- 指のつながり: 腱と筋肉を共有しているので、1本を動かすと、となりの指が少しついてきます(薬指がいちばん、親指はほとんど。研究の値をもとにした目安)。空中で止めている指は、ゆっくり小さくゆれます(0.5mm ほど。このアプリの目安)。
- 手首の上げ下げ: 最初は「腕ごと大きく」で、和音・間のあく音は腕ごと持ち上げて落とします(「打鍵」で「和音・オクターブは手首で」「ぜんぶ指だけで」にもできます)。押していない指先が鍵にもぐりそうなときは(親指くぐりなど)、手首を上げます。上げる高さはこのアプリの目安です。
- 関節の速さ: 筋肉で出せる速さには限りがあるので、指の関節は 1 秒に 1500 度より速くは動きません(プロのピアニストの速い音階で、指の付け根の関節の最大がおよそ 1160 度/秒という測定から、少し余裕を見た目安)。指どうしは、皮ふと肉が押し合うのはかまいませんが、骨が近づきすぎるときは動かせる指が横によけます。
- 届かない音: 骨の長さと関節の範囲で届かなければ、押せなかった音になります(鍵が沈まず、音も鳴らず、ノーツに ✕)。届くように数値を合わせることはしません。「関節をやわらかく」(ストレッチした手の目安)で届くかも試せます。 楽譜を開いたとき、片手で届かない和音は内側の音から外し、灰色のノーツ(音だけ)にします。
- 検査: 1/120 秒ごとに、届かなさ・関節の限界・指どうしのめりこみ・鍵へのめりこみ・左右の手のぶつかり・速さを測ります。
- 左手: 右手を鏡に映した手です。運指は、鍵盤をレを中心に左右反転して(黒鍵の並びが同じになる)右手の規則で決めます。
- 和音: 同時に押す音は、低い音ほど小さい番号の指(左手は逆)。「指1本に白鍵1つずつ置いた形」からのずれが小さい並びを選び、和音から和音へは手の位置の動きが小さいように決めます。跳ぶ前の音は、間に合うように少し早く離します(音は楽譜の長さまで鳴らします)。
- ペダル: 音をのばすペダルを踏んでいる間に離した音は、ペダルを上げるまで鳴ります。
- 運指の答え合わせ: 音階・ハノンなど、教本でよく使われる運指がある曲は、決まった運指とくらべて一致した数を出します。
骨格: 指の骨と中手骨の長さは、成人 66 人の X 線写真の平均(Buryanov・Kotiuk 2010)。中手骨の幅と厚みは CT の測定値(男性 50 人)、尺骨の頭の太さも CT の測定値です。前腕の2本の骨は、手のひらを下に向ける(回内)ので交差します(回す角度 150° は可動域をもとにした目安)。橈骨は親指の側へ弓なりに曲がっていて(研究の値をもとにした目安)、そのおかげで交差してもぶつかりません。手根骨 8 個の形と位置、指の骨の太さは、解剖学の図をもとにした目安です(手根骨の大きさの順番と、舟状骨の長さ 約 22mm は研究と合っています)。
筋肉・腱・脂肪: おもな筋肉(母指球・小指球・母指内転筋・骨間筋・虫様筋など)と、指を曲げる腱・のばす腱、指のはらと付け根の脂肪を、骨に付けた模型にしています。両端が別の骨に付いた部品は、関節が動くとのび縮みし、筋肉は体積を保つので、のびると細く、縮むと太くなります。位置と太さは解剖学の図をもとにした目安で、指を曲げる腱の厚さ(約 3mm)・手の甲の肉の厚さ(約 3mm)は研究の要旨の値と近いことだけ確かめています。模型は皮ふと同じように骨について動くので、親指をくぐらせても皮ふの外へ出ません。
皮ふの形: 骨とこの模型の外側に合わせています。手の甲は中手骨のアーチに沿って骨の上 3.5mm(手の甲の肉の厚さ 3.2mm の研究の要旨をもとにした目安)、指の甲の側は 2.5mm(目安)で、指の太さの残りは手のひら側の腱と脂肪です。指先の骨は爪のすぐ下(爪床と爪で約 2mm、指の超音波の総説)にあり、指のはらの肉は厚くなります。子どもと小さめの手は皮下脂肪を少し多くして、関節のふくらみとしわを控えめにしています(目安)。前腕の太さは、手首の周囲 16.8cm(米陸軍の身体計測の男性平均 17.6cm に、このモデルの手の大きさ 95% をかけた値)、肘の側 27.5cm(目安)です。この手の幅と周囲は、同じ計測の男性平均の約 95% です。
指の構え: 立てる・中間・寝かせるで、力を抜いた指の曲げ・鍵を押す位置(寝かせるほど奥)・手首の高さ(寝かせるほど低い)が変わります(どれも目安。最初は中間)。白鍵は、指の腹が隣の黒鍵の手前の面に当たらない所までしか奥を押せません。このモデルでは寝かせるほど指をのばしきる場面が増えます。指の付け根の関節は曲げると横に開きにくくなる(靱帯が張る)性質があり、本物のピアニストが広げる所で指を寝かせるのはそのためですが、その数値を測った研究が見つからず、まだ入れていないためです。
指の力の抜け方: 押していない指は鍵の表面に軽く触れて休みます。打つ前に指を持ち上げるのは約1音前からで、高さは曲の速さで変わります。ゆっくりの所ではほとんど持ち上げずに鍵に触れたまま押し、速い所ほど上から打ちます(1秒に 2 音で約半分が触れたまま、7 音以上はすべて上から打つ。持ち上げの高さ 12〜18mm は研究の値をもとにした目安)。強い音ほど高く持ち上げて上から打ち、弱い音は触れたまま押します(打つ前の指の高さと音の強さには関係があることが測られています。倍率は目安)。つなげて弾く音はゆっくり離して鍵の上に残り、切って弾く音はすばやく離して少しはね上がります(目安)。楽譜の強弱は MIDI の強さと MusicXML の強弱記号から読みます(内蔵の曲は強弱がないので mf)。
届かない音の直し: 手首の位置は、まわりの音との折りあいで決まるので、手首を少しずらせば届く音が届かないことがありました。押す瞬間に届かない音があれば、そのとき押さえている音すべてに届き、押していない指を鍵にもぐらせない手首の位置を近くで探して、その時刻のまわりだけずらします(手首の速さが人の範囲をこえるならやめます)。それでも届かない音は「押せなかった音」として出します。
音: 外の録音は使わず、ブラウザの中で合成しています。ピアノは弦の物理をもとにしています。倍音は弦の硬さで整数倍から少しずれ、高い倍音ほど早く消えます。ハンマーが打つ位置で弱くなる倍音があり、2本の弦が少しずれてうなります。強いほど明るい音になり、いちばん高い音域はダンパーがないので離しても鳴ります(どの数値も目安)。
手の見た目: 骨に合わせて丸い円すいと板をなめらかにつないだ形を、起動時に網にして、関節といっしょに曲げています。爪・関節のしわ・手の甲の腱と静脈・肌の細かい凹凸と色むらは、計算で作った模様です(本物の手を測った形や写真ではありません)。
手の大きさ: 「大人(大きめ)」は、親指から小指までいっぱいに開いた幅が約 21cm になる大きさです(ピアニストの男性の平均 22.6cm・女性 20.1cm、Boyle ほか 2015)。
簡単にしたところ: 骨の長さと関節の範囲は大人の手の目安(1人分を、手のモデルごとに大きさと指の長さだけ変えたもの)。手首は水平に回り、手のひらは少しだけ傾きます。鍵はシーソーのように奥の支点(手前の端から約 24cm、目安)で回って、手前ほど深く沈みます。鍵の形(白鍵の切り欠き・黒鍵の台形)は本物に似せた目安の寸法です。
How it works
- Fingering: for each pair of fingers that play two neighboring notes, there is a table of "comfortable spreads". Going outside it adds penalty points. Passing the thumb under, using the weak fingers (4 and 5), and putting the thumb on a black key also add points. Dynamic programming picks the order with the smallest total.
- Wrist: the wrist moves toward where the pressing fingers (and the fingers about to press) can reach, joined smoothly so it never jerks. If some moment is out of reach, that moment gets more weight and it is solved again.
- Wrist turn: it also decides how much the hand turns sideways at the wrist (up to 20° toward the thumb and 30° toward the little finger). When the thumb passes under, turning the hand while sliding sideways lets the thumb reach farther.
- Getting ready and relaxing: fingers that are not pressing rest lightly on the keys and move low over their next key. A finger lifts only about one note before it plays, by an amount set by tempo and loudness (slow or soft notes are pressed from the key).
- Fingers: joint angles are worked back from the fingertip target (IK, inverse kinematics). Joints stop at human limits, and the two outer joints bend together.
- Striking a key: the finger keeps its downward speed into the key and stops at the bottom (it does not pause on top of the key). Movements follow a smooth curve where both speed and acceleration start and end at zero (minimum jerk).
- Linked fingers: fingers share tendons and muscles, so when one moves, its neighbors follow a little (the ring finger most, the thumb hardly at all; a rough guide based on research). Fingers held in the air sway slowly and slightly (about 0.5 mm; a rough guide made for this app).
- Raising and lowering the wrist: the default is "the whole arm": chords and notes after a gap are struck by lifting and dropping the arm (under "Strike" you can choose chords and octaves from the wrist, or fingers only). When a free fingertip would sink into the keys (as in thumb-under), the wrist rises. The heights are rough guides made for this app.
- Joint speed: muscles can only move so fast, so finger joints never turn faster than 1500° per second (a rough guide with some margin, based on a measured peak of about 1160°/s at a finger base joint in fast scales by a professional pianist). Skin and flesh of neighboring fingers may press together, but when bones would come too close, a free finger moves aside.
- Out-of-reach notes: if the bone lengths and joint ranges cannot reach a key, the note is not pressed (the key stays up, no sound, and the note shows ✕). Numbers are never adjusted just to make it reach. You can also test "Flexible joints" (a rough guide for a stretched hand). When you open a score, chords too wide for one hand have their inner notes left out and shown as gray notes (sound only).
- Checks: every 1/120 s it measures: too far to reach, joint limits, fingers sinking into each other, fingers sinking into keys, the two hands bumping, and speed.
- Left hand: a mirror image of the right hand. Its fingering uses the right-hand rules on a keyboard flipped around D (so the black keys line up the same way).
- Chords: in notes pressed together, lower notes get lower finger numbers (the other way for the left hand). It picks the order closest to "one finger on each white key", and from chord to chord it keeps the hand's movement small. Before a jump, the note is let go a little early to get there in time (the sound still lasts as long as written).
- Pedal: while the sustain pedal is down, released notes keep sounding until the pedal comes up.
- Fingering check: for pieces with standard textbook fingering (scales, Hanon and so on), it counts how many notes match the chosen fingering.
Skeleton: finger bone and metacarpal lengths are averages from X-rays of 66 adults (Buryanov and Kotiuk 2010). The shapes and positions of the 8 carpal bones, the radius and ulna, and bone thickness are rough guides based on anatomy drawings. Metacarpal width and thickness are CT measurements (50 men), as is the size of the ulnar head. The two forearm bones cross because the palm faces down (pronation; the 150° turn is a rough guide based on the range of motion). The radius bows toward the thumb (a rough guide based on a study), which keeps the bones from colliding where they cross. The shapes and positions of the 8 carpal bones and the thickness of the finger bones are rough guides based on anatomy drawings (the size order of the carpal bones and the scaphoid length of about 22 mm agree with studies).
Muscles, tendons and fat: the main muscles (thenar and hypothenar groups, adductor pollicis, interossei, lumbricals and so on), the finger flexor and extensor tendons, and the fat pads of the finger pads and finger bases are modeled as parts attached to the bones. A part whose two ends sit on different bones stretches or shortens as the joints move, and since muscle keeps its volume, it gets thinner when stretched and thicker when shortened. Positions and thicknesses are rough guides based on anatomy drawings; we have only checked that the flexor tendon thickness (about 3 mm) and the soft tissue over the back of the hand (about 3 mm) are close to values in study abstracts. The model moves with the bones in the same way as the skin, so it stays inside the skin even when the thumb passes under the hand.
Skin shape: fitted around the bones and this model. On the back of the hand it follows the arch of the metacarpals, 3.5 mm above the bone (a rough guide based on a study abstract that measured 3.2 mm of soft tissue there); on the back of the fingers it is 2.5 mm (a rough guide), and the rest of the finger's thickness is tendon and fat on the palm side. The fingertip bone sits just under the nail (about 2 mm of nail bed and nail, from a review of finger ultrasound), so the finger pad is thick. Children's and smaller hands have a little more fat under the skin, with softer knuckles and fewer wrinkles (rough guides). The forearm is 16.8 cm around at the wrist (the U.S. Army survey's male average of 17.6 cm, times 95% for the size of this hand) and 27.5 cm near the elbow (a rough guide). This hand's breadth and circumference are about 95% of the same survey's male averages.
Finger posture: curved, in between and flat change the relaxed finger bend, where the keys are pressed (further in when flatter) and the wrist height (lower when flatter); all are rough guides, and the default is in between. A white key is pressed no further in than where the fingertip pad clears the front of the neighbouring black key. In this model, flatter fingers more often run out of stretch. Knuckle joints spread sideways less when bent (their ligaments tighten), which is why real pianists flatten their fingers for wide stretches, but we found no study measuring how much, so that is not in the model yet.
How relaxed the fingers are: fingers that are not pressing rest lightly on the key surface. A finger is lifted only about one note before it plays, by an amount that depends on the tempo: in slow passages it barely lifts and presses from the key surface, and the faster the music, the more it strikes from above (at 2 notes per second about half of keystrokes start from the key, at 7 or more all are struck; the 12 to 18 mm lift heights are rough guides based on studies). Louder notes are lifted higher and struck from above, softer ones pressed from the key (finger height before a keystroke has been measured to go with loudness; the scaling is a rough guide). Connected (legato) notes are released slowly and the finger stays on the key; detached (staccato) notes are released quickly with a small bounce (rough guides). Dynamics come from MIDI velocity and MusicXML dynamics marks (the built-in pieces have none, so they use mf).
Fixing notes that cannot be reached: the wrist position is a compromise between nearby notes, so sometimes a note that the hand could reach by moving the wrist slightly was missed. When a note is out of reach as it is pressed, we search nearby for a wrist position that reaches every note held at that moment without pushing the free fingers into the keys, and shift the wrist only around that time (not if the wrist would move faster than a person can). Notes still out of reach are shown as notes that could not be played.
Sound: no recordings are used; it is synthesized in the browser. The piano is based on string physics: string stiffness shifts overtones slightly away from whole-number multiples, higher overtones die away faster, some overtones are weakened by where the hammer strikes, and two slightly detuned strings beat against each other. Louder notes are brighter, and the top range has no dampers, so it keeps ringing after release (all numbers are rough guides).
How the hand looks: round cones and plates placed along the bones are blended smoothly, turned into a mesh at start-up, and bent with the joints. Nails, knuckle wrinkles, tendons and veins on the back of the hand, and fine bumps and color changes in the skin are patterns made by calculation (not a scan or photo of a real hand).
Hand size: "Adult (large)" spans about 21 cm from thumb to little finger when fully spread (average for pianists: men 22.6 cm, women 20.1 cm; Boyle et al. 2015).
What is simplified: bone lengths and joint ranges are a rough guide for one adult hand (each hand model only changes the size and finger length). The wrist turns sideways and the palm tilts only a little. Keys tip like a seesaw around a pivot at the back (about 24 cm from the front edge, a rough guide), so they sink deeper toward the front. Key shapes (cut-outs of the white keys, sloped black keys) use rough-guide sizes modeled on real ones.