# Matches an ANSI VT520 Note \e # An Escape \[ # Followed by a bracket (?> (?(?0) # 0 is no volume | (?[1-3]) # 1-3 is low volume | (?[4-7]) # 4-7 is high volume ))\; # A semicolon separated the volume from the duration # Duration is measured in 1/32 of a second (?\d+)\; # A semicolon separates the duration from the note # One or more notes will follow (?(?:(?> (?25) # 25 is C in the 7th octave (MIDI 96) | (?24) # 24 is B in the 6th octave (MIDI 95) | (?23) # 23 is A Sharp in the 6th octave (MIDI 94) | (?22) # 22 is A in the 6th octave (MIDI 93) | (?21) # 21 is G Sharp in the 6th octave (MIDI 92) | (?20) # 20 is G in the 6th octave (MIDI 91) | (?19) # 19 is F Sharp in the 6th octave (MIDI 90) | (?18) # 18 is F in the 6th octave (MIDI 89) | (?17) # 17 is E in the 6th octave (MIDI 88) | (?16) # 16 is D Sharp in the 6th octave (MIDI 87) | (?15) # 15 is D in the 6th octave (MIDI 86) | (?14) # 14 is C Sharp in the 6th octave (MIDI 85) | (?13) # 13 is C in the 6th octave (MIDI 84) | (?12) # 12 is B in the 5th octave (MIDI 83) | (?11) # 11 is A Sharp in the 5th octave (MIDI 82) | (?10) # 10 is A in the 5th octave (MIDI 81) | (?9) # 9 is G Sharp in the 5th octave (MIDI 80) | (?8) # 8 is G in the 5th octave (MIDI 79) | (?7) # 7 is F Sharp in the 5th octave (MIDI 78) | (?6) # 6 is F in the 5th octave (MIDI 77) | (?5) # 5 is E in the 5th octave (MIDI 76) | (?4) # 4 is D Sharp in the 5th octave (MIDI 75) | (?3) # 3 is D in the 5th octave (MIDI 74) | (?2) # 2 is C Sharp in the 5th octave (MIDI 73) | (?1) # 1 is C in the 5th octave (MIDI 72) | (?0) # 0 is a rest )\;?){0,}),~ # A command and a tilda end the sequence