Module

Data.Abc.Accidentals

Package
purescript-abc-parser
Repository
newlandsvalley/purescript-abc-parser

Accidentals are a set of mappings from a PitchClass to an Accidental They are useful, for example, when interpreting a bar of music where the accidental nature of a note may depend on the existence of a previous note of the same pitch within the bar.

#Accidentals Source

type Accidentals = Map PitchClass Accidental

A set of accidentals

#empty Source

empty :: Accidentals

create an empty set of Key Accidentals

#add Source

add :: PitchClass -> Accidental -> Accidentals -> Accidentals

add an accidental to the set

#fromKeySet Source

fromKeySet :: KeySet -> Accidentals

build Accidentals from a KeySet

#lookup Source

lookup :: PitchClass -> Accidentals -> Maybe Accidental

lookup a pitch class and see of it exists in the Accidentals set

#member Source

member :: Pitch -> Accidentals -> Boolean

lookup a KeyAccidental (represented as a Pitch) and see if it's a member of the Accidentals set (i.e. the value of the Accidental matches for the supplied pitch)

#fromKeySig Source

fromKeySig :: KeySignature -> Pitch

extract the KeyAccidental Pitch from a KeySignature

#implicitInKeySet Source

implicitInKeySet :: PitchClass -> KeySet -> Maybe Accidental

Return an accidental if it is implicitly there in the supplied KeySet (which is obtained from a key signature) attached to the pitch class of the note. In ABC, notes generally inherit their (sharp, flat or natural) accidental nature from the key signature.