Portability | non-portable (TF,GNTD) |
---|---|
Stability | experimental |
Maintainer | hans@hanshoglund.se |
Safe Haskell | None |
Provides functions for manipulating pitch.
- pitch' :: HasPitch' a => Lens' a (Pitch a)
- pitch :: HasPitch a b => Lens a b (Pitch a) (Pitch b)
- inv :: Transposable a => Pitch a -> a -> a
- up :: Transposable a => Interval a -> a -> a
- down :: Transposable a => Interval a -> a -> a
- fifthsUp :: Transposable a => Scalar (Interval a) -> a -> a
- fifthsDown :: Transposable a => Scalar (Interval a) -> a -> a
- octavesUp :: Transposable a => Scalar (Interval a) -> a -> a
- octavesDown :: Transposable a => Scalar (Interval a) -> a -> a
- fifthsAbove :: (Semigroup a, Transposable a) => Scalar (Interval a) -> a -> a
- fifthsBelow :: (Semigroup a, Transposable a) => Scalar (Interval a) -> a -> a
- octavesAbove :: (Semigroup a, Transposable a) => Scalar (Interval a) -> a -> a
- octavesBelow :: (Semigroup a, Transposable a) => Scalar (Interval a) -> a -> a
- type family Pitch a
- type Interval a = Diff (Pitch a)
- class HasGetPitch s where
- __getPitch :: a ~ Pitch s => s -> a
- class SetPitch (Pitch t) s ~ t => HasSetPitch s t where
- type SetPitch b s :: *
- __setPitch :: Pitch t -> s -> t
- __mapPitch :: (Pitch s -> Pitch t) -> s -> t
- type HasPitch' a = HasPitch a a
- type HasPitch s t = (HasGetPitch s, HasSetPitch s t)
- type HasSetPitch' a = HasSetPitch a a
- type Transposable a = (HasSetPitch' a, Transposable1 a)
- type Transposable1 a = (Diff (Pitch a) ~ Interval a, AffineSpace (Pitch a), VectorSpace (Interval a), IsPitch (Pitch a), IsInterval (Interval a))
Accessors
pitch' :: HasPitch' a => Lens' a (Pitch a)Source
A lens to the pitch in a note, score or other structure.
pitch :: HasPitch a b => Lens a b (Pitch a) (Pitch b)Source
A lens to the pitch in a note, score or other structure.
Transformations
Transformations
inv :: Transposable a => Pitch a -> a -> aSource
Invert pitches.
Transformations
up :: Transposable a => Interval a -> a -> aSource
Transpose up.
down :: Transposable a => Interval a -> a -> aSource
Transpose down.
fifthsUp :: Transposable a => Scalar (Interval a) -> a -> aSource
Add the given interval below.
fifthsDown :: Transposable a => Scalar (Interval a) -> a -> aSource
Add the given interval below.
octavesUp :: Transposable a => Scalar (Interval a) -> a -> aSource
Transpose up by the given number of octaves.
octavesDown :: Transposable a => Scalar (Interval a) -> a -> aSource
Transpose down by the given number of octaves.
Transformations
fifthsAbove :: (Semigroup a, Transposable a) => Scalar (Interval a) -> a -> aSource
Add the given interval below.
fifthsBelow :: (Semigroup a, Transposable a) => Scalar (Interval a) -> a -> aSource
Add the given interval below.
octavesAbove :: (Semigroup a, Transposable a) => Scalar (Interval a) -> a -> aSource
Add the given interval below.
octavesBelow :: (Semigroup a, Transposable a) => Scalar (Interval a) -> a -> aSource
Add the given interval below.
Pitch representation
class HasGetPitch s whereSource
Class of types with readable pitch.
__getPitch :: a ~ Pitch s => s -> aSource
HasGetPitch Bool | |
HasGetPitch Double | |
HasGetPitch Float | |
HasGetPitch Int | |
HasGetPitch Integer | |
HasGetPitch () | |
HasGetPitch a => HasGetPitch (Note a) | |
HasGetPitch a => HasGetPitch (TieT a) | |
HasGetPitch a => HasGetPitch (DynamicT a) | |
HasGetPitch a => HasGetPitch (ArticulationT a) | |
HasGetPitch a => HasGetPitch (SlideT a) | |
HasGetPitch a => HasGetPitch (HarmonicT a) | |
HasGetPitch a => HasGetPitch (TextT a) | |
HasGetPitch a => HasGetPitch (TremoloT a) | |
HasGetPitch a => HasGetPitch (c, a) | |
HasGetPitch a => HasGetPitch (PartT n a) |
class SetPitch (Pitch t) s ~ t => HasSetPitch s t whereSource
Class of types with mutable pitch.
Either setPitch
or mapPitch
can be implemented. If both are implemented,
the following laws should be satisfied:
setPitch x = mapPitch (const x) mapPitch f x = setPitch p x where p = f (__getPitch x)
For types that are Functors
, the following instance can be used
type instance Pitch (T a) = Pitch a instance HasSetPitch a b => HasSetPitch (T a) (T b) where type SetPitch g (T a) = T (SetPitch g a) mapPitch = fmap . mapPitch
__setPitch :: Pitch t -> s -> tSource
__mapPitch :: (Pitch s -> Pitch t) -> s -> tSource
type HasPitch s t = (HasGetPitch s, HasSetPitch s t)Source
type HasSetPitch' a = HasSetPitch a aSource
type Transposable a = (HasSetPitch' a, Transposable1 a)Source
type Transposable1 a = (Diff (Pitch a) ~ Interval a, AffineSpace (Pitch a), VectorSpace (Interval a), IsPitch (Pitch a), IsInterval (Interval a))Source