| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Fadno.Note
Synopsis
- data Note p d = Note {}
- pitch :: forall p1 d p2 f. Functor f => (p1 -> f p2) -> Note p1 d -> f (Note p2 d)
- dur :: forall p d1 d2 f. Functor f => (d1 -> f d2) -> Note p d1 -> f (Note p d2)
- class HasNote s p d | s -> p d where
- toPair :: forall p1 d p2 f. (Profunctor p2, Functor f) => p2 (p1, d) (f (p1, d)) -> p2 (Note p1 d) (f (Note p1 d))
- (|:) :: p -> d -> Note p d
- data Mono p
- maybeMono :: forall a p f. (Profunctor p, Functor f) => p (Mono a) (f (Mono a)) -> p (Maybe a) (f (Maybe a))
- mono :: HasNote n (Mono p) d => p -> d -> n
- mono' :: p -> d -> Note (Mono p) d
- mPitch :: forall p1 p2 f. Applicative f => (p1 -> f p2) -> Mono p1 -> f (Mono p2)
- unMono :: b -> (a -> b) -> Mono a -> b
- catMonos :: Foldable f => f (Mono a) -> [a]
- _M :: forall p1 p2 p3 f. (Choice p3, Applicative f) => p3 p1 (f p2) -> p3 (Mono p1) (f (Mono p2))
- rest :: (HasNote n p d, Monoid p) => d -> n
- isRest :: (Monoid p, Eq p, HasNote n p d) => n -> Bool
- data Spelling
- fromChroma :: Integral a => a -> Spelling
- toChroma :: Integral a => Spelling -> a
- spelling :: Integral a => Iso' a Spelling
- data PitchRep = PitchRep {}
- prPitch :: Lens' PitchRep Spelling
- prOctave :: Lens' PitchRep Int
- (@:) :: Spelling -> Int -> PitchRep
- pitchRep :: Integral a => Iso' a PitchRep
- sumDurs :: (Num d, HasNote a p d, Traversable t) => t a -> d
- mapTime :: (Num d, Ord d, HasNote a p d, Traversable t) => t a -> [(d, a)]
- tied :: (Eq p, Num d, HasNote a p d, Traversable t, Traversable u, Snoc (u a) (u a) a a, Monoid (u a)) => t a -> u a
- tied' :: (Eq p, Num d, HasNote a p d, Traversable t) => t a -> [a]
- legato :: (Eq p, Monoid p, Num d, HasNote a p d, Traversable t, Traversable u, Snoc (u a) (u a) a a, Monoid (u a)) => t a -> u a
- legato' :: (Eq p, Monoid p, Num d, HasNote a p d, Traversable t) => t a -> [a]
- merge :: (Num d, HasNote a p d, Traversable t, Traversable u, Snoc (u a) (u a) a a, Monoid (u a)) => (a -> a -> Bool) -> t a -> u a
- transpose :: (Num p, HasNote a p d, Traversable t) => p -> t a -> t a
- transpose' :: forall p (f :: Type -> Type) a d t. (Num p, Functor f, HasNote a (f p) d, Traversable t) => p -> t a -> t a
- (%) :: Integral a => a -> a -> Ratio a
Documentation
Note = pitch and duration.
Instances
| Bifunctor Note Source # | |||||
| Functor (Note p) Source # | |||||
| (Integral p, Traversable c, Integral d, Traversable t) => MidiNotes (t (Note (c p) d)) Source # | |||||
Defined in Fadno.Midi | |||||
| (Integral p, Integral d, Traversable t) => MidiNotes (t (Note p d)) Source # | |||||
Defined in Fadno.Midi | |||||
| Generic (Note p d) Source # | |||||
Defined in Fadno.Note Associated Types
| |||||
| (Show p, Show d) => Show (Note p d) Source # | |||||
| HasTie (Note p d) Source # | |||||
| (Eq p, Eq d) => Eq (Note p d) Source # | |||||
| HasNote (Note' p d) p d Source # | |||||
| HasNote (Note p d) p d Source # | |||||
| Field1 (Note a b) (Note a' b) a a' Source # | |||||
Defined in Fadno.Note | |||||
| Field2 (Note a b) (Note a b') b b' Source # | |||||
Defined in Fadno.Note | |||||
| type Rep (Note p d) Source # | |||||
Defined in Fadno.Note type Rep (Note p d) = D1 ('MetaData "Note" "Fadno.Note" "fadno-1.1.9.1-3HzpBu5nDhbCDIV3DNdTMS" 'False) (C1 ('MetaCons "Note" 'PrefixI 'True) (S1 ('MetaSel ('Just "_pitch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 p) :*: S1 ('MetaSel ('Just "_dur") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 d))) | |||||
class HasNote s p d | s -> p d where Source #
Hand-rolled class providing monomorphic lenses.
Methods
note :: Lens' s (Note p d) Source #
fromNote :: HasNote n p d => n -> s Source #
toPair :: forall p1 d p2 f. (Profunctor p2, Functor f) => p2 (p1, d) (f (p1, d)) -> p2 (Note p1 d) (f (Note p1 d)) Source #
Monophonic pitch functor, i.e. Maybe with a sum monoid.
maybeMono :: forall a p f. (Profunctor p, Functor f) => p (Mono a) (f (Mono a)) -> p (Maybe a) (f (Maybe a)) Source #
Mono/Maybe isomorphism.
_M :: forall p1 p2 p3 f. (Choice p3, Applicative f) => p3 p1 (f p2) -> p3 (Mono p1) (f (Mono p2)) Source #
Chroma as enharmonic names.
Instances
| Bounded Spelling Source # | |||||
Defined in Fadno.Note | |||||
| Enum Spelling Source # | |||||
Defined in Fadno.Note | |||||
| Generic Spelling Source # | |||||
Defined in Fadno.Note Associated Types
| |||||
| Read Spelling Source # | |||||
Defined in Fadno.Note | |||||
| Show Spelling Source # | |||||
| Eq Spelling Source # | |||||
| Ord Spelling Source # | |||||
| type Rep Spelling Source # | |||||
Defined in Fadno.Note type Rep Spelling = D1 ('MetaData "Spelling" "Fadno.Note" "fadno-1.1.9.1-3HzpBu5nDhbCDIV3DNdTMS" 'False) ((((C1 ('MetaCons "C" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Cs" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Db" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "D" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Ds" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "Eb" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "E" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Fb" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Es" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "F" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "Fs" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Gb" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "G" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Gs" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Ab" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "A" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "As" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Bb" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "B" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Cb" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Bs" 'PrefixI 'False) (U1 :: Type -> Type)))))) | |||||
fromChroma :: Integral a => a -> Spelling Source #
Represent pitch as chroma and octave.
It's a full Num, Integral instance, so negative octave values OK.
Instances use C4 == 60.
Instances
| Bounded PitchRep Source # | |||||
Defined in Fadno.Note | |||||
| Enum PitchRep Source # | |||||
Defined in Fadno.Note | |||||
| Generic PitchRep Source # | |||||
Defined in Fadno.Note Associated Types
| |||||
| Num PitchRep Source # | |||||
| Integral PitchRep Source # | |||||
| Real PitchRep Source # | |||||
Defined in Fadno.Note Methods toRational :: PitchRep -> Rational | |||||
| Show PitchRep Source # | |||||
| Eq PitchRep Source # | |||||
| Ord PitchRep Source # | |||||
| type Rep PitchRep Source # | |||||
Defined in Fadno.Note type Rep PitchRep = D1 ('MetaData "PitchRep" "Fadno.Note" "fadno-1.1.9.1-3HzpBu5nDhbCDIV3DNdTMS" 'False) (C1 ('MetaCons "PitchRep" 'PrefixI 'True) (S1 ('MetaSel ('Just "_prPitch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Spelling) :*: S1 ('MetaSel ('Just "_prOctave") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))) | |||||
sumDurs :: (Num d, HasNote a p d, Traversable t) => t a -> d Source #
compute total duration of notes
mapTime :: (Num d, Ord d, HasNote a p d, Traversable t) => t a -> [(d, a)] Source #
map notes to arrival time
tied :: (Eq p, Num d, HasNote a p d, Traversable t, Traversable u, Snoc (u a) (u a) a a, Monoid (u a)) => t a -> u a Source #
merge same-pitch notes
legato :: (Eq p, Monoid p, Num d, HasNote a p d, Traversable t, Traversable u, Snoc (u a) (u a) a a, Monoid (u a)) => t a -> u a Source #
merge rests with prior note
merge :: (Num d, HasNote a p d, Traversable t, Traversable u, Snoc (u a) (u a) a a, Monoid (u a)) => (a -> a -> Bool) -> t a -> u a Source #
merge notes meeting some comparison by accumulating durations
transpose' :: forall p (f :: Type -> Type) a d t. (Num p, Functor f, HasNote a (f p) d, Traversable t) => p -> t a -> t a Source #
Pitch addition over a functor