Foam piano

This demo shows the FoamTree API elements you will likely need to use when building an interactive visualization or application. It also shows how to integrate other Web APIs into your FoamTree visualizations.

How this demo works

Each of the twelve notes of the scale is a cell, split into its octaves, from the low C2 to B6. The cells light up with the sound, and the cell in the middle names the chord: play with the mouse or the keyboard, listen to a Bach prelude, play an audio file or sing into the microphone.

Click a note to play it, or a note's name to play its major chord. The computer keyboard plays the notes from C4 to E5; Z and X shift them down and up.

WETYUOP
ASDFGHJKL;

Why does one note light up several cells? A real note also sounds its overtones: the octave above it, the fifth above that, two octaves up, and so on.

What's in the code?