Music: what's in this chord? Input

The symbol of any triadic chord (see http://en.wikipedia.org/wiki/Chord_(music)#Triads).

Output

The notes constituting the given chord.

Examples

Input: AM
Output: A C# E

Input: C#m
Output: C# E G#

Input: Db+
Output: C# F A

Input: C0
Output: C D# F#

Bonuses

-50 if you can also deal with seventh chords

-150 for actually playing the sound of the chord

-150 for using printable characters to show how to play the chord on a piano; example for AM:

┌─┬─┬┬─┬─┬─┬─┬┬─┲┱─┬─┬─┲━┱┬─┲━┱─┬─┬┬─┬┬─┬─┐
│ │ ││ │ │ │ ││ ┃┃ │ │ ┃ ┃│ ┃ ┃ │ ││ ││ │ │
│ │ ││ │ │ │ ││ ┃┃ │ │ ┃ ┃│ ┃ ┃ │ ││ ││ │ │
│ │ ││ │ │ │ ││ ┃┃ │ │ ┃ ┃│ ┃ ┃ │ ││ ││ │ │
│ └┬┘└┬┘ │ └┬┘└┲┛┗┱┘ │ ┗┯┛└┲┛ ┃ └┬┘└┬┘└┬┘ │
│  │  │  │  │  ┃  ┃  │  │  ┃  ┃  │  │  │  │
└──┴──┴──┴──┴──┺━━┹──┴──┴──┺━━┹──┴──┴──┴──┘


-100 for using printable characters to show how to play the chord on a guitar; example for AM:

x   o   o   o   o   o
┌───┬───┬───┬───┬───┐
│   │   │   │   │   │
├───┼───┼───┼───┼───┤
│   │   │   │   │   │
├───┼───┼───┼───┼───┤
│   │   █   █   █   │
├───┼───┼───┼───┼───┤
│   │   │   │   │   │


(see https://en.wikipedia.org/wiki/Box-drawing_character)

Rules


The result must be a command-line program or script.
The input and output can be in any form, as long as it follows a music notation standard.
A guitar or piano representation is considered valid if and only if it contains the three (triadic) or four (seventh) required notes and nothing else. The same note can be present several times in the chord.
External libraries are not allowed, except for sound generation (in which case the #include, import... directives are not added to the character count).
This is code golf, the shortest code wins!


A little bit of music theory...

In modern Western tonal music, every octave is made of twelve successive notes, often noted:

A A# B C C# D D# E F F# G G#

Or:

La La# Si Do Do# Re Re# Mi Fa Fa# Sol Sol#

In this system, we consider that two successive notes (e.g. A and A#, or E and F) are separated by one semitone. Also, the notes are kind of "looping": what immediately follows G# is A.



A chord is constituted by a few (2, 3, 4, sometimes more) notes that "sound good together". For instance, triadic chords contain three different notes, and seventh chords contain four different notes.

Let's define the four triadic chords as:


Major triad: contains the root of the chord (in this question, the note given as input), the major third for the root (4 semitones higher than the root), and the perfect fifth for the root (7 semitones higher than the root); this can be symbolized 0-4-7
Minor triad, symbolized 0-3-7
Augmented triad, symbolized 0-4-8
Diminished triad, symbolized 0-3-6




So for example, if you want to make a C major triad, noted C, CM, Cmaj, you will need three noted:


0: the root, in this case a C
4: the minor third, 4 semitones higher than the root; that's an E
7: the perfect fifth, 7 semitones higher than the root: a G


This is what the 0-4-7, 0-3-7, 0-4-8 and 0-3-6 notations used above mean! For the seventh chords, use the following pattern:



That's it for today! Now, amaze me with amazing code... If you have any question, add some comments below.
As you can tell, I didn't try to golf this at all. I'm a music geek, and a pet peeve of mine is when people write things using the wrong enharmonics (e.g. saying that a C diminished chord is C D# F# instead of C Eb Gb), so I wrote this program that gets the enharmonics right. It does so by representing each note as the number of perfect fifths above F.

For what it's worth, if you want to distinguish enharmonics, any musical interval can be represented nicely in a computer program as a number of perfect fifths and a number of octaves. An augmented fourth, for example, is 6 perfect fifths and -3 octaves, and a diminished fifth is -6 perfect fifths and 4 octaves.

Haskell, 441 characters

import Data.List

notes = "FCGDAEB"

fromNum x = [notes !! (mod x 7)] ++ if x &lt; 0 then replicate (-(div x 7)) 'b' else replicate (div x 7) '#'

toNum (x:xs) = y + 7 * if isPrefixOf "b" xs then -length xs else length xs
    where Just y = elemIndex x notes

chord xs = unwords . map (fromNum . \x -&gt; toNum (init xs) + x) $ case last xs of 'A' -&gt; [0,4,8]; 'M' -&gt; [0,4,1]; 'm' -&gt; [0,-3,1]; 'd' -&gt; [0,-3,-6]

main = getLine &gt;&gt;= putStrLn . chord


Some example invocations:

jaspers:junk tswett$ ./chord
AM
A C# E
jaspers:junk tswett$ ./chord
C#m
C# E G#
jaspers:junk tswett$ ./chord
DbA
Db F A
jaspers:junk tswett$ ./chord
Cd
C Eb Gb
jaspers:junk tswett$ ./chord
A#M
A# C## E#
jaspers:junk tswett$ ./chord
Dbm
Db Fb Ab