| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
PVGrammar
Description
This module contains common datatypes and functions specific to the protovoice grammar. In a protovoice derivations, slices are multisets of notes while transitions contain connections between these notes.
Code that is specific to parsing can be found in PVGrammar.Parse, while generative code is located in PVGrammar.Generate.
Synopsis
- data Note n = Note {}
- newtype Notes n = Notes (HashSet (Note n))
- innerNotes :: StartStop (Notes n) -> [StartStop (Note n)]
- data Edges n = Edges {}
- topEdges :: Hashable n => Edges n
- type Edge n = (StartStop (Note n), StartStop (Note n))
- type InnerEdge n = (Note n, Note n)
- newtype Freeze n = FreezeOp {
- freezeTies :: HashSet (Edge n)
- data Split n = SplitOp {
- splitReg :: !(Map (Edge n) [(Note n, DoubleOrnament)])
- splitPass :: !(Map (InnerEdge n) [(Note n, PassingOrnament)])
- fromLeft :: !(Map (Note n) [(Note n, RightOrnament)])
- fromRight :: !(Map (Note n) [(Note n, LeftOrnament)])
- keepLeft :: !(HashSet (Edge n))
- keepRight :: !(HashSet (Edge n))
- passLeft :: !(MultiSet (InnerEdge n))
- passRight :: !(MultiSet (InnerEdge n))
- data DoubleOrnament
- isRepetitionOnLeft :: DoubleOrnament -> Bool
- isRepetitionOnRight :: DoubleOrnament -> Bool
- data PassingOrnament
- data LeftOrnament
- data RightOrnament
- data Spread n = SpreadOp !(HashMap (Note n) (SpreadChildren n)) !(Edges n)
- data SpreadChildren n
- = SpreadLeftChild !(Note n)
- | SpreadRightChild !(Note n)
- | SpreadBothChildren !(Note n) !(Note n)
- leftSpreadChild :: SpreadChildren n -> Maybe (Note n)
- rightSpreadChild :: SpreadChildren n -> Maybe (Note n)
- type PVLeftmost n = Leftmost (Split n) (Freeze n) (Spread n)
- type PVAnalysis n = Analysis (Split n) (Freeze n) (Spread n) (Edges n) (Notes n)
- analysisTraversePitch :: (Applicative f, Eq n', Hashable n', Ord n') => (n -> f n') -> PVAnalysis n -> f (PVAnalysis n')
- analysisMapPitch :: (Eq n', Hashable n', Ord n') => (n -> n') -> PVAnalysis n -> PVAnalysis n'
- loadAnalysis :: FilePath -> IO (Either String (PVAnalysis SPitch))
- loadAnalysis' :: FilePath -> IO (Either String (PVAnalysis SPC))
- slicesFromFile :: FilePath -> IO [[(Note SPitch, RightTied)]]
- slicesToPath :: (Interval i, Ord i, Eq i) => [[(Note (Pitch i), RightTied)]] -> Path [Note (Pitch i)] [Edge (Pitch i)]
- loadSurface :: FilePath -> IO (Path [Note SPitch] [Edge SPitch])
- loadSurface' :: FilePath -> Int -> Int -> IO (Path [Note SPitch] [Edge SPitch])
Inner Structure Types
Note: a pitch with an ID.
A note with a pitch and an ID.
Instances
| Functor Note Source # | |||||
| Foldable Note Source # | |||||
Defined in PVGrammar Methods fold :: Monoid m => Note m -> m # foldMap :: Monoid m => (a -> m) -> Note a -> m # foldMap' :: Monoid m => (a -> m) -> Note a -> m # foldr :: (a -> b -> b) -> b -> Note a -> b # foldr' :: (a -> b -> b) -> b -> Note a -> b # foldl :: (b -> a -> b) -> b -> Note a -> b # foldl' :: (b -> a -> b) -> b -> Note a -> b # foldr1 :: (a -> a -> a) -> Note a -> a # foldl1 :: (a -> a -> a) -> Note a -> a # elem :: Eq a => a -> Note a -> Bool # maximum :: Ord a => Note a -> a # | |||||
| Traversable Note Source # | |||||
| Notation n => FromJSON (Note n) Source # | |||||
| Notation n => ToJSON (Note n) Source # | |||||
| NFData n => NFData (Note n) Source # | |||||
| Notation n => IsString (Note n) Source # | Lets you write a Note as a string literal with OverloadedStrings.
Pitch and ID are separate by a | ||||
Defined in PVGrammar Methods fromString :: String -> Note n # | |||||
| Generic (Note n) Source # | |||||
Defined in PVGrammar Associated Types
| |||||
| Notation n => Show (Note n) Source # | |||||
| Eq n => Eq (Note n) Source # | |||||
| Ord n => Ord (Note n) Source # | |||||
| Hashable n => Hashable (Note n) Source # | |||||
| type Rep (Note n) Source # | |||||
Defined in PVGrammar type Rep (Note n) = D1 ('MetaData "Note" "PVGrammar" "protovoices-0.1.0.0-BDEUxFN8Fm0COc6pAhx3U0" 'False) (C1 ('MetaCons "Note" 'PrefixI 'True) (S1 ('MetaSel ('Just "notePitch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 n) :*: S1 ('MetaSel ('Just "noteId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))) | |||||
Slices: Notes
The content type of slices in the protovoice model. Contains a set of notes (pitch x id), representing the notes in a slice.
Instances
| (Notation n, Eq n, Hashable n) => FromJSON (Notes n) Source # | |
| Notation n => ToJSON (Notes n) Source # | |
| NFData n => NFData (Notes n) Source # | |
| Generic (Notes n) Source # | |
| Notation n => Show (Notes n) Source # | |
| Eq n => Eq (Notes n) Source # | |
| Ord n => Ord (Notes n) Source # | |
| Hashable n => Hashable (Notes n) Source # | |
| type Rep (Notes n) Source # | |
innerNotes :: StartStop (Notes n) -> [StartStop (Note n)] Source #
Return the notes or start/stop symbols inside a slice.
This is useful to get all objects that an Edge can connect to.
Transitions: Sets of Obligatory Edges
Transitions contain two kinds of edges, regular edges and passing edges.
The content type of transitions in the protovoice model. Contains a multiset of regular edges and a multiset of passing edges. The represented edges are those that are definitely used later on. Edges that are not used are dropped before creating a child transition. A transition that contains passing edges cannot be frozen.
Constructors
| Edges | |
Instances
type Edge n = (StartStop (Note n), StartStop (Note n)) Source #
A proto-voice edge between two nodes (i.e. notes or start/stop symbols).
type InnerEdge n = (Note n, Note n) Source #
A proto-voice edge between two notes (excluding start/stop symbols).
Generative Operations
Freeze
Represents a freeze operation. Since this just ties all remaining edges (which must all be repetitions) no decisions have to be encoded.
Constructors
| FreezeOp | |
Fields
| |
Instances
| (Notation n, Hashable n) => FromJSON (Freeze n) Source # | |
| Notation n => ToJSON (Freeze n) Source # | |
| NFData n => NFData (Freeze n) Source # | |
| Generic (Freeze n) Source # | |
| Notation n => Show (Freeze n) Source # | |
| Eq n => Eq (Freeze n) Source # | |
| Ord n => Ord (Freeze n) Source # | |
Defined in PVGrammar | |
| type Rep (Freeze n) Source # | |
Split
Encodes the decisions made in a split operation. Contains a list of elaborations for every parent edge and note. Each elaboration contains the child pitch, and the corresponding ornament. For every produced edge, a decisions is made whether to keep it or not.
Constructors
| SplitOp | |
Fields
| |
Instances
| (Notation n, Ord n, Hashable n) => FromJSON (Split n) Source # | |||||
| Notation n => ToJSON (Split n) Source # | |||||
| NFData n => NFData (Split n) Source # | |||||
| (Ord n, Hashable n) => Monoid (Split n) Source # | |||||
| (Ord n, Hashable n) => Semigroup (Split n) Source # | |||||
| Generic (Split n) Source # | |||||
Defined in PVGrammar Associated Types
| |||||
| Notation n => Show (Split n) Source # | |||||
| Eq n => Eq (Split n) Source # | |||||
| Ord n => Ord (Split n) Source # | |||||
| type Rep (Split n) Source # | |||||
Defined in PVGrammar type Rep (Split n) = D1 ('MetaData "Split" "PVGrammar" "protovoices-0.1.0.0-BDEUxFN8Fm0COc6pAhx3U0" 'False) (C1 ('MetaCons "SplitOp" 'PrefixI 'True) (((S1 ('MetaSel ('Just "splitReg") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (Edge n) [(Note n, DoubleOrnament)])) :*: S1 ('MetaSel ('Just "splitPass") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (InnerEdge n) [(Note n, PassingOrnament)]))) :*: (S1 ('MetaSel ('Just "fromLeft") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (Note n) [(Note n, RightOrnament)])) :*: S1 ('MetaSel ('Just "fromRight") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (Note n) [(Note n, LeftOrnament)])))) :*: ((S1 ('MetaSel ('Just "keepLeft") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (HashSet (Edge n))) :*: S1 ('MetaSel ('Just "keepRight") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (HashSet (Edge n)))) :*: (S1 ('MetaSel ('Just "passLeft") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (MultiSet (InnerEdge n))) :*: S1 ('MetaSel ('Just "passRight") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (MultiSet (InnerEdge n))))))) | |||||
data DoubleOrnament Source #
Two-sided ornament types (two parents).
Constructors
| FullNeighbor | a full neighbor note |
| FullRepeat | a repetition of both parents (which have the same pitch) |
| LeftRepeatOfRight | a repetition of the right parent |
| RightRepeatOfLeft | a repetitions of the left parent |
| RootNote | a note inserted at the top of the piece (between ⋊ and ⋉) |
Instances
| FromJSON DoubleOrnament Source # | |||||
Defined in PVGrammar Methods parseJSON :: Value -> Parser DoubleOrnament # parseJSONList :: Value -> Parser [DoubleOrnament] # | |||||
| ToJSON DoubleOrnament Source # | |||||
Defined in PVGrammar Methods toJSON :: DoubleOrnament -> Value # toEncoding :: DoubleOrnament -> Encoding # toJSONList :: [DoubleOrnament] -> Value # toEncodingList :: [DoubleOrnament] -> Encoding # omitField :: DoubleOrnament -> Bool # | |||||
| NFData DoubleOrnament Source # | |||||
Defined in PVGrammar Methods rnf :: DoubleOrnament -> () # | |||||
| Generic DoubleOrnament Source # | |||||
Defined in PVGrammar Associated Types
Methods from :: DoubleOrnament -> Rep DoubleOrnament x # to :: Rep DoubleOrnament x -> DoubleOrnament # | |||||
| Show DoubleOrnament Source # | |||||
Defined in PVGrammar Methods showsPrec :: Int -> DoubleOrnament -> ShowS # show :: DoubleOrnament -> String # showList :: [DoubleOrnament] -> ShowS # | |||||
| Eq DoubleOrnament Source # | |||||
Defined in PVGrammar Methods (==) :: DoubleOrnament -> DoubleOrnament -> Bool # (/=) :: DoubleOrnament -> DoubleOrnament -> Bool # | |||||
| Ord DoubleOrnament Source # | |||||
Defined in PVGrammar Methods compare :: DoubleOrnament -> DoubleOrnament -> Ordering # (<) :: DoubleOrnament -> DoubleOrnament -> Bool # (<=) :: DoubleOrnament -> DoubleOrnament -> Bool # (>) :: DoubleOrnament -> DoubleOrnament -> Bool # (>=) :: DoubleOrnament -> DoubleOrnament -> Bool # max :: DoubleOrnament -> DoubleOrnament -> DoubleOrnament # min :: DoubleOrnament -> DoubleOrnament -> DoubleOrnament # | |||||
| type Rep DoubleOrnament Source # | |||||
Defined in PVGrammar type Rep DoubleOrnament = D1 ('MetaData "DoubleOrnament" "PVGrammar" "protovoices-0.1.0.0-BDEUxFN8Fm0COc6pAhx3U0" 'False) ((C1 ('MetaCons "FullNeighbor" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FullRepeat" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "LeftRepeatOfRight" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "RightRepeatOfLeft" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RootNote" 'PrefixI 'False) (U1 :: Type -> Type)))) | |||||
isRepetitionOnLeft :: DoubleOrnament -> Bool Source #
Returns True if the child repeats the left parent
isRepetitionOnRight :: DoubleOrnament -> Bool Source #
Returns True if the child repeats the right parent
data PassingOrnament Source #
Types of passing notes (two parents).
Constructors
| PassingMid | a connecting passing note (step to both parents) |
| PassingLeft | a step from the left parent |
| PassingRight | a step from the right parent |
Instances
| FromJSON PassingOrnament Source # | |||||
Defined in PVGrammar Methods parseJSON :: Value -> Parser PassingOrnament # parseJSONList :: Value -> Parser [PassingOrnament] # | |||||
| ToJSON PassingOrnament Source # | |||||
Defined in PVGrammar Methods toJSON :: PassingOrnament -> Value # toEncoding :: PassingOrnament -> Encoding # toJSONList :: [PassingOrnament] -> Value # toEncodingList :: [PassingOrnament] -> Encoding # omitField :: PassingOrnament -> Bool # | |||||
| NFData PassingOrnament Source # | |||||
Defined in PVGrammar Methods rnf :: PassingOrnament -> () # | |||||
| Generic PassingOrnament Source # | |||||
Defined in PVGrammar Associated Types
Methods from :: PassingOrnament -> Rep PassingOrnament x # to :: Rep PassingOrnament x -> PassingOrnament # | |||||
| Show PassingOrnament Source # | |||||
Defined in PVGrammar Methods showsPrec :: Int -> PassingOrnament -> ShowS # show :: PassingOrnament -> String # showList :: [PassingOrnament] -> ShowS # | |||||
| Eq PassingOrnament Source # | |||||
Defined in PVGrammar Methods (==) :: PassingOrnament -> PassingOrnament -> Bool # (/=) :: PassingOrnament -> PassingOrnament -> Bool # | |||||
| Ord PassingOrnament Source # | |||||
Defined in PVGrammar Methods compare :: PassingOrnament -> PassingOrnament -> Ordering # (<) :: PassingOrnament -> PassingOrnament -> Bool # (<=) :: PassingOrnament -> PassingOrnament -> Bool # (>) :: PassingOrnament -> PassingOrnament -> Bool # (>=) :: PassingOrnament -> PassingOrnament -> Bool # max :: PassingOrnament -> PassingOrnament -> PassingOrnament # min :: PassingOrnament -> PassingOrnament -> PassingOrnament # | |||||
| type Rep PassingOrnament Source # | |||||
Defined in PVGrammar type Rep PassingOrnament = D1 ('MetaData "PassingOrnament" "PVGrammar" "protovoices-0.1.0.0-BDEUxFN8Fm0COc6pAhx3U0" 'False) (C1 ('MetaCons "PassingMid" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PassingLeft" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PassingRight" 'PrefixI 'False) (U1 :: Type -> Type))) | |||||
data LeftOrnament Source #
Types of single-sided ornaments left of the parent (child-parent)
[ ] [p]
/
[c]Constructors
| LeftNeighbor | an incomplete left neighbor |
| LeftRepeat | an incomplete left repetition |
Instances
| FromJSON LeftOrnament Source # | |||||
Defined in PVGrammar | |||||
| ToJSON LeftOrnament Source # | |||||
Defined in PVGrammar Methods toJSON :: LeftOrnament -> Value # toEncoding :: LeftOrnament -> Encoding # toJSONList :: [LeftOrnament] -> Value # toEncodingList :: [LeftOrnament] -> Encoding # omitField :: LeftOrnament -> Bool # | |||||
| NFData LeftOrnament Source # | |||||
Defined in PVGrammar Methods rnf :: LeftOrnament -> () # | |||||
| Generic LeftOrnament Source # | |||||
Defined in PVGrammar Associated Types
| |||||
| Show LeftOrnament Source # | |||||
Defined in PVGrammar Methods showsPrec :: Int -> LeftOrnament -> ShowS # show :: LeftOrnament -> String # showList :: [LeftOrnament] -> ShowS # | |||||
| Eq LeftOrnament Source # | |||||
Defined in PVGrammar | |||||
| Ord LeftOrnament Source # | |||||
Defined in PVGrammar Methods compare :: LeftOrnament -> LeftOrnament -> Ordering # (<) :: LeftOrnament -> LeftOrnament -> Bool # (<=) :: LeftOrnament -> LeftOrnament -> Bool # (>) :: LeftOrnament -> LeftOrnament -> Bool # (>=) :: LeftOrnament -> LeftOrnament -> Bool # max :: LeftOrnament -> LeftOrnament -> LeftOrnament # min :: LeftOrnament -> LeftOrnament -> LeftOrnament # | |||||
| type Rep LeftOrnament Source # | |||||
data RightOrnament Source #
Types of single-sided ornaments right of the parent (parent--child).
[p] [ ] \ [c]
Constructors
| RightNeighbor | an incomplete right neighbor |
| RightRepeat | an incomplete right repetition |
Instances
| FromJSON RightOrnament Source # | |||||
Defined in PVGrammar Methods parseJSON :: Value -> Parser RightOrnament # parseJSONList :: Value -> Parser [RightOrnament] # | |||||
| ToJSON RightOrnament Source # | |||||
Defined in PVGrammar Methods toJSON :: RightOrnament -> Value # toEncoding :: RightOrnament -> Encoding # toJSONList :: [RightOrnament] -> Value # toEncodingList :: [RightOrnament] -> Encoding # omitField :: RightOrnament -> Bool # | |||||
| NFData RightOrnament Source # | |||||
Defined in PVGrammar Methods rnf :: RightOrnament -> () # | |||||
| Generic RightOrnament Source # | |||||
Defined in PVGrammar Associated Types
| |||||
| Show RightOrnament Source # | |||||
Defined in PVGrammar Methods showsPrec :: Int -> RightOrnament -> ShowS # show :: RightOrnament -> String # showList :: [RightOrnament] -> ShowS # | |||||
| Eq RightOrnament Source # | |||||
Defined in PVGrammar Methods (==) :: RightOrnament -> RightOrnament -> Bool # (/=) :: RightOrnament -> RightOrnament -> Bool # | |||||
| Ord RightOrnament Source # | |||||
Defined in PVGrammar Methods compare :: RightOrnament -> RightOrnament -> Ordering # (<) :: RightOrnament -> RightOrnament -> Bool # (<=) :: RightOrnament -> RightOrnament -> Bool # (>) :: RightOrnament -> RightOrnament -> Bool # (>=) :: RightOrnament -> RightOrnament -> Bool # max :: RightOrnament -> RightOrnament -> RightOrnament # min :: RightOrnament -> RightOrnament -> RightOrnament # | |||||
| type Rep RightOrnament Source # | |||||
Spread
Represents a spread operation.
Records for every pitch how it is distributed (see SpreadDirection).
The resulting edges (repetitions and passing edges) are represented in a child transition.
Constructors
| SpreadOp !(HashMap (Note n) (SpreadChildren n)) !(Edges n) |
Instances
| (Notation n, Eq n, Hashable n) => FromJSON (Spread n) Source # | |||||
| Notation n => ToJSON (Spread n) Source # | |||||
| NFData n => NFData (Spread n) Source # | |||||
| Generic (Spread n) Source # | |||||
Defined in PVGrammar Associated Types
| |||||
| Notation n => Show (Spread n) Source # | |||||
| Eq n => Eq (Spread n) Source # | |||||
| Ord n => Ord (Spread n) Source # | |||||
Defined in PVGrammar | |||||
| Hashable n => Hashable (Spread n) Source # | |||||
| type Rep (Spread n) Source # | |||||
Defined in PVGrammar type Rep (Spread n) = D1 ('MetaData "Spread" "PVGrammar" "protovoices-0.1.0.0-BDEUxFN8Fm0COc6pAhx3U0" 'False) (C1 ('MetaCons "SpreadOp" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (HashMap (Note n) (SpreadChildren n))) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Edges n)))) | |||||
data SpreadChildren n Source #
Represents the children of a note that is spread out.
A note can be distributed to either or both sub-slice.
Constructors
| SpreadLeftChild !(Note n) | a single child in the left slice |
| SpreadRightChild !(Note n) | a single child in the right slice |
| SpreadBothChildren !(Note n) !(Note n) | two children, on in each slice |
Instances
| Functor SpreadChildren Source # | |||||
Defined in PVGrammar Methods fmap :: (a -> b) -> SpreadChildren a -> SpreadChildren b # (<$) :: a -> SpreadChildren b -> SpreadChildren a # | |||||
| Foldable SpreadChildren Source # | |||||
Defined in PVGrammar Methods fold :: Monoid m => SpreadChildren m -> m # foldMap :: Monoid m => (a -> m) -> SpreadChildren a -> m # foldMap' :: Monoid m => (a -> m) -> SpreadChildren a -> m # foldr :: (a -> b -> b) -> b -> SpreadChildren a -> b # foldr' :: (a -> b -> b) -> b -> SpreadChildren a -> b # foldl :: (b -> a -> b) -> b -> SpreadChildren a -> b # foldl' :: (b -> a -> b) -> b -> SpreadChildren a -> b # foldr1 :: (a -> a -> a) -> SpreadChildren a -> a # foldl1 :: (a -> a -> a) -> SpreadChildren a -> a # toList :: SpreadChildren a -> [a] # null :: SpreadChildren a -> Bool # length :: SpreadChildren a -> Int # elem :: Eq a => a -> SpreadChildren a -> Bool # maximum :: Ord a => SpreadChildren a -> a # minimum :: Ord a => SpreadChildren a -> a # sum :: Num a => SpreadChildren a -> a # product :: Num a => SpreadChildren a -> a # | |||||
| Traversable SpreadChildren Source # | |||||
Defined in PVGrammar Methods traverse :: Applicative f => (a -> f b) -> SpreadChildren a -> f (SpreadChildren b) # sequenceA :: Applicative f => SpreadChildren (f a) -> f (SpreadChildren a) # mapM :: Monad m => (a -> m b) -> SpreadChildren a -> m (SpreadChildren b) # sequence :: Monad m => SpreadChildren (m a) -> m (SpreadChildren a) # | |||||
| Notation n => FromJSON (SpreadChildren n) Source # | |||||
Defined in PVGrammar Methods parseJSON :: Value -> Parser (SpreadChildren n) # parseJSONList :: Value -> Parser [SpreadChildren n] # omittedField :: Maybe (SpreadChildren n) # | |||||
| Notation n => ToJSON (SpreadChildren n) Source # | |||||
Defined in PVGrammar Methods toJSON :: SpreadChildren n -> Value # toEncoding :: SpreadChildren n -> Encoding # toJSONList :: [SpreadChildren n] -> Value # toEncodingList :: [SpreadChildren n] -> Encoding # omitField :: SpreadChildren n -> Bool # | |||||
| NFData n => NFData (SpreadChildren n) Source # | |||||
Defined in PVGrammar Methods rnf :: SpreadChildren n -> () # | |||||
| Generic (SpreadChildren n) Source # | |||||
Defined in PVGrammar Associated Types
Methods from :: SpreadChildren n -> Rep (SpreadChildren n) x # to :: Rep (SpreadChildren n) x -> SpreadChildren n # | |||||
| Notation n => Show (SpreadChildren n) Source # | |||||
Defined in PVGrammar Methods showsPrec :: Int -> SpreadChildren n -> ShowS # show :: SpreadChildren n -> String # showList :: [SpreadChildren n] -> ShowS # | |||||
| Eq n => Eq (SpreadChildren n) Source # | |||||
Defined in PVGrammar Methods (==) :: SpreadChildren n -> SpreadChildren n -> Bool # (/=) :: SpreadChildren n -> SpreadChildren n -> Bool # | |||||
| Ord n => Ord (SpreadChildren n) Source # | |||||
Defined in PVGrammar Methods compare :: SpreadChildren n -> SpreadChildren n -> Ordering # (<) :: SpreadChildren n -> SpreadChildren n -> Bool # (<=) :: SpreadChildren n -> SpreadChildren n -> Bool # (>) :: SpreadChildren n -> SpreadChildren n -> Bool # (>=) :: SpreadChildren n -> SpreadChildren n -> Bool # max :: SpreadChildren n -> SpreadChildren n -> SpreadChildren n # min :: SpreadChildren n -> SpreadChildren n -> SpreadChildren n # | |||||
| Hashable n => Hashable (SpreadChildren n) Source # | |||||
Defined in PVGrammar | |||||
| type Rep (SpreadChildren n) Source # | |||||
Defined in PVGrammar type Rep (SpreadChildren n) = D1 ('MetaData "SpreadChildren" "PVGrammar" "protovoices-0.1.0.0-BDEUxFN8Fm0COc6pAhx3U0" 'False) (C1 ('MetaCons "SpreadLeftChild" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Note n))) :+: (C1 ('MetaCons "SpreadRightChild" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Note n))) :+: C1 ('MetaCons "SpreadBothChildren" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Note n)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Note n))))) | |||||
leftSpreadChild :: SpreadChildren n -> Maybe (Note n) Source #
Returns the left child of a spread note, if it exists
rightSpreadChild :: SpreadChildren n -> Maybe (Note n) Source #
Returns the right child of a spread note, if it exists
Derivations
type PVLeftmost n = Leftmost (Split n) (Freeze n) (Spread n) Source #
Leftmost specialized to the split, freeze, and spread operations of the grammar.
type PVAnalysis n = Analysis (Split n) (Freeze n) (Spread n) (Edges n) (Notes n) Source #
An Analysis specialized to PV types.
analysisTraversePitch :: (Applicative f, Eq n', Hashable n', Ord n') => (n -> f n') -> PVAnalysis n -> f (PVAnalysis n') Source #
Apply an applicative action to all pitches in an analysis.
analysisMapPitch :: (Eq n', Hashable n', Ord n') => (n -> n') -> PVAnalysis n -> PVAnalysis n' Source #
Map a function over all pitches in an analysis.
Loading Files
loadAnalysis :: FilePath -> IO (Either String (PVAnalysis SPitch)) Source #
Loads an analysis from a JSON file (as exported by the annotation tool).
loadAnalysis' :: FilePath -> IO (Either String (PVAnalysis SPC)) Source #
Loads an analysis from a JSON file (as exported by the annotation tool). Converts all pitches to pitch classes.
slicesFromFile :: FilePath -> IO [[(Note SPitch, RightTied)]] Source #
Loads a MusicXML file and returns a list of salami slices. Each note is expressed as a pitch and a flag that indicates whether the note continues in the next slice.
slicesToPath :: (Interval i, Ord i, Eq i) => [[(Note (Pitch i), RightTied)]] -> Path [Note (Pitch i)] [Edge (Pitch i)] Source #
Converts salami slices (as returned by slicesFromFile) to a path as expected by parsers.