-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Compose music -- -- Compose music @package FComp @version 1.0 -- | Summary: A song combines a melody with chords module HarmTrace.Song data Song Song :: Key -> [(ChordLabel, [MelodyNote])] -> Song data Melody Melody :: Key -> [MelodyNote] -> Melody data MelodyNote MelodyNote :: Root -> Octave -> MelodyNote mnRoot :: MelodyNote -> Root mnOctave :: MelodyNote -> Octave type Octave = Int octaveDown :: MelodyNote -> MelodyNote octaveUp :: MelodyNote -> MelodyNote compareRoot :: Root -> Root -> Ordering allMelodyNotes :: [MelodyNote] roots :: [Root] instance Eq MelodyNote instance Show Melody instance Show Song instance Ord MelodyNote instance Show MelodyNote -- | Summary: Play stuff. Interfaces with Haskore. module HarmTrace.Play songToChords :: Song -> T clToHChord :: ChordLabel -> T songToMelody :: Song -> T mnToHNote :: MelodyNote -> T songToMIDI :: Song -> T writeMIDI :: FilePath -> T -> IO () playMIDI :: T -> IO ExitCode module HarmTrace.Models.Generator class Generate a gen' :: Generate a => FrequencyTable -> Int -> Int -> Maybe (Gen a) class GenerateG a genG :: GenerateG a => FrequencyTable -> Int -> Maybe (Gen a) -- | Generic arbitrary function, sized and with custom constructor -- frequencies. This function does not require any particular nesting -- order of the sums of the generic representation. genGdefault :: (Representable a, Generate (Rep a)) => FrequencyTable -> Int -> Maybe (Gen a) -- | Generic arbitrary function with default sizes and constructor -- frequencies. arbitrary :: (Representable a, Generate (Rep a)) => Gen a data Gen a :: * -> * -- | A frequency table detailing how often certain constructors should be -- picked. The String corresponds to the constructor name. type FrequencyTable = [(String, Int)] frequencies :: [String] -> FrequencyTable -> Int -- | Chooses one of the given generators, with a weighted random -- distribution. The input list must be non-empty. frequency :: [(Int, Gen a)] -> Gen a instance [overlap ok] ConNames (Rec a) instance [overlap ok] ConNames (Var a) instance [overlap ok] ConNames (f :*: g) instance [overlap ok] ConNames U instance [overlap ok] (ConNames a, Constructor k c) => ConNames (CEq k k1 c p q a) instance [overlap ok] (ConNames a, ConNames b) => ConNames (a :+: b) instance [overlap ok] (GenerateG a, GenerateG b) => GenerateG (a, b) instance [overlap ok] GenerateG a => GenerateG [a] instance [overlap ok] GenerateG a => GenerateG (Maybe a) instance [overlap ok] GenerateG a => Generate (Rec a) instance [overlap ok] GenerateG a => Generate (Var a) instance [overlap ok] Generate (CEq k k1 c p q a) instance [overlap ok] Generate a => Generate (CEq k k1 c p p a) instance [overlap ok] (Generate a, Generate b) => Generate (a :*: b) instance [overlap ok] (Generate a, ConNames a, Generate b, ConNames b) => Generate (a :+: b) instance [overlap ok] Generate U -- | Summary: Generic collect module HarmTrace.Models.Collect class CollectG a b collectG :: CollectG a b => a -> [b] -- | default generic parser collectGdefault :: (Representable a, Collect' (Rep a) b) => a -> [b] instance [overlap ok] CollectG a b => CollectG [a] b instance [overlap ok] (Collect' a c, Collect' b c) => Collect' (a :*: b) c instance [overlap ok] (Collect' a c, Collect' b c) => Collect' (a :+: b) c instance [overlap ok] Collect' a b => Collect' (CEq k k1 c p q a) b instance [overlap ok] CollectG a b => Collect' (Var a) b instance [overlap ok] CollectG a b => Collect' (Rec a) b instance [overlap ok] Collect' U b module HarmTrace.HAnTree.Tree data Tree a Node :: !a -> ![Tree a] -> !(Maybe Int) -> Tree a getLabel :: Tree a -> !a getChild :: Tree a -> ![Tree a] getPn :: Tree a -> !(Maybe Int) strTree :: String -> Tree String findClose :: String -> Int findClose' :: String -> Int -> Int -> Int getPns :: [Tree t] -> [Int] getChildPns :: Tree a -> [Int] getSubTree :: Tree t -> Int -> Tree t getLabels :: Tree t -> [t] isLf :: Eq t => Tree t -> Bool collectLeafs :: Tree t -> [Tree t] size :: Tree t -> Int depth :: Tree t -> Int sizeF :: [Tree t] -> Int depthF :: [Tree t] -> Int avgDepth :: Tree t -> Float avgDepthF :: [Tree t] -> Float depth' :: Int -> Tree t -> [Int] remove :: Eq t => t -> Tree t -> Tree t removeBy :: (t -> Bool) -> Tree t -> Tree t removeBy' :: (t -> Bool) -> Tree t -> [Tree t] pot :: Tree t -> [Tree t] potPret :: Tree t -> [Tree t] pret' :: Tree t -> [Tree t] pret :: Tree t -> [Tree t] pot' :: Tree t -> [Tree t] preToPost :: Tree t -> Int -> Int setPost :: Tree t -> Tree t setPre :: Tree t -> Tree t matchToTree :: Tree t -> [Int] -> [Tree t] instance Eq a => Eq (Tree a) instance Binary a => Binary (Tree a) instance NFData a => NFData (Tree a) instance Show a => Show (Tree a) module HarmTrace.Base.Instances instance NFData Mode module HarmTrace.Models.ChordTokens data ChordToken ChordToken :: ScaleDegree -> ClassType -> [ChordLabel] -> ParseStatus -> Int -> Int -> ChordToken root :: ChordToken -> ScaleDegree classType :: ChordToken -> ClassType chords :: ChordToken -> [ChordLabel] status :: ChordToken -> ParseStatus chordNumReps :: ChordToken -> Int dur :: ChordToken -> Int sdToNote :: Key -> ScaleDegree -> Root ctToCL :: Key -> ChordToken -> ChordLabel data PieceToken PieceToken :: Key -> [ChordToken] -> PieceToken data ParseStatus NotParsed :: ParseStatus Parsed :: ParseStatus Deleted :: ParseStatus Inserted :: ParseStatus instance Eq ParseStatus instance Show ParseStatus instance Generic ParseStatus instance Generic ChordToken instance Datatype D1ParseStatus instance Constructor C1_0ParseStatus instance Constructor C1_1ParseStatus instance Constructor C1_2ParseStatus instance Constructor C1_3ParseStatus instance Datatype D1ChordToken instance Constructor C1_0ChordToken instance Selector S1_0_0ChordToken instance Selector S1_0_1ChordToken instance Selector S1_0_2ChordToken instance Selector S1_0_3ChordToken instance Selector S1_0_4ChordToken instance Selector S1_0_5ChordToken instance Binary ParseStatus instance Binary ChordToken instance Show ChordToken instance Eq ChordToken module HarmTrace.HAnTree.HAn data HAn HAn :: !Int -> !String -> HAn HAnFunc :: !HFunc -> HAn HAnPrep :: !Prep -> HAn HAnTrans :: !Trans -> HAn HAnChord :: !ChordToken -> HAn data HFunc Ton :: !Int -> !Mode -> !Int -> !(Maybe Spec) -> HFunc Dom :: !Int -> !Mode -> !Int -> !(Maybe Spec) -> HFunc Sub :: !Int -> !Mode -> !Int -> !(Maybe Spec) -> HFunc P :: HFunc PD :: HFunc PT :: HFunc data Spec Blues :: Spec MinBorrow :: Spec Parallel :: Spec data Prep SecDom :: !Int -> !ScaleDegree -> Prep SecMin :: !Int -> !ScaleDegree -> Prep DiatDom :: !Int -> !ScaleDegree -> Prep NoPrep :: Prep data Trans Trit :: !Int -> !ScaleDegree -> Trans DimTrit :: !Int -> !ScaleDegree -> Trans DimTrans :: !Int -> !ScaleDegree -> Trans NoTrans :: Trans class GetDur a getDur :: GetDur a => a -> Int class SetDur a setDur :: SetDur a => a -> Int -> a instance Eq Spec instance Generic Spec instance Generic HFunc instance Generic Prep instance Generic Trans instance Generic HAn instance Datatype D1Spec instance Constructor C1_0Spec instance Constructor C1_1Spec instance Constructor C1_2Spec instance Datatype D1HFunc instance Constructor C1_0HFunc instance Constructor C1_1HFunc instance Constructor C1_2HFunc instance Constructor C1_3HFunc instance Constructor C1_4HFunc instance Constructor C1_5HFunc instance Datatype D1Prep instance Constructor C1_0Prep instance Constructor C1_1Prep instance Constructor C1_2Prep instance Constructor C1_3Prep instance Datatype D1Trans instance Constructor C1_0Trans instance Constructor C1_1Trans instance Constructor C1_2Trans instance Constructor C1_3Trans instance Datatype D1HAn instance Constructor C1_0HAn instance Constructor C1_1HAn instance Constructor C1_2HAn instance Constructor C1_3HAn instance Constructor C1_4HAn instance Show Spec instance Show HFunc instance Show HAn instance Show Trans instance Show Prep instance Eq Trans instance Eq Prep instance Eq HFunc instance Eq HAn instance SetDur Trans instance SetDur Prep instance SetDur HFunc instance SetDur HAn instance GetDur (Chord a) instance GetDur Trans instance GetDur Prep instance GetDur HFunc instance GetDur HAn instance NFData Spec instance NFData Trans instance NFData Prep instance NFData HFunc instance NFData HAn instance Binary Spec instance Binary HFunc instance Binary Prep instance Binary Trans instance Binary HAn module HarmTrace.HAnTree.HAnParser parseHAn :: ListLike state Char => state -> HAn pHFunc :: Parser HFunc pMode :: Parser Mode pSpec :: Parser Spec pAnyStr :: Parser String module HarmTrace.HAnTree.ToHAnTree class GTree a gTree :: GTree a => a -> [Tree HAn] data HAn HAn :: !Int -> !String -> HAn HAnFunc :: !HFunc -> HAn HAnPrep :: !Prep -> HAn HAnTrans :: !Trans -> HAn HAnChord :: !ChordToken -> HAn gTreeDefault :: (Representable a, GTree (Rep a)) => a -> [Tree HAn] gTreeHead :: GTree a => a -> Tree HAn emptyHAnTree :: Tree HAn instance GTree a => GTree [a] instance GTree a => GTree (Var a) instance GTree a => GTree (Rec a) instance (GTree a, GTree b) => GTree (a :*: b) instance (GTree a, Constructor k c) => GTree (CEq k k1 c p q a) instance (GTree a, GTree b) => GTree (a :+: b) instance GTree U -- | Summary: Semi-generic parser for chords module HarmTrace.Models.Parser class ParseG a parseG :: ParseG a => PMusic a -- | default generic parser parseGdefault :: (Representable a, Parse' (Rep a)) => PMusic a -- | a type synoniome for a harmonic analysis of a piece of music type PMusic a = P (Str ChordToken [ChordToken] Int) a instance [overlap ok] ParseG a => ParseG (Maybe a) instance [overlap ok] ParseG a => ParseG [a] instance [overlap ok] (Parse' f, Parse' g) => Parse' (f :*: g) instance [overlap ok] (Parse' f, Parse' g) => Parse' (f :+: g) instance [overlap ok] Parse' (CEq k k1 c p q f) instance [overlap ok] (Constructor k c, Parse' f) => Parse' (CEq k k1 c p p f) instance [overlap ok] ParseG a => Parse' (Var a) instance [overlap ok] ParseG a => Parse' (Rec a) instance [overlap ok] Parse' U -- | Summary: The Simple model module HarmTrace.Models.Simple.Model data Proxy (t :: k) Proxy :: Proxy data Piece Piece :: [Phrase mode] -> Piece data Phrase (mode :: Mode) P_1451 :: Ton mode -> SDom mode -> Dom mode -> Ton mode -> Phrase mode P_151 :: Ton mode -> Dom mode -> Ton mode -> Phrase mode P_51 :: Dom mode -> Ton mode -> Phrase mode P_15 :: Ton mode -> Dom mode -> Phrase mode P_1 :: Ton mode -> Phrase mode data Ton (mode :: Mode) T_1 :: SD MajMode I MajClass -> Ton MajMode Tm_1 :: SD MinMode I MinClass -> Ton MinMode data Dom (mode :: Mode) D_2 :: SD mode V DomClass -> Dom mode D_1 :: SDom mode -> Dom mode -> Dom mode D_3 :: SD mode V MajClass -> Dom mode D_4 :: SD MajMode VII DimClass -> Dom MajMode D_5 :: SD mode II DomClass -> SD mode V DomClass -> Dom mode Dm_4 :: SD MinMode VII DimClass -> Dom MinMode data SDom (mode :: Mode) S_1 :: SD MajMode IV MajClass -> SDom MajMode S_2 :: SD mode II MinClass -> SDom mode S_3 :: SD MajMode III MinClass -> SD MajMode IV MajClass -> SDom MajMode Sm_1 :: SD MinMode IV MinClass -> SDom MinMode type SD (mode :: Mode) (deg :: DiatonicDegree) (clss :: ClassType) = Surface_Chord deg clss data Surface_Chord (deg :: DiatonicDegree) (clss :: ClassType) Surface_Chord :: ChordToken -> Surface_Chord deg clss class ToClass (clss :: ClassType) toClass :: ToClass clss => Proxy clss -> ClassType class ToDegree (deg :: DiatonicDegree) toDegree :: ToDegree deg => Proxy deg -> ScaleDegree allTypes :: [Name] instance ToDegree 'Imp instance ToDegree 'VII instance ToDegree 'VI instance ToDegree 'V instance ToDegree 'IV instance ToDegree 'III instance ToDegree 'II instance ToDegree 'I instance ToClass 'NoClass instance ToClass 'DimClass instance ToClass 'DomClass instance ToClass 'MinClass instance ToClass 'MajClass -- | Summary: Adhoc instances for the Simple model module HarmTrace.Models.Simple.Instances pChord :: ScaleDegree -> ClassType -> PMusic (Surface_Chord deg clss) genChord :: ScaleDegree -> ClassType -> Maybe (Gen (Surface_Chord deg clss)) data Phrase_P_1451_ data Phrase_P_151_ data Phrase_P_51_ data Phrase_P_15_ data Phrase_P_1_ type RepPhrase_ (mode_am0G :: Mode) = :+: (:+: (CEq Phrase_P_1451_ () () (:*: (:*: (Rec (Ton mode_am0G)) (Rec (SDom mode_am0G))) (:*: (Rec (Dom mode_am0G)) (Rec (Ton mode_am0G))))) (CEq Phrase_P_151_ () () (:*: (Rec (Ton mode_am0G)) (:*: (Rec (Dom mode_am0G)) (Rec (Ton mode_am0G)))))) (:+: (CEq Phrase_P_51_ () () (:*: (Rec (Dom mode_am0G)) (Rec (Ton mode_am0G)))) (:+: (CEq Phrase_P_15_ () () (:*: (Rec (Ton mode_am0G)) (Rec (Dom mode_am0G)))) (CEq Phrase_P_1_ () () (Rec (Ton mode_am0G))))) data Ton_T_1_ data Ton_Tm_1_ type RepTon_ (mode_am0F :: Mode) = :+: (CEq Ton_T_1_ ((,) mode_am0F ()) ((,) MajMode ()) (Rec (SD MajMode I MajClass))) (CEq Ton_Tm_1_ ((,) mode_am0F ()) ((,) MinMode ()) (Rec (SD MinMode I MinClass))) data Dom_D_2_ data Dom_D_1_ data Dom_D_3_ data Dom_D_4_ data Dom_D_5_ data Dom_Dm_4_ type RepDom_ (mode_am0A :: Mode) = :+: (:+: (CEq Dom_D_2_ () () (Rec (SD mode_am0A V DomClass))) (:+: (CEq Dom_D_1_ () () (:*: (Rec (SDom mode_am0A)) (Rec (Dom mode_am0A)))) (CEq Dom_D_3_ () () (Rec (SD mode_am0A V MajClass))))) (:+: (CEq Dom_D_4_ ((,) mode_am0A ()) ((,) MajMode ()) (Rec (SD MajMode VII DimClass))) (:+: (CEq Dom_D_5_ () () (:*: (Rec (SD mode_am0A II DomClass)) (Rec (SD mode_am0A V DomClass)))) (CEq Dom_Dm_4_ ((,) mode_am0A ()) ((,) MinMode ()) (Rec (SD MinMode VII DimClass))))) data SDom_S_1_ data SDom_S_2_ data SDom_S_3_ data SDom_Sm_1_ type RepSDom_ (mode_am0y :: Mode) = :+: (:+: (CEq SDom_S_1_ ((,) mode_am0y ()) ((,) MajMode ()) (Rec (SD MajMode IV MajClass))) (CEq SDom_S_2_ () () (Rec (SD mode_am0y II MinClass)))) (:+: (CEq SDom_S_3_ ((,) mode_am0y ()) ((,) MajMode ()) (:*: (Rec (SD MajMode III MinClass)) (Rec (SD MajMode IV MajClass)))) (CEq SDom_Sm_1_ ((,) mode_am0y ()) ((,) MinMode ()) (Rec (SD MinMode IV MinClass)))) instance [overlap ok] IsLocationUpdatedBy Int ChordToken instance [overlap ok] GTree (SDom mode0) instance [overlap ok] GTree (Dom mode0) instance [overlap ok] GTree (Ton mode0) instance [overlap ok] GTree (Phrase mode0) instance [overlap ok] GenerateG (SD 'MinMode 'IV 'MinClass) => GenerateG (SDom 'MinMode) instance [overlap ok] (GenerateG (SD 'MajMode 'IV 'MajClass), GenerateG (SD 'MajMode 'III 'MinClass)) => GenerateG (SDom 'MajMode) instance [overlap ok] GenerateG (SD 'MinMode 'VII 'DimClass) => GenerateG (Dom 'MinMode) instance [overlap ok] GenerateG (SD 'MajMode 'VII 'DimClass) => GenerateG (Dom 'MajMode) instance [overlap ok] GenerateG (SD 'MinMode 'I 'MinClass) => GenerateG (Ton 'MinMode) instance [overlap ok] GenerateG (SD 'MajMode 'I 'MajClass) => GenerateG (Ton 'MajMode) instance [overlap ok] (GenerateG (Ton mode0), GenerateG (SDom mode0), GenerateG (Dom mode0), GenerateG (Ton mode0), GenerateG (Ton mode0), GenerateG (Dom mode0), GenerateG (Ton mode0), GenerateG (Dom mode0), GenerateG (Ton mode0), GenerateG (Ton mode0), GenerateG (Dom mode0), GenerateG (Ton mode0)) => GenerateG (Phrase mode0) instance [overlap ok] ParseG (SD 'MinMode 'IV 'MinClass) => ParseG (SDom 'MinMode) instance [overlap ok] (ParseG (SD 'MajMode 'IV 'MajClass), ParseG (SD 'MajMode 'III 'MinClass)) => ParseG (SDom 'MajMode) instance [overlap ok] ParseG (SD 'MinMode 'VII 'DimClass) => ParseG (Dom 'MinMode) instance [overlap ok] ParseG (SD 'MajMode 'VII 'DimClass) => ParseG (Dom 'MajMode) instance [overlap ok] ParseG (SD 'MinMode 'I 'MinClass) => ParseG (Ton 'MinMode) instance [overlap ok] ParseG (SD 'MajMode 'I 'MajClass) => ParseG (Ton 'MajMode) instance [overlap ok] (ParseG (Ton mode0), ParseG (SDom mode0), ParseG (Dom mode0), ParseG (Ton mode0), ParseG (Ton mode0), ParseG (Dom mode0), ParseG (Ton mode0), ParseG (Dom mode0), ParseG (Ton mode0), ParseG (Ton mode0), ParseG (Dom mode0), ParseG (Ton mode0)) => ParseG (Phrase mode0) instance [overlap ok] Representable (SDom mode0) instance [overlap ok] Constructor * SDom_Sm_1_ instance [overlap ok] Constructor * SDom_S_3_ instance [overlap ok] Constructor * SDom_S_2_ instance [overlap ok] Constructor * SDom_S_1_ instance [overlap ok] Representable (Dom mode0) instance [overlap ok] Constructor * Dom_Dm_4_ instance [overlap ok] Constructor * Dom_D_5_ instance [overlap ok] Constructor * Dom_D_4_ instance [overlap ok] Constructor * Dom_D_3_ instance [overlap ok] Constructor * Dom_D_1_ instance [overlap ok] Constructor * Dom_D_2_ instance [overlap ok] Representable (Ton mode0) instance [overlap ok] Constructor * Ton_Tm_1_ instance [overlap ok] Constructor * Ton_T_1_ instance [overlap ok] Representable (Phrase mode0) instance [overlap ok] Constructor * Phrase_P_1_ instance [overlap ok] Constructor * Phrase_P_15_ instance [overlap ok] Constructor * Phrase_P_51_ instance [overlap ok] Constructor * Phrase_P_151_ instance [overlap ok] Constructor * Phrase_P_1451_ instance [overlap ok] GTree (Surface_Chord deg clss) instance [overlap ok] GTree Piece instance [overlap ok] (ToDegree deg, ToClass clss) => GenerateG (Surface_Chord deg clss) instance [overlap ok] CollectG (Surface_Chord deg clss) ChordToken instance [overlap ok] CollectG (Dom mode) ChordToken instance [overlap ok] CollectG (SDom mode) ChordToken instance [overlap ok] CollectG (Ton mode) ChordToken instance [overlap ok] CollectG (Phrase mode) ChordToken instance [overlap ok] (ToDegree deg, ToClass clss) => ParseG (Surface_Chord deg clss) -- | Summary: The Simple parser module HarmTrace.Models.Simple.Main pSimple :: Key -> PMusic [Piece] genPiece :: Key -> Gen Piece getChords :: Piece -> [ChordToken] -- | Summary: Generate a melody (accompaniment) for a given harmony module HarmTrace.Accompany map2 :: (b -> c) -> [(a, b)] -> [(a, c)] data MyState MyState :: StdGen -> Key -> Piece -> [ChordToken] -> MyState genState :: MyState -> StdGen keyState :: MyState -> Key pieceState :: MyState -> Piece chordsState :: MyState -> [ChordToken] accompanyIO :: Key -> Piece -> IO Song accompany :: Key -> State MyState Song allPossibleRel :: [ChordToken] -> [(ChordToken, [ScaleDegree])] allPossible :: State MyState [(ChordLabel, [MelodyNote])] notesRootedOn :: ScaleDegree -> ClassType -> [ScaleDegree] refine :: [(ChordLabel, [MelodyNote])] -> State MyState [(ChordLabel, [MelodyNote])] pickBest :: [(ChordLabel, [MelodyNote])] -> State MyState [(ChordLabel, MelodyNote)] embellish :: [(ChordLabel, MelodyNote)] -> State MyState [(ChordLabel, [MelodyNote])] connectNotes :: StdGen -> Key -> ChordLabel -> MelodyNote -> MelodyNote -> [MelodyNote] toRootM :: Int -> Root notesInKey :: Key -> [MelodyNote] notesInChord :: ChordLabel -> [MelodyNote]