Copyright | (c) Eric Bailey 2025 |
---|---|
License | MIT |
Maintainer | eric@ericb.me |
Stability | stable |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Data.Rhythm.Binary.BDF
Description
Binary rhythm definitions, including conversion to ABC notation.
Synopsis
- newtype BinaryRhythmDefinition (m :: Nat) (n :: Nat) = BinaryRhythmDefinition (Int, Vector m (BinaryRhythm n))
- newtype BinaryRhythm (n :: Nat) = BinaryRhythm {
- unBinaryRhythm :: (MIDIInstrument, Vector n (Finite 2))
- data SomeBinaryRhythmDefinition where
- SomeBinaryRhythmDefinition :: (KnownNat m, KnownNat n) => BinaryRhythmDefinition m n -> SomeBinaryRhythmDefinition
- type MIDIInstrument = Closed 1 128
- someBinaryRhythmDefinition :: Parser SomeBinaryRhythmDefinition
- binaryRhythm :: forall n. KnownNat n => Parser (BinaryRhythm n)
- toAbcString :: forall m n. (KnownNat m, KnownNat n) => String -> Int -> BinaryRhythmDefinition m n -> String
Types
newtype BinaryRhythmDefinition (m :: Nat) (n :: Nat) Source #
A binary rhythm definition consists of a tempo and m
binary rhythms
consisting of n
notes each.
Constructors
BinaryRhythmDefinition (Int, Vector m (BinaryRhythm n)) |
Instances
newtype BinaryRhythm (n :: Nat) Source #
A binary rhythm consists of a MIDI instrument number and a binary words of
length n
, where a 1
represents an onset.
Constructors
BinaryRhythm | |
Fields
|
Instances
Generic (BinaryRhythm n) Source # | |
Defined in Data.Rhythm.Binary.BDF Associated Types type Rep (BinaryRhythm n) :: Type -> Type # Methods from :: BinaryRhythm n -> Rep (BinaryRhythm n) x # to :: Rep (BinaryRhythm n) x -> BinaryRhythm n # | |
Show (BinaryRhythm n) Source # | |
Defined in Data.Rhythm.Binary.BDF Methods showsPrec :: Int -> BinaryRhythm n -> ShowS # show :: BinaryRhythm n -> String # showList :: [BinaryRhythm n] -> ShowS # | |
Eq (BinaryRhythm n) Source # | |
Defined in Data.Rhythm.Binary.BDF Methods (==) :: BinaryRhythm n -> BinaryRhythm n -> Bool # (/=) :: BinaryRhythm n -> BinaryRhythm n -> Bool # | |
type Rep (BinaryRhythm n) Source # | |
Defined in Data.Rhythm.Binary.BDF type Rep (BinaryRhythm n) = D1 ('MetaData "BinaryRhythm" "Data.Rhythm.Binary.BDF" "CreatingRhythms-1.8.0.7-DGB2JNDHfptLnJAgYi7IVp" 'True) (C1 ('MetaCons "BinaryRhythm" 'PrefixI 'True) (S1 ('MetaSel ('Just "unBinaryRhythm") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (MIDIInstrument, Vector n (Finite 2))))) |
data SomeBinaryRhythmDefinition where Source #
Existential wrapper around a BinaryRhythmDefinition
of unknown size.
Constructors
SomeBinaryRhythmDefinition :: (KnownNat m, KnownNat n) => BinaryRhythmDefinition m n -> SomeBinaryRhythmDefinition |
Instances
Show SomeBinaryRhythmDefinition Source # | |
Defined in Data.Rhythm.Binary.BDF Methods showsPrec :: Int -> SomeBinaryRhythmDefinition -> ShowS # show :: SomeBinaryRhythmDefinition -> String # showList :: [SomeBinaryRhythmDefinition] -> ShowS # |
type MIDIInstrument = Closed 1 128 Source #
The General MIDI Level 1 sound set consists of instruments numbered 1
through 128
.
Parsing
someBinaryRhythmDefinition :: Parser SomeBinaryRhythmDefinition Source #
Parse a BinaryRhythmDefinition
of unknown size.
binaryRhythm :: forall n. KnownNat n => Parser (BinaryRhythm n) Source #
Parse a BinaryRhythm
of known length.
Rendering
toAbcString :: forall m n. (KnownNat m, KnownNat n) => String -> Int -> BinaryRhythmDefinition m n -> String Source #
Given a title and a number of repeats, represent a binary rhythm definition using ABC notation.