music-parts 1.2 → 1.3
raw patch · 2 files changed
+72/−2 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- music-parts.cabal +2/−2
- src/Music/Parts.hs +70/−0
music-parts.cabal view
@@ -1,6 +1,6 @@ name: music-parts-version: 1.2+version: 1.3 cabal-version: >= 1.2 author: Hans Hoglund maintainer: Hans Hoglund@@ -14,7 +14,7 @@ description: Abstract representation of musical parts and instruments. - This library is part of the Haskell Music Suite, see <http://musicsuite.github.com>.+ This library is part of the Music Suite, see <http://musicsuite.github.com>. library build-depends:
src/Music/Parts.hs view
@@ -1,2 +1,72 @@ module Music.Parts where+ +{-+ ## Terminology: Voice vs Part+ + A voice is a container of notes (non-overlapping)+ + A part is an identifier for a set of singers/musicians AND all the notes in a score+ designated for this set of performers. Part extraction has the type+ + extractParts :: HasPart a => Score a -> [Score a]+ + I.e. in a score for piano and ensemble, certain notes may be *in the piano part*, i.e.+ designated for the piano. Typically, a part is monophonic or polyphonic. A monophonic+ part is a voice, i.e.++ -- | Are there overlapping notes?+ isMonophonic :: Score a -> Bool++ -- | Fails for polyphonic scores.+ scoreToVoice :: Score a -> Voice (Maybe a)+ + A polyphonic part contains several voices, i.e.++ scoreToVoices :: Score a -> [Voice (Maybe a)] +++ A part is any type a that satisfies (Ord a, Show a).+ Optionally, we may add a contraint (HasPartName a), i.e.++ class HasPartName a where+ partName :: a -> String+ partAbbr :: a -> String+ + + These contraints are used when printing scores (to get the order of the parts and their name).++ Vln1, Vln2 etc.++ Often we want to group parts, i.e.++ Chorus {+ Sop { Sop1 Sop2 }+ Alto { Alto1 Alto2 }+ Ten { Ten1 Ten 2 }+ Bass { Bass1 Bass2 }+ }+ Orchestra {+ Woodwinds { ... }+ Brass { ... }+ Perc { ... }+ Strings { ... }+ }+++ isInGroup :: Group -> Part -> Bool+ partGroups :: Part -> [Group]+++ partGroup :: (Part -> [Group] -> a) -> Group -> a+ tree :: (a -> [Tree a] -> b) -> Tree a -> b+ + + data MyPart+ = Fl+ | Sop+ | Vl1+ | Vl2+ | Pno++-}