module MyDgf where

import Haskore
import HaskToMidi
import TestHaskore
import System

♩ = qn
♪ = en


dgf :: [[NoteAttribute] -> Music]
dgf =
-- line 1
 [g 4 ♪, g 4 ♪, c 5 ♩, c 5 ♩, e 5 ♪, c 5 ♪, g 4 hn ] ++
 [g 4 ♩, f 4 ♩, d 4 ♩, g 4 ♩, e 4 ♩, c 4 ♩ ] ++
-- line 2
 [g 4 ♩, c 5 ♩, c 5 ♩, e 5 ♪, c 5 ♪, g 4 hn ] ++
 [g 4 ♩, f 4 ♩, d 4 ♩, g 4 ♩, e 4 ♩, c 4 ♩ ] ++
-- line 3
 [c 5 ♩, b 4 ♩, d 5 ♩, b 4 ♩, c 5 ♩, e 5 ♩ ] ++
 [c 5 ♩, b 4 ♩, d 5 ♩, b 4 ♩, c 5 ♩, e 5 ♩ ] ++
-- line 4
 [c 5 ♩, a 4 ♩, a 4 ♩, c 5 ♪, a 4 ♪, g 4 hn ] ++
 [g 4 ♪, e 5 ♪, e 5 ♪, d 5 ♪, c 5 ♩, b 4 ♩, c 5 hn ]

-- Volume + Tempo
dgfVT = Tempo 2 $ line ( map (\n -> n [Volume 100]) dgf )

testPlay :: String -> Music -> IO ()
testPlay cmd m = do
                    outputMidiFile "dgf.mid" (testMidi m)
                    system cmd
                    return ()

myTestLinux :: Music -> IO ()
myTestLinux = testPlay "wildmidi dgf.mid"

play :: Music -> IO ()
play music = myTestLinux music

