packages feed

music-preludes 1.3 → 1.3.1

raw patch · 10 files changed

+140/−152 lines, 10 filesdep +lilyponddep +music-preludesdep −HUnitdep −QuickCheckdep −test-framework

Dependencies added: lilypond, music-preludes

Dependencies removed: HUnit, QuickCheck, test-framework, test-framework-quickcheck, test-framework-th

Files

+ examples/complex.hs view
@@ -0,0 +1,34 @@++module Main where++import Prelude+import System.Process (runCommand)+import Music.Prelude.StringQuartet++main = do+    -- writeMidi "test.mid" score+    -- writeXml "test.xml" $ score^/4+    -- openXml score+    openLy score+    -- playMidiIO "Graphic MIDI" $ score^/10+++-- infixr 7 //+-- (//) = flip times++score :: Score Note+score = test 1 </> test 2++test 1  = group 5 c |> c^*3                  +test 2  = group 3 c |> c^*3                  +test 3  = group 3 c |> group 5 c |> group 3 c |> group 7 c+test 4  = group 3 c |> group 5 c |> c |> group 7 c+test 5  = c |> group 5 c |> c |> group 7 c+-- all above ok+++test 8 = times 5 c^/5 |> times 3 c^/3 -- ok+test 9 = times 4 c^/5 |> c^*(1/5+1/3)    -- not ok, needs to be bound from last quintuplet note++test 99 = group 5 c |> group 3 c |> c^*2+
examples/duo.hs view
@@ -1,4 +1,6 @@ +module Main where+ import System.Process (runCommand) import Music.Prelude.StringQuartet 
− examples/erlkonig.hs
@@ -1,31 +0,0 @@--import System.Process (runCommand)-import Music.Prelude.Basic--main = do-    -- writeMidi "test.mid" score-    -- writeXml "test.xml" $ score^/4-    -- openXml score-    openLy score-    -- playMidiIO "Graphic MIDI" $ score^/10--score :: Score Note-score = let-        up x = fmap (modifyPitch (+ x))-        down x = fmap (modifyPitch (subtract x))          -        triplet = group 3-        melody = scat-        rest = return Nothing-        octave = 12--        a `x` b = a^*(3/4) |> b^*(1/4)-        a `l` b = (a |> b)^/2-    -        motive = (legato $ stretchTo 2 $ melody [g,a,bb,c',d',eb']) |> staccato (d' |> bb |> g)-        bar    = rest^*4 :: Score (Maybe Note)--        song    = mempty-        left    = times 4 (times 4 $ removeRests $ triplet g)-        right   = removeRests $ times 2 (delay 4 motive |> rest^*3)--    in  stretch (1/4) $ times 10 $ song </> left </> down octave right
examples/triplets.hs view
@@ -1,6 +1,11 @@ +{-# LANGUAGE TypeFamilies #-}+ import System.Process (runCommand)-import Music.Prelude.StringQuartet+import Music.Prelude.Basic+import Music.Pitch -- DEBUG+import qualified Music.Lilypond as Lilypond -- DEBUG+import qualified Music.Score as Score  main = do     -- writeMidi "test.mid" score@@ -9,14 +14,28 @@     openLy score     -- playMidiIO "Graphic MIDI" $ score^/10 -subject = legato $ accent $ scat [c',cs'^*2]+subject = legato $ accent $ scat [c,cs^*2,d,db]  score :: Score Note-score =-    (times 5 $ subject ^*(2/3 * 1/4)) +score = +    (times 5 $ up _P5   $ subject ^*(2/3 * 1/4))          </>-    (times 5 $ subject ^*(1/4)) +    (times 5 $ up _M3   $ subject ^*(1/4))          </>-    (times 5 $ subject ^*(2/3 * 1/2)) +    (times 5 $ up _P1   $ subject ^*(2/3 * 1/2))          </>-    (times 5 $ subject ^*(1/2)) +    (times 5 $ down _P4 $ subject ^*(1/2)) +++-- TODO++instance HasPitch Pitch where { type Pitch Pitch = Pitch ; getPitch = id; modifyPitch = id }++instance Tiable Pitch where { beginTie = id ; endTie = id }+instance HasLilypond Pitch where+    getLilypond d p = Lilypond.note (Lilypond.NotePitch (Lilypond.Pitch (pc,acc,oct+5)) Nothing) ^*(fromDurationT $ d*4)+        where+            pc  = toEnum $ fromEnum $ name p+            acc = fromIntegral $ accidental p+            oct = fromIntegral $ octaves (p .-. c)+            
music-preludes.cabal view
@@ -1,7 +1,7 @@  name:               music-preludes-version:            1.3-cabal-version:      >= 1.8+version:            1.3.1+cabal-version:      >= 1.10 author:             Hans Hoglund maintainer:         Hans Hoglund license:            BSD3@@ -16,6 +16,10 @@      This library is part of the Music Suite, see <http://musicsuite.github.com>. +source-repository head+  type:             git+  location:         git://github.com/hanshoglund/music-preludes.git+   library                         build-depends:          base >= 4 && < 5,@@ -32,45 +36,89 @@         music-dynamics-literal              hs-source-dirs: src+    default-language: Haskell2010     exposed-modules:         Music.Prelude.Basic         Music.Prelude.Piano         Music.Prelude.StringQuartet  executable "complex"+    build-depends: +        base >= 4 && < 5,+        process,+        lilypond,+        musicxml2,+        music-pitch,+        music-score,+        music-preludes     hs-source-dirs: src examples-    main-is: duo.hs+    default-language: Haskell2010+    main-is: complex.hs  executable "duo"+    build-depends: +        base >= 4 && < 5,+        process,+        lilypond,+        musicxml2,+        music-pitch,+        music-score,+        music-preludes     hs-source-dirs: src examples+    default-language: Haskell2010     main-is: duo.hs -executable "erlkonig"-    hs-source-dirs: src examples-    main-is: erlkonig.hs+-- executable "erlkonig"+--     build-depends: +--         base >= 4 && < 5,+--         process,+--         lilypond,+--         musicxml2,+--         music-pitch,+--         music-score,+--         music-preludes+--     hs-source-dirs: src examples+--     default-language: Haskell2010+--     main-is: erlkonig.hs  executable "triplets"+    build-depends: +        base >= 4 && < 5,+        process,+        lilypond,+        musicxml2,+        music-pitch,+        music-score,+        music-preludes     hs-source-dirs: src examples-    main-is: triplets.hs+    default-language: Haskell2010+    main-is: triplets.hs     -executable "music2ly"-    hs-source-dirs: src examples-    main-is: music2ly.hs-executable "music2midi"-    hs-source-dirs: src examples-    main-is: music2midi.hs-executable "music2musicxml"-    hs-source-dirs: src examples-    main-is: music2musicxml.hs -test-suite properties-    type: exitcode-stdio-1.0-    main-is: properties.hs-    hs-source-dirs: tests-    ghc-options: -w -threaded -rtsopts -with-rtsopts=-N-    build-depends:-        HUnit                       >= 1.2,-        QuickCheck                  >= 1.2 && < 1.3,-        test-framework              >= 0.6,-        test-framework-th           >= 0.2,-        test-framework-quickcheck   >= 0.3+-- executable "music2ly"+--     hs-source-dirs: src examples+--     default-language: Haskell2010+--     main-is: music2ly.hs+--+-- executable "music2midi"+--     hs-source-dirs: src examples+--     default-language: Haskell2010+--     main-is: music2midi.hs+--+-- executable "music2musicxml"+--     hs-source-dirs: src examples+--     default-language: Haskell2010+--     main-is: music2musicxml.hs+-- +-- test-suite properties+--     type: exitcode-stdio-1.0+--     main-is: properties.hs+--     hs-source-dirs: tests+--     default-language: Haskell2010+--     ghc-options: -w -threaded -rtsopts -with-rtsopts=-N+--     build-depends:+--         HUnit                       >= 1.2,+--         QuickCheck                  >= 1.2 && < 1.3,+--         test-framework              >= 0.6,+--         test-framework-th           >= 0.2,+--         test-framework-quickcheck   >= 0.3
src/Music/Prelude/Basic.hs view
@@ -10,7 +10,8 @@         asScore   ) where -import Music.Score+import Music.Score hiding (Pitch)+import Music.Pitch import Data.Typeable  asScore :: Score Note -> Score Note@@ -30,4 +31,4 @@  type Note = (PartT BasicPart (TieT     (TremoloT (HarmonicT (SlideT-        (DynamicT (ArticulationT (TextT Integer))))))))+        (DynamicT (ArticulationT (TextT {-Integer-}Pitch))))))))
− src/music2ly.hs
@@ -1,44 +0,0 @@--import Control.Exception-import Control.Monad (when)--- import Control.Monad.Error hiding (mapM)--- import Control.Monad.Plus hiding (mapM)--- import Data.Semigroup hiding (Option)--- import Data.List (find)--- import Data.Maybe (fromMaybe, maybeToList)--- import Data.Traversable (mapM)--- import Data.Typeable-import System.IO-import System.Exit-import System.Environment-import System.Console.GetOpt--import Prelude hiding (readFile, writeFile)--main :: IO ()-main = do-    (opts, args, optErrs) <- getOpt Permute options `fmap` getArgs--    let usage = usageInfo (header "music2ly") options-    let printUsage   = putStr (usage ++ "\n")   >> exitSuccess-    let printVersion = putStr (version "music2ly" ++ "\n") >> exitSuccess--    when (1 `elem` opts) printUsage-    when (2 `elem` opts) printVersion-    printVersion--version name = name ++ "-0.8"-header  name = "Usage: "++name++" [options]\n" ++-               "Usage: "++name++" [options] files...\n" ++-               "\n" ++-               "Options:"--options = [-    Option ['h'] ["help"]          (NoArg 1)   "Print help and exit",-    Option ['v'] ["version"]       (NoArg 2)   "Print version and exit"-  ]----- Load the file into the interpreter--- Get the 'score' variable--- Run (writeLy path score)
− src/music2midi.hs
@@ -1,2 +0,0 @@--main = putStrLn "music2midi"
− src/music2musicxml.hs
@@ -1,2 +0,0 @@--main = putStrLn "music2musicxml"
− tests/properties.hs
@@ -1,37 +0,0 @@--{-# LANGUAGE -    FlexibleInstances-    #-}--module Main where--import Test.Framework (defaultMain, testGroup)-import Test.Framework.Providers.QuickCheck (testProperty)-import Test.QuickCheck--import Music.Score--import Data.List--main = defaultMain tests--tests = [-        testGroup "Sorting Group 1" [-                testProperty "duration :: Score" prop_durationScore,-                testProperty "duration :: Track" prop_durationTrack-            ]-        ]---prop_durationScore a = offset a .-. onset a == duration a-    where -      types = (-        a :: Score ()-        )--prop_durationTrack a = offset a .-. onset a == duration a-    where -      types = (-        a :: Track ()-        )-