module Billboard.Annotation (
Annotation (..)
, Label (..)
, Instrument (..)
, Description (..)
, isStruct
, isStart
, isUnknown
, isRepeat
, isEndAnno
, isFirstChord
, isLastChord
, getRepeats
, getLabel
) where
import HarmTrace.Base.MusicRep (Root)
data Annotation = Start Label | End Label deriving Eq
instance Show Annotation where
show (Start l) = '<' : show l
show (End l) = show l ++ ">"
data Label = Struct Char Int
| Instr Instrument
| Anno Description
| Modulation Root
deriving Eq
instance Show Label where
show (Instr lab) = show lab
show (Anno lab) = show lab
show (Modulation lab) = show lab
show (Struct c i) = c : replicate i '\''
data Instrument = Guitar | Voice | Violin | Banjo | Synthesizer | Saxophone
| Flute | Drums | Trumpet | Piano | Harmonica | Organ
| Keyboard | Trombone | Electricsitar | Pennywhistle
| Tenorsaxophone | Whistle | Oboe | Tambura | Horns | Clarinet
| Electricguitar | Tenorhorn | Percussion | Rhythmguitar
| Hammondorgan | Harpsichord | Cello | Acousticguitar
| Bassguitar | Strings | SteelDrum | Vibraphone | Bongos
| Steelguitar | Horn | Sitar | Barisaxophone | Accordion
| Tambourine | Kazoo
| UnknownInstr String
deriving (Show, Eq)
data Description = Chorus | Intro | Outro | Bridge | Interlude | Solo
| Fadeout | Fadein | Prechorus | Maintheme | Keychange
| Secondarytheme | Ending | PhraseTrans | Instrumental
| Coda | Transition | PreVerse | Vocal | Talking
| TalkingEnd | Silence | Applause | Noise | SongEnd
| ModulationSeg | PreIntro | Chords
| Repeat Int
| Verse (Maybe Int)
| InterpolationInsert
| UnknownAnno String
deriving (Show, Eq)
getLabel :: Annotation -> Label
getLabel (Start l) = l
getLabel (End l) = l
isStart :: Annotation -> Bool
isStart (Start _) = True
isStart (End _) = False
isStruct :: Label -> Bool
isStruct (Struct _ _) = True
isStruct _ = False
isUnknown :: Annotation -> Bool
isUnknown s = case (getLabel s) of
(Instr (UnknownInstr _ )) -> True
(Anno (UnknownAnno _ )) -> True
_ -> False
isEndAnno :: Annotation -> Bool
isEndAnno (End (Anno SongEnd)) = True
isEndAnno _ = False
isRepeat :: Annotation -> Bool
isRepeat (End (Anno (Repeat _))) = True
isRepeat _ = False
isFirstChord :: Annotation -> Bool
isFirstChord (Start (Anno Chords)) = True
isFirstChord _ = False
isLastChord :: Annotation -> Bool
isLastChord (End (Anno Chords)) = True
isLastChord _ = False
getRepeats :: Annotation -> Int
getRepeats (End (Anno (Repeat r))) = r
getRepeats _ = 1