1 of 6

# The Note of Destiny - place a note on a staff

The zombie apocalypse has come, and the world is coming to an end. Suddenly, someone discovers a formula that takes the current hour, minute, and day, and spits out the perfect note to play on a piano that instantly kills every zombie that hears it. Unfortunately, there is only one piano player left in the world, and he has forgotten how to read notes, but he still knows how to read sheet music. Of course, this is a very time-sensitive thing, so it seems natural to have a computer do it.1

Your challenge is to take a note, such as G, and output the note placed on a staff, like this:

-----

-----
|
---|-
|
--O--

-----


Specification:

• You must output a staff of alternating lines of ----- (5 dashes) and a blank line. There will be 5 -----s total. The note must be superimposed on top of this staff.
• The input will specify where the note is located. The input will be:
• an optional H or L, specifying "high" or "low"
• a letter from A to G, specifying the pitch
• an optional # or b, specifying sharp or flat.
• The "note" is defined as:
• One O (capital O) aligned to the middle of the staff, which is in the place of the note. (The top line is HF (high F), and the bottom line is E (a normal E).)
• Three |s (vertical bars), the stem, which will be:
• one space to the left of the note and going downwards if the note is on the middle line (B) or above, or
• one space to the right of the note and going upwards if the note is below the middle line.
• A # or b one space directly to the right of the note if specified in the input.
• Ledger lines must be added if the note is too high or low. These lines will be --- (only 3 dashes in width, as opposed to 5) and will only appear if the note is on or above/below (for top/bottom ledger lines respectively) them.

Here is a visualization, to understand the specification more easily, with all the note names next to the lines:

 ---  HC
HB
---  HA
HG
----- HF
HE
----- HD
HC
----- B
A
----- G
F
----- E
D
---  C
LB
---  LA
LG
---  LF
... (bottom cut off for brevity, you get the idea anyway)


Here are some more examples that you can use to test your program:

Input: HG#

  O#
-|---

-|---

-|---

-----

-----


Input: LAb

-----

-----

-----

-----

-----
|
--|
|
-Ob


Input: HB

  O
|--
|
-|---

-----

-----

-----

-----


Input: C

-----

-----

-----

-----
|
---|-
|
-O-


This is , so the shortest code in bytes will win!

1: most realistic exposition evar! :-P