-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Minimal library for music generation and notation
--   
--   Provides the Note type and HasNote class with polymorphic pitch and
--   duration representations, metering, barring and time signature
--   utilities, plus midi and MusicXML support.
@package fadno
@version 1.1.9.1

module Fadno.Note

-- | Note = pitch and duration.
data Note p d
Note :: p -> d -> Note p d
[_pitch] :: Note p d -> p
[_dur] :: Note p d -> d
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)

-- | Hand-rolled class providing monomorphic lenses.
class HasNote s p d | s -> p d
note :: HasNote s p d => Lens' s (Note p d)
fromNote :: (HasNote s p d, HasNote n p d) => n -> s
notePitch :: HasNote s p d => Lens' s p
noteDur :: HasNote s p d => Lens' s d
toPair :: forall p1 d p2 f. (Profunctor p2, Functor f) => p2 (p1, d) (f (p1, d)) -> p2 (Note p1 d) (f (Note p1 d))

-- | <a>Note</a> smart constructor.
(|:) :: p -> d -> Note p d
infixl 5 |:

-- | Monophonic pitch functor, i.e. Maybe with a sum monoid.
data Mono p
Rest :: Mono p
M :: p -> Mono p
[_mPitch] :: Mono p -> p

-- | Mono/Maybe isomorphism.
maybeMono :: forall a p f. (Profunctor p, Functor f) => p (Mono a) (f (Mono a)) -> p (Maybe a) (f (Maybe a))

-- | Mono <a>HasNote</a>
mono :: HasNote n (Mono p) d => p -> d -> n

-- | Mono <a>Note</a>.
mono' :: p -> d -> Note (Mono p) d
mPitch :: forall p1 p2 f. Applicative f => (p1 -> f p2) -> Mono p1 -> f (Mono p2)

-- | Mono eliminator
unMono :: b -> (a -> b) -> Mono a -> b

-- | cf <tt>catMaybe</tt>. Grab all non-rest values.
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))

-- | <a>Note</a> from duration, given <a>Monoid</a> pitch. Interoperates
--   with <tt>chord</tt> and <a>mono</a>. Useful for batch duration
--   conversion.
rest :: (HasNote n p d, Monoid p) => d -> n
isRest :: (Monoid p, Eq p, HasNote n p d) => n -> Bool

-- | Chroma as enharmonic names.
data Spelling
C :: Spelling
Cs :: Spelling
Db :: Spelling
D :: Spelling
Ds :: Spelling
Eb :: Spelling
E :: Spelling
Fb :: Spelling
Es :: Spelling
F :: Spelling
Fs :: Spelling
Gb :: Spelling
G :: Spelling
Gs :: Spelling
Ab :: Spelling
A :: Spelling
As :: Spelling
Bb :: Spelling
B :: Spelling
Cb :: Spelling
Bs :: Spelling

-- | Convert to <a>Spelling</a> with 0==C, using
--   <a>Cs</a>,<a>Eb</a>,<a>Fs</a>,<a>Gs</a>,<a>Bb</a> enharmonics.
fromChroma :: Integral a => a -> Spelling

-- | <a>Spelling</a> to 0-11.
toChroma :: Integral a => Spelling -> a

-- | <a>Spelling</a>-to-chroma degenerate <a>Iso</a>.
spelling :: Integral a => Iso' a Spelling

-- | Represent pitch as chroma and octave. It's a full <a>Num</a>,
--   <a>Integral</a> instance, so negative octave values OK. Instances use
--   C4 == 60.
data PitchRep
PitchRep :: Spelling -> Int -> PitchRep
[_prPitch] :: PitchRep -> Spelling
[_prOctave] :: PitchRep -> Int
prPitch :: Lens' PitchRep Spelling
prOctave :: Lens' PitchRep Int
(@:) :: Spelling -> Int -> PitchRep
infixl 6 @:

-- | Iso to integrals.
pitchRep :: Integral a => Iso' a PitchRep

-- | compute total duration of notes
sumDurs :: (Num d, HasNote a p d, Traversable t) => t a -> d

-- | map notes to arrival time
mapTime :: (Num d, Ord d, HasNote a p d, Traversable t) => t a -> [(d, a)]

-- | merge same-pitch notes
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]

-- | merge rests with prior note
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 notes meeting some comparison by accumulating durations
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

-- | Pitch addition
transpose :: (Num p, HasNote a p d, Traversable t) => p -> t a -> t a

-- | Pitch addition over a functor
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
instance Data.Bifunctor.Bifunctor Fadno.Note.Note
instance GHC.Internal.Enum.Bounded Fadno.Note.PitchRep
instance GHC.Internal.Enum.Bounded Fadno.Note.Spelling
instance GHC.Internal.Enum.Enum Fadno.Note.PitchRep
instance GHC.Internal.Enum.Enum Fadno.Note.Spelling
instance GHC.Classes.Eq p => GHC.Classes.Eq (Fadno.Note.Mono p)
instance (GHC.Classes.Eq p, GHC.Classes.Eq d) => GHC.Classes.Eq (Fadno.Note.Note p d)
instance GHC.Classes.Eq Fadno.Note.PitchRep
instance GHC.Classes.Eq Fadno.Note.Spelling
instance Control.Lens.Tuple.Field1 (Fadno.Note.Note a b) (Fadno.Note.Note a' b) a a'
instance Control.Lens.Tuple.Field2 (Fadno.Note.Note a b) (Fadno.Note.Note a b') b b'
instance GHC.Internal.Base.Functor Fadno.Note.Mono
instance GHC.Internal.Base.Functor (Fadno.Note.Note p)
instance GHC.Internal.Generics.Generic (Fadno.Note.Note p d)
instance GHC.Internal.Generics.Generic Fadno.Note.PitchRep
instance GHC.Internal.Generics.Generic Fadno.Note.Spelling
instance Fadno.Note.HasNote (Fadno.Note.Note p d) p d
instance GHC.Internal.Real.Integral Fadno.Note.PitchRep
instance GHC.Internal.Num.Num p => GHC.Internal.Base.Monoid (Fadno.Note.Mono p)
instance GHC.Internal.Num.Num Fadno.Note.PitchRep
instance GHC.Classes.Ord p => GHC.Classes.Ord (Fadno.Note.Mono p)
instance GHC.Classes.Ord Fadno.Note.PitchRep
instance GHC.Classes.Ord Fadno.Note.Spelling
instance GHC.Internal.Read.Read Fadno.Note.Spelling
instance GHC.Internal.Real.Real Fadno.Note.PitchRep
instance GHC.Internal.Num.Num p => GHC.Internal.Base.Semigroup (Fadno.Note.Mono p)
instance GHC.Internal.Show.Show p => GHC.Internal.Show.Show (Fadno.Note.Mono p)
instance (GHC.Internal.Show.Show p, GHC.Internal.Show.Show d) => GHC.Internal.Show.Show (Fadno.Note.Note p d)
instance GHC.Internal.Show.Show Fadno.Note.PitchRep
instance GHC.Internal.Show.Show Fadno.Note.Spelling

module Fadno.Notation
data Quanta
Q2 :: Quanta
Q4 :: Quanta
Q8 :: Quanta
Q16 :: Quanta
Q32 :: Quanta
Q64 :: Quanta
qToInt :: Quanta -> Int
qFromInt :: Integral i => i -> Maybe Quanta
data TimeSignature
TimeSignature :: Int -> Quanta -> TimeSignature
[_tsLength] :: TimeSignature -> Int
[_tsUnit] :: TimeSignature -> Quanta
tsLength :: Lens' TimeSignature Int
tsUnit :: Lens' TimeSignature Quanta
class HasTimeSignature a
timeSignature :: HasTimeSignature a => Lens' a (Maybe TimeSignature)
(/:) :: Int -> Quanta -> TimeSignature
data PPQ
PQ4 :: PPQ
PQ8 :: PPQ
PQ16 :: PPQ
PQ32 :: PPQ
PQ64 :: PPQ
PQ128 :: PPQ
PQ256 :: PPQ
ppqDiv :: Integral a => PPQ -> a
tsToRatio :: TimeSignature -> Rational
tsFromRatio :: Rational -> Maybe TimeSignature
tsFromRatio' :: TimeSignature -> Rational -> Maybe TimeSignature

-- | Duration iso, from Integral to Rational, given PPQ
ratioPPQ :: Integral a => PPQ -> Iso' a Rational

-- | Adapt a type to its HasXXX "Maybe Lens'"
adaptHas :: forall a f. Functor f => (Maybe a -> f (Maybe a)) -> a -> f a

-- | Adapt a non-Maybe lens to the HasXXX "Maybe Lens'"
adaptHasLens :: Lens' s a -> Lens' s (Maybe a)

-- | Adapt a type that does NOT support the HasXXX feature.
adaptHasNot :: forall s a f. Functor f => (Maybe a -> f (Maybe a)) -> s -> f s

-- | Tied notes.
data Tie
TStart :: Tie
TStop :: Tie
TBoth :: Tie
class HasTie a
tie :: HasTie a => Lens' a (Maybe Tie)

-- | Slurred notes.
data Slur
SStart :: Slur
SStop :: Slur
class HasSlur a
slur :: HasSlur a => Lens' a (Maybe Slur)

-- | Note articulations.
data Articulation
Staccato :: Articulation
Accent :: Articulation

-- | StrongAccent TODO implement after fixing fadno-xml #7
Tenuto :: Articulation
DetachedLegato :: Articulation
Staccatissimo :: Articulation
Spiccato :: Articulation
Scoop :: Articulation
Plop :: Articulation
Doit :: Articulation
Falloff :: Articulation
BreathMark :: Articulation
Caesura :: Articulation
Stress :: Articulation
Unstress :: Articulation
SoftAccent :: Articulation
OtherArticulation :: String -> Articulation
class HasArticulation a
articulation :: HasArticulation a => Lens' a (Maybe Articulation)

-- | Bar rehearsal mark.
newtype RehearsalMark
RehearsalMark :: String -> RehearsalMark
[_rehearsalText] :: RehearsalMark -> String
rehearsalText :: Iso' RehearsalMark String
class HasRehearsalMark a
rehearsalMark :: HasRehearsalMark a => Lens' a (Maybe RehearsalMark)

-- | Musical direction.
newtype Direction
Direction :: String -> Direction
[_directionText] :: Direction -> String
directionText :: Iso' Direction String
class HasDirection a
direction :: HasDirection a => Lens' a (Maybe Direction)

-- | Barline.
data Barline
Double :: Barline
Final :: Barline
class HasBarline a
barline :: HasBarline a => Lens' a (Maybe Barline)
data Repeats
RStart :: Repeats
REnd :: Repeats
RBoth :: Repeats
class HasRepeats a
repeats :: HasRepeats a => Lens' a (Maybe Repeats)
data Clef
TrebleClef :: Clef
BassClef :: Clef
AltoClef :: Clef
PercClef :: Clef
class HasClef a
clef :: HasClef a => Lens' a (Maybe Clef)

-- | Adapts musicxml Beams where beams are labeled "1" for eighth beam etc,
--   where instead it is a list implying the first element is eighth etc.
data Beam
BeamBegin :: Beam
BeamContinue :: Beam
BeamEnd :: Beam
BeamForwardHook :: Beam
BeamBackwardHook :: Beam
class HasBeams a
beams :: HasBeams a => Lens' a [Beam]
class HasVoice a
voice :: HasVoice a => Lens' a (Maybe String)

-- | Part identifier, prefers <a>Num</a> or <a>IsString</a> values.
newtype Part a
Part :: a -> Part a
[_partIdx] :: Part a -> a
partIdx :: forall a1 a2 p f. (Profunctor p, Functor f) => p a1 (f a2) -> p (Part a1) (f (Part a2))
class HasPart a b | a -> b
part :: HasPart a b => Lens' a (Maybe (Part b))

-- | Lensy show of a Maybe field, given a <a>Getter</a> and its name.
mshow :: Show a => Getter s (Maybe a) -> String -> s -> String

-- | <a>concatMap</a> show functions with a prelude.
mshows :: s -> String -> [s -> String] -> String

-- | Note with notations.
type Note' p d = Noted Note p d
data Noted n
Noted :: n -> Maybe Tie -> Maybe Slur -> Maybe Articulation -> [Beam] -> Maybe String -> Noted n
[_nNote] :: Noted n -> n
[_nTie] :: Noted n -> Maybe Tie
[_nSlur] :: Noted n -> Maybe Slur
[_nArticulation] :: Noted n -> Maybe Articulation
[_nBeams] :: Noted n -> [Beam]
[_nVoice] :: Noted n -> Maybe String
nArticulation :: forall n f. Functor f => (Maybe Articulation -> f (Maybe Articulation)) -> Noted n -> f (Noted n)
nBeams :: forall n f. Functor f => ([Beam] -> f [Beam]) -> Noted n -> f (Noted n)
nNote :: forall n1 n2 f. Functor f => (n1 -> f n2) -> Noted n1 -> f (Noted n2)
nSlur :: forall n f. Functor f => (Maybe Slur -> f (Maybe Slur)) -> Noted n -> f (Noted n)
nTie :: forall n f. Functor f => (Maybe Tie -> f (Maybe Tie)) -> Noted n -> f (Noted n)
nVoice :: forall n f. Functor f => (Maybe String -> f (Maybe String)) -> Noted n -> f (Noted n)

-- | Note smart ctor, used in <a>Show</a>.
note' :: Note p d -> Note' p d
noted :: n -> Noted n
testNote :: Note' [Int] Int

-- | Bar as list of notes, with notations.
data Bar n
Bar :: Seq n -> Maybe RehearsalMark -> Maybe Direction -> Maybe Barline -> Maybe Repeats -> Maybe TimeSignature -> Maybe Clef -> Bar n
[_bNotes] :: Bar n -> Seq n
[_bRehearsalMark] :: Bar n -> Maybe RehearsalMark
[_bDirection] :: Bar n -> Maybe Direction
[_bBarline] :: Bar n -> Maybe Barline
[_bRepeats] :: Bar n -> Maybe Repeats
[_bTimeSignature] :: Bar n -> Maybe TimeSignature
[_bClef] :: Bar n -> Maybe Clef
bBarline :: forall n f. Functor f => (Maybe Barline -> f (Maybe Barline)) -> Bar n -> f (Bar n)
bClef :: forall n f. Functor f => (Maybe Clef -> f (Maybe Clef)) -> Bar n -> f (Bar n)
bDirection :: forall n f. Functor f => (Maybe Direction -> f (Maybe Direction)) -> Bar n -> f (Bar n)
bNotes :: forall n1 n2 f. Functor f => (Seq n1 -> f (Seq n2)) -> Bar n1 -> f (Bar n2)
bRehearsalMark :: forall n f. Functor f => (Maybe RehearsalMark -> f (Maybe RehearsalMark)) -> Bar n -> f (Bar n)
bRepeats :: forall n f. Functor f => (Maybe Repeats -> f (Maybe Repeats)) -> Bar n -> f (Bar n)
bTimeSignature :: forall n f. Functor f => (Maybe TimeSignature -> f (Maybe TimeSignature)) -> Bar n -> f (Bar n)

-- | Bar smart ctor, used in <a>Show</a>.
bar :: [n] -> Bar n
testBar :: Bar (Note [Int] Int)
instance GHC.Internal.Enum.Bounded Fadno.Notation.Beam
instance GHC.Internal.Enum.Bounded Fadno.Notation.PPQ
instance GHC.Internal.Enum.Bounded a => GHC.Internal.Enum.Bounded (Fadno.Notation.Part a)
instance GHC.Internal.Enum.Bounded Fadno.Notation.Quanta
instance GHC.Internal.Enum.Bounded Fadno.Notation.Slur
instance GHC.Internal.Enum.Bounded Fadno.Notation.Tie
instance Control.Lens.Cons.Cons (Fadno.Notation.Bar n) (Fadno.Notation.Bar n) n n
instance Data.Default.Internal.Default (Fadno.Notation.Bar n)
instance Data.Default.Internal.Default Fadno.Notation.Direction
instance Data.Default.Internal.Default Fadno.Notation.RehearsalMark
instance GHC.Internal.Enum.Enum Fadno.Notation.Beam
instance GHC.Internal.Enum.Enum Fadno.Notation.PPQ
instance GHC.Internal.Enum.Enum Fadno.Notation.Quanta
instance GHC.Internal.Enum.Enum Fadno.Notation.Slur
instance GHC.Internal.Enum.Enum Fadno.Notation.Tie
instance GHC.Classes.Eq Fadno.Notation.Articulation
instance GHC.Classes.Eq n => GHC.Classes.Eq (Fadno.Notation.Bar n)
instance GHC.Classes.Eq Fadno.Notation.Barline
instance GHC.Classes.Eq Fadno.Notation.Beam
instance GHC.Classes.Eq Fadno.Notation.Clef
instance GHC.Classes.Eq Fadno.Notation.Direction
instance GHC.Classes.Eq n => GHC.Classes.Eq (Fadno.Notation.Noted n)
instance GHC.Classes.Eq Fadno.Notation.PPQ
instance GHC.Classes.Eq a => GHC.Classes.Eq (Fadno.Notation.Part a)
instance GHC.Classes.Eq Fadno.Notation.Quanta
instance GHC.Classes.Eq Fadno.Notation.RehearsalMark
instance GHC.Classes.Eq Fadno.Notation.Repeats
instance GHC.Classes.Eq Fadno.Notation.Slur
instance GHC.Classes.Eq Fadno.Notation.Tie
instance GHC.Classes.Eq Fadno.Notation.TimeSignature
instance GHC.Internal.Data.Foldable.Foldable Fadno.Notation.Bar
instance GHC.Internal.Data.Foldable.Foldable Fadno.Notation.Noted
instance GHC.Internal.Data.Foldable.Foldable Fadno.Notation.Part
instance GHC.Internal.Base.Functor Fadno.Notation.Bar
instance GHC.Internal.Base.Functor Fadno.Notation.Noted
instance GHC.Internal.Base.Functor Fadno.Notation.Part
instance GHC.Internal.Generics.Generic (Fadno.Notation.Bar n)
instance GHC.Internal.Generics.Generic Fadno.Notation.Barline
instance GHC.Internal.Generics.Generic Fadno.Notation.Clef
instance GHC.Internal.Generics.Generic Fadno.Notation.Direction
instance GHC.Internal.Generics.Generic (Fadno.Notation.Noted n)
instance GHC.Internal.Generics.Generic (Fadno.Notation.Part a)
instance GHC.Internal.Generics.Generic Fadno.Notation.RehearsalMark
instance GHC.Internal.Generics.Generic Fadno.Notation.Repeats
instance Fadno.Notation.HasArticulation Fadno.Notation.Articulation
instance Fadno.Notation.HasArticulation (Fadno.Notation.Noted n)
instance Fadno.Notation.HasBarline (Fadno.Notation.Bar n)
instance Fadno.Notation.HasBarline Fadno.Notation.Barline
instance Fadno.Notation.HasBeams [Fadno.Notation.Beam]
instance Fadno.Notation.HasBeams (Fadno.Notation.Noted n)
instance Fadno.Notation.HasClef (Fadno.Notation.Bar n)
instance Fadno.Notation.HasClef Fadno.Notation.Clef
instance Fadno.Notation.HasDirection (Fadno.Notation.Bar n)
instance Fadno.Notation.HasDirection Fadno.Notation.Direction
instance Fadno.Note.HasNote (Fadno.Notation.Note' p d) p d
instance Fadno.Notation.HasRehearsalMark (Fadno.Notation.Bar n)
instance Fadno.Notation.HasRehearsalMark Fadno.Notation.RehearsalMark
instance Fadno.Notation.HasRepeats (Fadno.Notation.Bar n)
instance Fadno.Notation.HasRepeats Fadno.Notation.Repeats
instance Fadno.Notation.HasSlur (Fadno.Notation.Noted n)
instance Fadno.Notation.HasSlur Fadno.Notation.Slur
instance Fadno.Notation.HasTie (Fadno.Note.Note p d)
instance Fadno.Notation.HasTie (Fadno.Notation.Noted n)
instance Fadno.Notation.HasTie Fadno.Notation.Tie
instance Fadno.Notation.HasTimeSignature (Fadno.Notation.Bar n)
instance Fadno.Notation.HasVoice (Fadno.Notation.Noted n)
instance GHC.Internal.Data.String.IsString Fadno.Notation.Direction
instance GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (Fadno.Notation.Part a)
instance GHC.Internal.Data.String.IsString Fadno.Notation.RehearsalMark
instance GHC.Internal.Base.Monoid (Fadno.Notation.Bar n)
instance GHC.Internal.Base.Monoid Fadno.Notation.Direction
instance GHC.Internal.Base.Monoid Fadno.Notation.RehearsalMark
instance GHC.Internal.Num.Num a => GHC.Internal.Num.Num (Fadno.Notation.Part a)
instance GHC.Classes.Ord Fadno.Notation.Articulation
instance GHC.Classes.Ord Fadno.Notation.Barline
instance GHC.Classes.Ord Fadno.Notation.Beam
instance GHC.Classes.Ord Fadno.Notation.Clef
instance GHC.Classes.Ord Fadno.Notation.Direction
instance GHC.Classes.Ord Fadno.Notation.PPQ
instance GHC.Classes.Ord a => GHC.Classes.Ord (Fadno.Notation.Part a)
instance GHC.Classes.Ord Fadno.Notation.Quanta
instance GHC.Classes.Ord Fadno.Notation.RehearsalMark
instance GHC.Classes.Ord Fadno.Notation.Repeats
instance GHC.Classes.Ord Fadno.Notation.Slur
instance GHC.Classes.Ord Fadno.Notation.Tie
instance GHC.Classes.Ord Fadno.Notation.TimeSignature
instance GHC.Internal.Real.Real a => GHC.Internal.Real.Real (Fadno.Notation.Part a)
instance GHC.Internal.Base.Semigroup (Fadno.Notation.Bar n)
instance GHC.Internal.Base.Semigroup Fadno.Notation.Direction
instance GHC.Internal.Base.Semigroup Fadno.Notation.RehearsalMark
instance GHC.Internal.Show.Show Fadno.Notation.Articulation
instance GHC.Internal.Show.Show n => GHC.Internal.Show.Show (Fadno.Notation.Bar n)
instance GHC.Internal.Show.Show Fadno.Notation.Barline
instance GHC.Internal.Show.Show Fadno.Notation.Beam
instance GHC.Internal.Show.Show Fadno.Notation.Clef
instance GHC.Internal.Show.Show Fadno.Notation.Direction
instance GHC.Internal.Show.Show n => GHC.Internal.Show.Show (Fadno.Notation.Noted n)
instance GHC.Internal.Show.Show Fadno.Notation.PPQ
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Fadno.Notation.Part a)
instance GHC.Internal.Show.Show Fadno.Notation.Quanta
instance GHC.Internal.Show.Show Fadno.Notation.RehearsalMark
instance GHC.Internal.Show.Show Fadno.Notation.Repeats
instance GHC.Internal.Show.Show Fadno.Notation.Slur
instance GHC.Internal.Show.Show Fadno.Notation.Tie
instance GHC.Internal.Show.Show Fadno.Notation.TimeSignature
instance Control.Lens.Cons.Snoc (Fadno.Notation.Bar n) (Fadno.Notation.Bar n) n n
instance GHC.Internal.Data.Traversable.Traversable Fadno.Notation.Bar
instance GHC.Internal.Data.Traversable.Traversable Fadno.Notation.Noted
instance GHC.Internal.Data.Traversable.Traversable Fadno.Notation.Part

module Fadno.Midi

-- | Serializable midi data.
type MidiData = T
type IPitch = Int
type IDur = Int

-- | Convert some note value to midi-ready values.
class MidiNotes a
toMidiNotes :: MidiNotes a => a -> [([IPitch], IDur)]

-- | Tempo in microseconds per quarter. See <a>fromBPM</a>.
newtype MidiTempo
MidiTempo :: Int -> MidiTempo

-- | Midi channel, 1-16 presumably.
newtype MidiChan
MidiChan :: Int -> MidiChan

-- | note velocity, 0-127
newtype MidiVelocity
MidiVelocity :: Int -> MidiVelocity

-- | Midi program. See <a>fromInstrument</a>.
newtype MidiProgram
MidiProgram :: Int -> MidiProgram

-- | Midi ticks per quarter.
newtype MidiTicks
MidiTicks :: Int -> MidiTicks

-- | Rational to ticks
toTicks :: MidiTicks -> Iso' Rational IDur

-- | Internal type for midi event or pad.
data MidiEvent
Pad :: IDur -> MidiEvent
Event :: T -> MidiEvent

-- | cover our tracks
type MidiTrack = Track

-- | write to disk.
writeMidiFile :: FilePath -> MidiData -> IO ()

-- | debug midi file.
showMidiFile :: FilePath -> IO ()

-- | Make midi file data
midi :: MidiTicks -> [MidiTrack] -> MidiData

-- | make a standard track which specifies tempo and program. | see
--   <a>makeTrack</a> for more control.
makeTrackFull :: MidiNotes notes => MidiTempo -> MidiChan -> MidiProgram -> MidiVelocity -> notes -> MidiTrack

-- | BPM to microseconds per quarter note.
fromBPM :: (Real a, Show a) => a -> MidiTempo

-- | convert a General MIDI <a>Instrument</a>.
fromInstrument :: Instrument -> MidiProgram

-- | make a track from track events.
makeTrack :: [MidiEvent] -> MidiTrack

-- | turn notes into track events.
toNoteEvents :: MidiNotes notes => MidiChan -> MidiVelocity -> notes -> [MidiEvent]

-- | create a <a>Voice</a> MIDI event
voiceEvent :: MidiChan -> T -> MidiEvent

-- | tempo meta event.
setTempo :: MidiTempo -> MidiEvent

-- | create a <a>Meta</a> MIDI event
metaEvent :: T -> MidiEvent

-- | create a <a>Voice</a> or <a>Mode</a> MIDI event.
midiEvent :: MidiChan -> Body -> MidiEvent

-- | program change MIDI Voice event.
programChange :: MidiChan -> MidiProgram -> MidiEvent

-- | note on + note off events, using <a>Pad</a> to carve out space.
noteEvents :: MidiChan -> MidiVelocity -> ([IPitch], IDur) -> [MidiEvent]

-- | note on or note off event.
noteEvent :: (Pitch -> Velocity -> T) -> MidiChan -> MidiVelocity -> IPitch -> MidiEvent
noteOn :: MidiChan -> MidiVelocity -> IPitch -> MidiEvent
noteOff :: MidiChan -> MidiVelocity -> IPitch -> MidiEvent
test1 :: IO ()
playMidi :: MidiNotes n => FilePath -> Int -> [(Instrument, n)] -> IO ()
instance GHC.Internal.Enum.Bounded Fadno.Midi.MidiChan
instance GHC.Internal.Enum.Bounded Fadno.Midi.MidiProgram
instance GHC.Internal.Enum.Bounded Fadno.Midi.MidiTempo
instance GHC.Internal.Enum.Bounded Fadno.Midi.MidiTicks
instance GHC.Internal.Enum.Bounded Fadno.Midi.MidiVelocity
instance GHC.Internal.Enum.Enum Fadno.Midi.MidiChan
instance GHC.Internal.Enum.Enum Fadno.Midi.MidiProgram
instance GHC.Internal.Enum.Enum Fadno.Midi.MidiTempo
instance GHC.Internal.Enum.Enum Fadno.Midi.MidiTicks
instance GHC.Internal.Enum.Enum Fadno.Midi.MidiVelocity
instance GHC.Classes.Eq Fadno.Midi.MidiChan
instance GHC.Classes.Eq Fadno.Midi.MidiProgram
instance GHC.Classes.Eq Fadno.Midi.MidiTempo
instance GHC.Classes.Eq Fadno.Midi.MidiTicks
instance GHC.Classes.Eq Fadno.Midi.MidiVelocity
instance GHC.Internal.Real.Integral Fadno.Midi.MidiChan
instance GHC.Internal.Real.Integral Fadno.Midi.MidiProgram
instance GHC.Internal.Real.Integral Fadno.Midi.MidiTempo
instance GHC.Internal.Real.Integral Fadno.Midi.MidiTicks
instance GHC.Internal.Real.Integral Fadno.Midi.MidiVelocity
instance Fadno.Midi.MidiNotes [([Fadno.Midi.IPitch], Fadno.Midi.IDur)]
instance (GHC.Internal.Real.Integral p, GHC.Internal.Data.Traversable.Traversable c, GHC.Internal.Real.Integral d, GHC.Internal.Data.Traversable.Traversable t) => Fadno.Midi.MidiNotes (t (Fadno.Note.Note (c p) d))
instance (GHC.Internal.Real.Integral p, GHC.Internal.Real.Integral d, GHC.Internal.Data.Traversable.Traversable t) => Fadno.Midi.MidiNotes (t (Fadno.Note.Note p d))
instance GHC.Internal.Num.Num Fadno.Midi.MidiChan
instance GHC.Internal.Num.Num Fadno.Midi.MidiProgram
instance GHC.Internal.Num.Num Fadno.Midi.MidiTempo
instance GHC.Internal.Num.Num Fadno.Midi.MidiTicks
instance GHC.Internal.Num.Num Fadno.Midi.MidiVelocity
instance GHC.Classes.Ord Fadno.Midi.MidiChan
instance GHC.Classes.Ord Fadno.Midi.MidiProgram
instance GHC.Classes.Ord Fadno.Midi.MidiTempo
instance GHC.Classes.Ord Fadno.Midi.MidiTicks
instance GHC.Classes.Ord Fadno.Midi.MidiVelocity
instance GHC.Internal.Real.Real Fadno.Midi.MidiChan
instance GHC.Internal.Real.Real Fadno.Midi.MidiProgram
instance GHC.Internal.Real.Real Fadno.Midi.MidiTempo
instance GHC.Internal.Real.Real Fadno.Midi.MidiTicks
instance GHC.Internal.Real.Real Fadno.Midi.MidiVelocity
instance GHC.Internal.Show.Show Fadno.Midi.MidiChan
instance GHC.Internal.Show.Show Fadno.Midi.MidiProgram
instance GHC.Internal.Show.Show Fadno.Midi.MidiTempo
instance GHC.Internal.Show.Show Fadno.Midi.MidiTicks
instance GHC.Internal.Show.Show Fadno.Midi.MidiVelocity

module Fadno.Meter
type HasRatioNotes (t :: Type -> Type) n p = (Traversable t, HasNote n p Rational)

-- | use <a>rebar</a> with multiple input "bars".
rebars :: (HasRatioNotes b n p, HasRatioNotes c m p, Monoid p, Eq p, Monoid (c m), Monoid (b n), HasTimeSignature (c m), Snoc (c m) (c m) m m, HasTie m, Show (c m)) => TimeSignature -> [b n] -> [c m]

-- | Given a time signature and a "bar" (Traversable "b" of HasNotes "n"),
--   make new "bars" (Traversable "c" of HasNotes "m"), partitioning notes,
--   applying ties as needed, and decorating with the time signature.
rebar :: (HasRatioNotes b n p, HasRatioNotes c m p, Monoid p, Eq p, Monoid (c m), HasTimeSignature (c m), Snoc (c m) (c m) m m, HasTie m, Show (c m)) => TimeSignature -> b n -> [c m]

-- | <a>rebar</a> using <a>Bar</a> and 'Note'' for output.
rebar' :: (HasRatioNotes b n p, Monoid p, Eq p, Show p) => TimeSignature -> b n -> [Bar (Note' p Rational)]

-- | <a>rebars</a> using <a>Bar</a> and 'Note'' for output.
rebars' :: (HasRatioNotes b n p, Monoid (b n), Monoid p, Eq p, Show p) => TimeSignature -> [b n] -> [Bar (Note' p Rational)]

-- | Set tie if not a rest
tieMay :: (Eq a, Monoid a, HasNote s a d, HasTie s) => Tie -> s -> s

-- | Representable duration denominators.
--   
--   For standard base-2 durs, 2 and 4 are spurious as they reduce to 1,
--   thus 1 plus the "dot values" 3,7.
--   
--   For non-standard (quintuples etc), we admit 2 and 4 as well, for e.g.
--   2%5, a "half-note" under a quarter-quintuple. Anything greater
--   exceeding the understanding limit: 8%17 can certainly be represented
--   as a half-note, but it makes little sense to the reader.
validDenoms :: [Integer]

-- | Max representable duration.
maxDur :: Rational

-- | Test for representational duration per <a>validDenoms</a> and
--   <a>maxDur</a>.
validDur :: Rational -> Bool

-- | Tie rules that work across any denominators, such that 5%8 -&gt;
--   [1%2,1%8], 9%16 -&gt; [1%2,1%16], 11%16 -&gt; [1%2,3%16], 13%16 -&gt;
--   [3%2,1%16], 9%4 -&gt; [2,1%4].
splitDur :: Rational -> [Rational]

-- | Find split by 1) finding largest power-of-2 fraction under value or 2)
--   finding longest power-of-two denominator split, up to 8.
findSplit :: Rational -> Rational

-- | Apply rules in <a>splitDur</a> and tie affected notes.
tieRules :: (HasRatioNotes b n p, HasTie n, Monoid p, Eq p, Show n, HasRatioNotes c m p, HasTie m, Monoid (c m), Snoc (c m) (c m) m m) => b n -> c m

-- | Monomorphic-result 'tieRules
tieRules' :: (HasRatioNotes b n p, HasTie n, Monoid p, Eq p, Show n) => b n -> Bar (Note' p Rational)

-- | Weights and pulse values for pre-configured TSs.
data TsConfig
TsConfig :: TimeSignature -> Rational -> Rational -> TsConfig
[_tSig] :: TsConfig -> TimeSignature
[_tWeight] :: TsConfig -> Rational
[_tPulse] :: TsConfig -> Rational
tPulse :: Lens' TsConfig Rational
tSig :: Lens' TsConfig TimeSignature
tWeight :: Lens' TsConfig Rational
selectTimeSig :: HasRatioNotes t n p => [t n] -> Maybe TimeSignature

-- | Combine scores from phrases.
selectTimeSigs :: HasRatioNotes t n p => [t n] -> [(TimeSignature, Rational)]

-- | nutty heuristic that overweights a TS for a uniform duration divisor
preferDivisableHeads :: [[TsConfig]] -> [[TsConfig]]

-- | main heuristic is finding the common divisible duration, with
--   requirement that it must be greater than 1/4 the difference between
--   the durations. Hopefully avoids crappy tiny TSs like 2/8.
commonDivHeur :: Rational -> Rational -> Rational
tsConfigToDur :: TsConfig -> Rational

-- | Attempt to construct a TS config from duration
tsConfigFromDur :: Rational -> Rational -> Maybe TsConfig

-- | Pre-configured timesigs.
tsConfigs :: [TsConfig]

-- | Given a median note duration, minima for acceptable quanta.
minMedianDur :: Quanta -> Rational

-- | Given a phrase, select configs
selectTsConfigs :: HasRatioNotes t n p => t n -> [TsConfig]

-- | Filter and score time signatures per heuristics.
evalTsConfig :: HasRatioNotes t n p => t n -> TsConfig -> Maybe TsConfig

-- | <a>rem</a> for <a>RealFrac</a>
frem :: RealFrac a => a -> a -> a
isDivBy :: RealFrac a => a -> a -> Bool

-- | Compute percentage of notes falling on pulse values.
pulseCoverage :: HasRatioNotes t n p => Rational -> t n -> Rational
instance GHC.Classes.Eq Fadno.Meter.TsConfig
instance GHC.Internal.Show.Show Fadno.Meter.TsConfig

module Fadno.Util
diff :: Num a => [a] -> [a]
zipTail :: (a -> a -> c) -> [a] -> [c]
integ :: Int -> [Int] -> [Int]

-- | <a>trace</a> with brackets.
trace :: String -> a -> a

-- | trace with output of result.
trace' :: Show a => String -> a -> a

-- | trace with extra variable, not showing result.
trace1 :: Show b => String -> b -> a -> a

-- | trace with extra variable and output of result.
trace1' :: (Show a, Show b) => String -> b -> a -> a

-- | pop items off a stateful list, use for monadic function.
popping :: MonadState s m => Int -> Lens' s [a] -> ([a] -> m b) -> m b

-- | <a>popping</a> but only runs function if popped items are non-empty
popping' :: MonadState s m => Int -> Lens' s [a] -> ([a] -> m b) -> m (Maybe b)

-- | popping with only head
popping1 :: MonadState s m => Lens' s [a] -> (a -> m b) -> m (Maybe b)

-- | <a>succ</a> with wraparound.
wrapSucc :: (Bounded a, Enum a, Eq a) => a -> a

-- | <a>pred</a> with wraparound.
wrapPred :: (Bounded a, Enum a, Eq a) => a -> a

-- | do monadic <a>over</a> -- <a>(%=)</a> -- with pass-through of
--   (before,after)
mutating :: MonadState s m => Lens' s a -> (a -> a) -> m (a, a)

-- | reorganize <a>maybe</a> for chaining on Just
maybe' :: Maybe a -> b -> (a -> b) -> b
median :: Integral a => [a] -> Maybe a
normalize :: (Num a, Ord a) => [a] -> [a]
pitchClassSet :: Int -> [Int] -> [Int]
lfsr :: Int -> Int -> Int -> [Bool]

-- | generate <a>A</a> .. <a>Z</a>, <a>AA</a> .. <a>AZ</a>, <a>BA</a> ..
--   <a>BZ</a>, .. <a>AAA</a> etc
rehMarks :: [String]
rotate :: Int -> [a] -> [a]
rotations :: [a] -> [[a]]
allTuples :: Int -> [a] -> [[a]]
monotonic :: [Int] -> Bool
interleave :: [[a]] -> [a]
pivot :: [[a]] -> [[a]]
filterOnKeys :: Ord a => [a] -> Map a b -> Map a b
pairBy :: (a -> b) -> [a] -> [(a, b)]
delim :: String -> [String] -> String

module Fadno.Xml

-- | Partwise score.
xmlScore :: String -> String -> [(CmpPart, ScorePart)] -> ScorePartwise

-- | Render partwise part and score parts.
xmlPart :: MeasureList f => String -> String -> f Measure -> (CmpPart, ScorePart)

-- | Render partwise part with clef.
xmlPartClef :: MeasureList f => String -> String -> Clef -> f Measure -> (CmpPart, ScorePart)

-- | Partwise measure.
xmlMeasure :: Traversable t => String -> t ChxMusicData -> Measure

-- | Add datum to beginning of first measure
xmlPrependMeasureData :: MeasureList f => ChxMusicData -> f Measure -> f Measure

-- | Add data to beginning of first measure
xmlPrependMeasureDatas :: MeasureList f => [ChxMusicData] -> f Measure -> f Measure

-- | Add datum to beginning of last measure
xmlAppendMeasureData :: MeasureList f => ChxMusicData -> f Measure -> f Measure

-- | Add data to beginning of last measure
xmlAppendMeasureDatas :: MeasureList f => [ChxMusicData] -> f Measure -> f Measure

-- | Clef in bar
xmlClef :: (ApplyMonoid c ChxMusicData, HasClef a) => a -> c ChxMusicData

-- | Clef alone.
xmlClef' :: Clef -> ChxMusicData
xmlKeySignature :: Spelling -> ChxMusicData
toFifths :: Spelling -> Fifths

-- | Measure repeats for a single measure.
xmlRepeats :: (ApplyMonoid t ChxMusicData, HasRepeats a) => a -> t ChxMusicData

-- | Measure repeats bracketing existing measures.
xmlRepeats' :: (HasRepeats a, MeasureList f) => a -> f Measure -> f Measure

-- | Measure barlines.
xmlBarline :: (ApplyMonoid c ChxMusicData, HasBarline a) => a -> c ChxMusicData

-- | Measure barlines; flag determines if double bars are rendered to left
--   (False) or right (True).
xmlBarline' :: ApplyMonoid c ChxMusicData => Bool -> HasBarline a => a -> c ChxMusicData

-- | Measure time signature.
xmlTimeSig :: (ApplyMonoid t ChxMusicData, HasTimeSignature a) => a -> t ChxMusicData

-- | Measure rehearsal mark.
xmlRehearsalMark :: (ApplyMonoid t ChxMusicData, HasRehearsalMark a) => a -> t ChxMusicData

-- | Measure direction.
xmlDirection :: (ApplyMonoid t ChxMusicData, HasDirection a) => a -> t ChxMusicData

-- | render note/rest as xml
xmlNote :: HasNote a (Mono PitchRep) Rational => a -> ChxMusicData

-- | render notes as xml chord or rest.
xmlChord :: HasNote a [PitchRep] Rational => a -> [ChxMusicData]

-- | Add articulation to note.
xmlArticulation :: HasArticulation a => a -> ChxMusicData -> ChxMusicData

-- | Adapt a rendered note to account for tie information. &gt; xmlTie
--   testNote <a>$</a> xmlChord 128 testNote
xmlTie :: HasTie a => a -> ChxMusicData -> ChxMusicData

-- | Add beams, numbering from first beam in list, to note.
xmlBeams :: HasBeams a => a -> ChxMusicData -> ChxMusicData
xmlVoice :: HasVoice a => a -> ChxMusicData -> ChxMusicData
xmlSlur :: HasSlur a => a -> ChxMusicData -> ChxMusicData
renderFile :: EmitXml a => FilePath -> a -> IO ()
renderString :: XmlRep -> String
renderElement :: XmlRep -> Element
data Element

-- | Rational duration (ie, '1 % 4' for quarter note) to xml values.
convertDurR :: PositiveDivisions -> Rational -> (PositiveDivisions, NoteTypeValue, Int)

-- | Hardcoded divisions.
xmlDivisions :: PositiveDivisions
instance Fadno.Xml.HasChxMusicData Fadno.MusicXml.MusicXml31.ChxMusicData
instance Fadno.Xml.HasChxNote Fadno.MusicXml.MusicXml31.ChxNote
instance Fadno.Xml.HasCmpPart Fadno.MusicXml.MusicXml31.CmpPart
instance Fadno.Xml.HasEditorialVoice Fadno.MusicXml.MusicXml31.EditorialVoice
instance Fadno.Xml.HasGrpFullNote Fadno.MusicXml.MusicXml31.GrpFullNote
instance Fadno.Xml.HasIdentification Fadno.MusicXml.MusicXml31.Identification
instance Fadno.Xml.HasMeasure Fadno.MusicXml.MusicXml31.Measure
instance Fadno.Xml.HasMusicData Fadno.MusicXml.MusicXml31.MusicData
instance Fadno.Xml.HasNote Fadno.MusicXml.MusicXml31.Note
instance Fadno.Xml.HasPartList Fadno.MusicXml.MusicXml31.PartList
instance Fadno.Xml.HasScoreHeader Fadno.MusicXml.MusicXml31.ScoreHeader
instance Fadno.Xml.HasScorePartwise Fadno.MusicXml.MusicXml31.ScorePartwise
