import Text.XHtml
import Music.Diatonic.Note
import Music.Diatonic.Scale
import Music.Diatonic.Quality
import Music.Diatonic.Key
import Music.Diatonic.Chord
import Music.Diatonic.Degree
import Music.Diatonic.Harmony
import List (intersperse)
import System (getArgs)
import Maybe (fromJust)
import DD.Html
head' k =
header <<
thetitle << ("Diatonic Dashboard: Key of " ++ show k) +++
thelink ! [rel "stylesheet", thetype "text/css", href "dd.css"] << noHtml
chords' k mkh =
table ! [theclass "center", cellspacing 2, cellpadding 4] <<
tr <<
cells
where cells = concatHtml . intersperse sep . map cell $ chordList
sep = td << ("|" +++ br +++ "|")
cell (d, c) = td << (concatHtml . intersperse br $ [displayMusicHTML . showRoman c $ d, linkChord c])
hrm = mkh . scale $ k
chordList = degrees hrm
main = do
args <- getArgs
let k = read (head args) :: Key
putStrLn . renderHtml $
head' k
+++ body ! [theclass "center"]
<< br +++ h2 << ("Diatonic Dashboard: Key of " ++ show k)
+++ "Signature: " +++ (displayMusicHTML . show . signature $ k)
+++ br
+++ "Relative Key: " +++ (linkKey . relative $ k)
+++ br
+++ "Parallel Key: " +++ (linkKey . parallel $ k)
+++ br
+++ br +++ h3 << "\"Circle\" of Fifths"
+++ fifths (Music.Diatonic.Key.center k) (\n -> equivKey . noteMap (\_ -> n) $ k) linkKey
+++ br +++ h3 << "Notes"
+++ displayScales [scale k] 7 Nothing
+++ br +++ h3 << "Chords (Harmony)"
+++ chords' k harmony
+++ br
+++ chords' k harmony7
+++ br +++ br +++ hotlink "index.html" (stringToHtml "[Home]")