hts 0.14 → 0.15
raw patch · 10 files changed
+91/−58 lines, 10 filesdep ~hmtPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: hmt
API changes (from Hackage documentation)
- Music.Typesetting.Literal.Dynamic: dynamic_mark :: Dynamic_Mark_T -> N_Annotation
- Music.Typesetting.Model: D_Laissez_Vibrer :: Direction_T
+ Music.Typesetting.Literal: dynamic_mark :: Dynamic_Mark_T -> N_Annotation
+ Music.Typesetting.Model: D_Rehearsal :: String -> Direction_T
+ Music.Typesetting.Model: D_Words :: Placement_T -> String -> Direction_T
+ Music.Typesetting.Output.MusicXML.Binding: rehearsal :: ELEM
+ Music.Typesetting.Process: n_remove_ties :: Note -> Note
Files
- Music/Typesetting/Ascribe.hs +12/−9
- Music/Typesetting/Literal.hs +13/−7
- Music/Typesetting/Literal/Dynamic.hs +2/−3
- Music/Typesetting/Model.hs +5/−3
- Music/Typesetting/Output/MusicXML.hs +16/−10
- Music/Typesetting/Output/MusicXML/Binding.hs +3/−0
- Music/Typesetting/Process.hs +7/−0
- Music/Typesetting/Query.hs +26/−18
- README +2/−3
- hts.cabal +5/−5
Music/Typesetting/Ascribe.hs view
@@ -5,26 +5,29 @@ import Music.Typesetting.Literal import Music.Typesetting.Model+import Music.Typesetting.Process import Music.Typesetting.Query -- | Predicate /or/. p_or :: (t -> Bool) -> (t -> Bool) -> t -> Bool p_or f1 f2 x = f1 x || f2 x --- | Drop annotation on repeated notes.+-- | Drop annotation on repeated notes, and do not tie rests. set_note_duration :: (T.Duration_A,Note) -> Note set_note_duration (d,n) = let (da_d,da_a) = d Note _ a = n a' = map from_d_annotation da_a- in case T.duration_a_tied_lr d of- (False,False) -> Note da_d (a ++ a')- (False,True) -> let fn = not . na_annotation_at_end_tied_only- in Note da_d (filter fn a ++ a')- (True,True) -> Note da_d (filter na_annotation_at_tied_either a ++ a')- (True,False) -> let fn = na_annotation_at_tied_either `p_or`- na_annotation_at_end_tied_only- in Note da_d (filter fn a ++ a')+ in if n_is_rest n+ then n_remove_ties (Note da_d (a ++ a'))+ else case T.duration_a_tied_lr d of+ (False,False) -> Note da_d (a ++ a')+ (False,True) -> let fn = not . na_annotation_at_end_tied_only+ in Note da_d (filter fn a ++ a')+ (True,True) -> Note da_d (filter na_annotation_at_tied_either a ++ a')+ (True,False) -> let fn = na_annotation_at_tied_either `p_or`+ na_annotation_at_end_tied_only+ in Note da_d (filter fn a ++ a') -- | Variant of 'T.mm_ascribe_chd' post-processed by 'set_note_duration'. mm_ascribe :: [[T.Duration_A]] -> [Note] -> [[Note]]
Music/Typesetting/Literal.hs view
@@ -1,12 +1,15 @@ module Music.Typesetting.Literal where -import Data.List-import Data.Maybe-import Data.Ratio+import Data.List {- base -}+import Data.Maybe {- base -}+import Data.Ratio {- base -}+ import Music.Theory.Clef {- hmt -}-import Music.Theory.Duration-import Music.Theory.Duration.Annotation-import Music.Theory.Duration.RQ+import Music.Theory.Duration {- hmt -}+import Music.Theory.Duration.Annotation {- hmt -}+import Music.Theory.Duration.RQ {- hmt -}+import Music.Theory.Dynamic_Mark {- hmt -}+ import Music.Typesetting.Model import Music.Typesetting.Query @@ -158,7 +161,7 @@ end_slide = N_End_Slide laissez_vibrer :: N_Annotation-laissez_vibrer = N_Direction D_Laissez_Vibrer+laissez_vibrer = N_Direction (D_Words Above "l.v.") fermata :: N_Annotation fermata = N_Fermata@@ -175,6 +178,9 @@ pedal_up = N_Direction (D_Pedal Pedal_Stop True False) pedal_change = N_Direction (D_Pedal Pedal_Change True False) pedal_continue = N_Direction (D_Pedal Pedal_Continue True False)++dynamic_mark :: Dynamic_Mark_T -> N_Annotation+dynamic_mark = N_Direction . D_Dynamic_Mark -- N_Dynamic_Mark -- * Parts, groups etc.
Music/Typesetting/Literal/Dynamic.hs view
@@ -2,10 +2,9 @@ module Music.Typesetting.Literal.Dynamic where import Music.Theory.Dynamic_Mark {- hmt -}-import Music.Typesetting.Model -dynamic_mark :: Dynamic_Mark_T -> N_Annotation-dynamic_mark = N_Direction . D_Dynamic_Mark -- N_Dynamic_Mark+import Music.Typesetting.Literal+import Music.Typesetting.Model niente,pppp,ppp,pp,p,mp,mf,f,ff,fff,ffff,fp,sfz :: N_Annotation niente = dynamic_mark Niente
Music/Typesetting/Model.hs view
@@ -5,6 +5,7 @@ import Music.Theory.Dynamic_Mark import Music.Theory.Key import Music.Theory.Pitch+import Music.Theory.Pitch.Note import Music.Theory.Tempo_Marking import Music.Theory.Time_Signature @@ -57,13 +58,14 @@ | Sound_Dynamics Double -- % of F (where F=90) deriving (Eq,Ord,Show) -data Direction_T = D_Dynamic_Mark Dynamic_Mark_T+data Direction_T = D_Rehearsal String+ | D_Words Placement_T String | D_Hairpin Hairpin_T- | D_Laissez_Vibrer- | D_Tempo_Marking Tempo_Marking+ | D_Dynamic_Mark Dynamic_Mark_T | D_Pedal {pedal_type :: Pedal_T ,pedal_line :: Bool ,pedal_sign :: Bool}+ | D_Tempo_Marking Tempo_Marking {- metronome -} deriving (Eq,Ord,Show) data Beam_T = Beam_Begin | Beam_Continue | Beam_End
Music/Typesetting/Output/MusicXML.hs view
@@ -1,21 +1,24 @@ module Music.Typesetting.Output.MusicXML where -import Data.Char-import Data.List-import Data.Maybe-import Data.Ratio-import Music.Typesetting.Model-import Music.Typesetting.Output.MusicXML.Binding+import Data.Char {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}+import Data.Ratio {- base -}+import qualified Text.XML.Light as X {- xml -}+ import qualified Music.Theory.Clef as T {- hmt -} import qualified Music.Theory.Duration as T import qualified Music.Theory.Duration.RQ as T import qualified Music.Theory.Dynamic_Mark as T import qualified Music.Theory.Key as T import qualified Music.Theory.Pitch as T+import qualified Music.Theory.Pitch.Note as T import qualified Music.Theory.Time_Signature as T import qualified Music.Theory.Tempo_Marking as T-import qualified Text.XML.Light as X {- xml -} +import Music.Typesetting.Model+import Music.Typesetting.Output.MusicXML.Binding+ x_clef_t :: T.Clef_T -> (String,Integer) x_clef_t c = case c of@@ -292,9 +295,12 @@ D_Hairpin T.End_Hairpin -> let ty = direction_type [] [wedge [type_A "stop"]] in Just (direction [x_placement_t Below] [ty])- D_Laissez_Vibrer ->- let ty = direction_type [] [words' [] [cdata "l.v."]]- in Just (direction [x_placement_t Above] [ty])+ D_Rehearsal str ->+ let ty = direction_type [] [rehearsal [] [cdata str]]+ in Just (direction [] [ty])+ D_Words plc str ->+ let ty = direction_type [] [words' [] [cdata str]]+ in Just (direction [x_placement_t plc] [ty]) D_Pedal pt _ _ -> let ty = direction_type [] [pedal [x_pedal_type pt]] in Just (direction [x_placement_t Below] [ty])
Music/Typesetting/Output/MusicXML/Binding.hs view
@@ -62,6 +62,9 @@ wedge :: EMPTY_ELEM wedge = mk_empty_elem "wedge" +rehearsal :: ELEM+rehearsal = mk_elem "rehearsal"+ words' :: ELEM words' = mk_elem "words"
Music/Typesetting/Process.hs view
@@ -16,6 +16,13 @@ -- * Note +-- | Remove any tie annotations at note+n_remove_ties :: Note -> Note+n_remove_ties (Note d a) =+ let f e = e == N_End_Tied || e == N_Begin_Tied+ a' = filter (not . f) a+ in Note d a'+ -- | Process a 'Note' sequence adding 'D_End_Hairpin' annotations as -- required, ie. where there is an open hairpin annotation and a -- 'Note' has a dyamic annotation without a close hairpin annotation.
Music/Typesetting/Query.hs view
@@ -1,15 +1,17 @@ module Music.Typesetting.Query where -import Data.Function-import Data.List-import Data.Maybe+import Data.Function {- base -}+import Data.List {- base -}+import Data.Maybe {- base -}+ import Music.Theory.Dynamic_Mark {- hmt -}-import Music.Theory.Duration-import Music.Theory.Duration.Name-import Music.Theory.Duration.RQ-import Music.Theory.Pitch-import Music.Theory.Tempo_Marking-import Music.Theory.Time_Signature+import Music.Theory.Duration {- hmt -}+import Music.Theory.Duration.Name {- hmt -}+import Music.Theory.Duration.RQ {- hmt -}+import Music.Theory.Pitch {- hmt -}+import Music.Theory.Tempo_Marking {- hmt -}+import Music.Theory.Time_Signature {- hmt -}+ import Music.Typesetting.Model -- * Note annotation@@ -52,6 +54,7 @@ data At_Tied = At_End_Tied | At_Either_Tied | At_Begin_Tied deriving (Eq,Enum,Ord,Show) +-- | Determines where an annotation is placed at tied notes. na_annotation_at_tied :: N_Annotation -> At_Tied na_annotation_at_tied a = let err = error (show ("na_annotation_at_tied",a))@@ -64,8 +67,8 @@ N_Notehead _ -> At_Either_Tied N_Staff _ -> At_Either_Tied N_Beam _ _ -> At_Either_Tied- N_Begin_Tied -> err- N_End_Tied -> err+ N_Begin_Tied -> At_End_Tied+ N_End_Tied -> At_Begin_Tied N_Begin_Slur -> At_Begin_Tied N_End_Slur -> At_End_Tied N_Begin_Tuplet _ -> err@@ -84,7 +87,9 @@ N_Direction (D_Hairpin Crescendo) -> At_Begin_Tied N_Direction (D_Hairpin Diminuendo) -> At_Begin_Tied N_Direction (D_Hairpin End_Hairpin) -> At_End_Tied- N_Direction D_Laissez_Vibrer -> At_End_Tied+ N_Direction (D_Words Above "l.v.") -> At_End_Tied+ N_Direction (D_Words _ _) -> At_Begin_Tied+ N_Direction (D_Rehearsal _) -> At_Begin_Tied N_Direction (D_Tempo_Marking _) -> At_Begin_Tied N_Direction (D_Pedal {}) -> At_Begin_Tied N_Voice _ -> At_Either_Tied@@ -108,16 +113,19 @@ n_is_chord_elem = n_has_annotation N_Chord n_is_untied :: Note -> Bool-n_is_untied n = not (n_has_annotation N_Begin_Tied n ||- n_has_annotation N_End_Tied n)+n_is_untied n =+ not (n_has_annotation N_Begin_Tied n ||+ n_has_annotation N_End_Tied n) n_is_initial_tie :: Note -> Bool-n_is_initial_tie n = n_has_annotation N_Begin_Tied n &&- not (n_has_annotation N_End_Tied n)+n_is_initial_tie n =+ n_has_annotation N_Begin_Tied n &&+ not (n_has_annotation N_End_Tied n) n_is_final_tie :: Note -> Bool-n_is_final_tie n = n_has_annotation N_End_Tied n &&- not (n_has_annotation N_Begin_Tied n)+n_is_final_tie n =+ n_has_annotation N_End_Tied n &&+ not (n_has_annotation N_Begin_Tied n) n_pitch :: Note -> Maybe Pitch n_pitch (Note _ as) =
README view
@@ -4,14 +4,13 @@ A [haskell][hs] music notation model with output to [MusicXML][music-xml]. -See [hly][hly] for an alternative writing to [lilypond][ly].+See [hly](?t=hly) for an alternative writing to [lilypond][ly]. [hs]: http://haskell.org/ [music-xml]: http://www.makemusic.com/musicxml/-[hly]: http://rd.slavepianos.org/?t=hly [ly]: http://lilypond.org/ -© [rohan drape][rd], 2010-2013, [gpl][gpl].+© [rohan drape][rd], 2010-2014, [gpl][gpl]. [rd]: http://rd.slavepianos.org/ [gpl]: http://gnu.org/copyleft/
hts.cabal view
@@ -1,22 +1,22 @@ Name: hts-Version: 0.14+Version: 0.15 Synopsis: Haskell Music Typesetting Description: A simple music typesetting model in haskell License: GPL Category: Music-Copyright: (c) Rohan Drape, 2010-2013+Copyright: (c) Rohan Drape, 2010-2014 Author: Rohan Drape Maintainer: rd@slavepianos.org Stability: Experimental-Homepage: http://rd.slavepianos.org/?t=hts-Tested-With: GHC == 7.6.1+Homepage: http://rd.slavepianos.org/t/hts+Tested-With: GHC == 7.8.2 Build-Type: Simple Cabal-Version: >= 1.8 Data-Files: README Library Build-Depends: base == 4.*,- hmt==0.14.*,+ hmt == 0.15.*, xml GHC-Options: -Wall -fwarn-tabs Exposed-modules: Music.Typesetting.Ascribe