PencilCode/jquery-turtle — pull request #58 by davidbau (2014-04-28 23:00:02+00:00)
Title: Add a hook to the 'play' function to allow visualizations.

This hook is designed to allow for visualizations of the "play" command. It generates a callback for every note (or chord) that is played, at the moment that it starts.

The callback receives an object similar to this:

{
pitch: ["^c'"]
duration: "/2"
frequency: [523.2511306011972]
time: 1
start_at: 1.261609977324263
end_at: 1.761609977324263
voice: 0
}

Here:
- pitch is an array of strings, each with the ABC notation for a single pitch (here an octave above a semitone above the high c).
- duration is the ABC notation for the duration (here a half-duration note. for the default duration, this could be empty).
- frequency is an array of Hz frequencies corresponding to the pitches.
- time is the duration translated to a decimal number.
- start_at is the absolute (audiocontext) time when the note starts.
- end_at is when it ends.
- voice is normally zero, but it can be larger if there are several voices played at once.