Extracting notes inside chords into separate staves

This snippet create a new function to allow the transformation of a polyphonic instrument into several monaural instruments.

The syntax of this function is:

\extractNote #position music

In, for example, <c e g> , c is in position 1, e in position 2, and g in 3.

In the example below, the first staff is the original music, and the three others have been made with:

\extractNote #3 \music
\extractNote #2 \music
\extractNote #1 \music