Controlling of the pitch range in a score

Here is a set of 4 functions to check or modify the pitch range in a piece of music.
  \correctOctave
  \correctOctaveOutOfRange
  \colorizeOutOfRange
  \parenthesizeOutOfRange

Here is the code of each Staff.

  \music                                 % staff 1
  \correctOctave #'above g'' \music      % staff 2
  \correctOctave #'below g' \music       % staff 3
  \correctOctaveOutOfRange g' g'' \music % staff 4
  \colorizeOutOfRange g' g'' \music      % staff 5
  \parenthesizeOutOfRange g' g'' \music  % staff 6