temporal-music-notation 0.1.2 → 0.1.3
raw patch · 7 files changed
+2/−527 lines, 7 filesdep −type-level-natural-number-decimal
Dependencies removed: type-level-natural-number-decimal
Files
- examples/Orchestra.hs +0/−89
- examples/Readme.hs +0/−31
- examples/arpeggi.hs +0/−78
- examples/choral.hs +0/−248
- examples/dm.hs +0/−29
- examples/teardrop.hs +0/−41
- temporal-music-notation.cabal +2/−11
− examples/Orchestra.hs
@@ -1,89 +0,0 @@--- | csound instruments-module Orchestra-where--import CsoundExpr.Base-import qualified CsoundExpr.Opcodes as C--import Temporal.Music.Notation-import Temporal.Music.Notation.Local.Western ---type Score' = Score NoteW--type CsdNote = (Amp, Cps)--type Amp = Irate-type Cps = Irate---- | converts note representation to csound values-absCsdNote :: NoteW -> CsdNote-absCsdNote x = (double amp, double cps)- where (amp, cps) = absNote x---- | converts note representation to csound values-absCsdDrum :: DrumW-> Amp-absCsdDrum = double . absDrum--ftsin = gen10 8192 [1]---- csound instruments--bassDrum :: (Irate, Irate) -> SignalOut-bassDrum (amp, pch) = C.out $ C.oscilA [] env cps ftsin- where env = amp ^* C.exponA 1 0.2 0.001- cps = C.exponK pch 0.2 20--openHiHat :: Irate -> SignalOut-openHiHat amp = C.out $ C.buthp [] sig (num 7000)- where sig = fst $ se1 $ C.noise env (num 0)- env = amp ^* C.exponA 1 1.5 0.001 --pluckInstr :: (Irate, Irate) -> SignalOut -pluckInstr (amp, pch) = outList [- C.out $ env <*> C.wgpluck2 0.75 amp pch (num 0.75) (num 0.5), - C.xtratim 1]- where env = C.linsegrK [0, idur * 0.05, 1, idur * 0.9, 1] 1 0 ---pipeOrgan :: CsdNote -> SignalOut-pipeOrgan (amp, cps) = C.out sig- where ft = ftsin- outch1 = num 1- outch2 = num 2- atk = num 10- op1f = cps- op2f = 2.01 * cps- op3f = 3.99 * cps- op4f = 8 * cps- op5f = 0.5 * cps- op7f = 16 * cps- dclick = C.linsegK [0, 0.001, amp, idur-0.002, amp, 0.001, 0]- amp1 = C.linsegK [0, 0.01, 1, idur-0.02, 1, 0.01, 0]- amp2 = C.linsegK [0, 0.05, 1, 0.1, 0.7, idur-0.16, 0.7, 0.01, 0]- amp3 = C.linsegK [0, 0.03, 0.8, 0.05, 0, 0.01, 0]- amp4 = C.linsegK [0, 0.1, 0.3, 0.1, 0.05, idur-0.3, 0.1, 0.1, 0]- op8 = C.oscilA [] amp4 op5f ft- p1 = op8 + 1- op1 = C.oscilA [] amp1 (op1f ^* p1) ft- op2 = C.oscilA [] amp2 (op2f ^* p1) ft- op3 = C.oscilA [] amp2 (op3f) ft- op4 = C.oscilA [] amp2 (op4f) ft- op5 = C.oscilA [] amp3 (op5f * 5) ft- op7 = C.oscilA [] amp2 (op7f) ft- sig = (dclick <*>) $ op1 + op2 + op3 + op3 + op4 + op5 + op7---- instruments on notes-----bassDrum', pipeOrgan', guitar :: Score NoteW -> Score SignalOut -openHiHat' :: Score DrumW -> Score SignalOut--bassDrum' = fmap (bassDrum . absCsdNote) . setDiapason (1e3, 1.5 * 1e4)-openHiHat' = fmap (openHiHat . absCsdDrum) . setDiapason (1e3, 1.0 * 1e4)--pipeOrgan' = fmap (pipeOrgan . absCsdNote) . setDiapason (1e2, 5*1e3)-guitar = fmap (pluckInstr . absCsdNote). setDiapason (1000, 1.5*1e4) - . lower 1--
− examples/Readme.hs
@@ -1,31 +0,0 @@--- Examples------ In this folder you can find some examples for 'temporal-music-notation'--- package. It can produce no sound but can combine events in--- functional way. Package 'csound-expression' is responsible for --- sound output. 'csound-expression' allows to construct csounds '.csd' --- files from haskell. See Orchestra.hs to see how it can be done.------ warning : external libraries are used--- 'temporal-music-notation', 'temporal-music-notation-western',--- and 'csound-expression'------ If you have installed only 'temporal-music-notation', --- to run examples make first: ------ cabal update--- cabal install temporal-music-notation-western--- cabal install csound-expression------ Sound is produced with csound language. --- 'temporal-music-notation' combines --- notes tigether. Output of the example is out.csd--- file, which is for csound. ------ If you are not familliar with csound. Csound is--- language for musical composition and sound synthesis.--- It can be downloaded here <http://csounds.com>.--- Run csound on out.csd to hear result finally.------ >csound out.csd-
− examples/arpeggi.hs
@@ -1,78 +0,0 @@--- radiohead - weird fishes (intro)--import CsoundExpr.Base(csd, play, headerMono)--import Temporal.Music.Notation-import Temporal.Music.Notation.Local.Western --import Orchestra(guitar)---- accent every fourth beat-beat = cycle [accent 0.5, id, id, id]---- chords--guitarChord1, guitarChord2, guitarChord3 :: [Tone N12] -> Score NoteW---- guitar 1--guitarChord1 = line . zipWith ($) beat . map en . concat . replicate 10--ch11 = [high d, g, e]-ch12 = map (step wholeTone) ch11-ch13 = [high a, a, high cs]-ch14 = [high fs, b, g]--chSeq1 = [ch11, ch12, ch13, ch14]---- guitar 2--guitarChord2 = - line . zipWith ($) beat . map en . - concat . replicate 6 . arpeggi . map high- where arpeggi x = x ++ take 2 x---ch21 = [low g, d, e]-ch22 = map (step wholeTone) ch21-ch23 = [cs, e, a]-ch24 = [d, g, e]--chSeq2 = [ch21, ch22, ch23, ch24]---- guitar 3--guitarChord3 = - line . zipWith ($) beat . map en . - concat . replicate 6 . arpeggi . map high- where arpeggi x = take 2 x ++ x--ch31 = [e, g, b]-ch32 = map (step wholeTone) ch31-ch33 = [fs, a, high cs]-ch34 = [high d, g, b]--chSeq3 = [ch31, ch32, ch33, ch34]---- score--scoG1 = mfl $ line $ map guitarChord1 chSeq1-scoG2 = pl $ line $ map guitarChord2 chSeq2-scoG3 = pppl $ line $ map guitarChord3 chSeq3---scoG2intro = slice (3*30/8) (4*30/8) scoG2--intro = chord [scoG1, scoG3, delay (3*30/8) scoG2intro]-chords = loop 3 $ chord [scoG1, scoG2, scoG3] --sco = bpm (presto 0.4) $ guitar $ intro +:+ chords--file = "out.csd"-flags = "-d"--out = csd flags headerMono $ renderScore sco--main = writeFile file $ show out---main = play "totem" "tmp" "new" out-
− examples/choral.hs
@@ -1,248 +0,0 @@--- J.S. Bach - Choral prelude F-moll 'Ich ruf zu dir Herr Jesu Christ'--import Temporal.Music.Notation-import Temporal.Music.Notation.Local.Western--import CsoundExpr(headerMono, csd, play) --import Orchestra(pipeOrgan')---- alto dynamics--up :: Double -> [Tone N12] -> Score NoteW-up x = dynamicRel [x, x + accDiap] . line . map sn --down :: Double -> [Tone N12] -> Score NoteW-down x = dynamicRel [x + accDiap, x] . line . map sn --upDown :: Double -> [Tone N12] -> Score NoteW-upDown x = dynamicRel [x, x + accDiap, x] . line . map sn --downUp :: Double -> [Tone N12] -> Score NoteW-downUp x = dynamicRel [x, x-accDiap, x] . line . map sn --flat :: Double -> [Tone N12] -> Score NoteW-flat x = accent x . line . map sn--accDiap = 0.5------------------------------------------------------- solo---- Part I--solo0 = qn $ high c--solo1 = line [--- 1 bar- qn ab, qn bb, den ab, sn g, den f, sn g,--- 2 bar- dynamicRel [0, 0.2, 0] $ line [line $ map sn [ab, bb, ab, bb],- trill 3 (accent 0.2 $ tn $ high c) (tn bb), tn ab, tn bb], - high $ line [accent 0.2 $ qn $ c, den c, sn db, --- 3 bar- qn eb, tn db, stretch (1/4 - 3/32) $ wn c, - sn $ low bb, qn $ low ab, en $ low bb, en c] - ]--solo11 = high $ line [- stretch (1/4 + 1/16) $ wn db, - line $ map tn [eb, f, eb, db], sn c, qn c, qn c]---solo12 = high $ line [- qn db, sn db,- line $ map tn [eb, f, eb, db],sn c, qn c, qn eb]-- -soloI = line [solo0, reprise solo1 solo11 solo12]----- Part II--solo21 = high $ line [--- 1 bar- qn f, en eb, tn db, tn c, sn db,- low $ line $ map en [high c, bb, ab, bb],--- 2 bar- qn c, qn c, qn $ low bb, qn $ low ab,--- 3 bar- low $ line [hn g, hn f, --- 4 bar - qn ab, qn g, hn f]- ]--solo22 = line [--- 5 bar- dhn eb, qn eb,--- 6 bar- qn ab, qn ab, qn bb, qn bb,--- 7 bar - high $ line [dhn c, qn db],--- 8 bar- high $ qn c, qn bb, qn ab, den f, sn g,--- 9 bar- qn ab, qn g, qn f- ]--soloII = solo21 +:+ solo22--solo = pedal (1/128) $ ppl $ soloI +:+ soloII-------------------------------------------------------- alto---- Part I--alto0 = high $ up 0 [low ab, c, f, e] --alto1 = line [--- 1 bar- high $ down 0.5 [f, c, low ab, low f], - upDown 0 [g, bb, high db, high c],- upDown 0 [f, ab, high c, bb],- downUp 0 [ab, f, ab, high c],---- 2 bar- high $ downUp 0.2 [f, e, f, ab],- high $ down 0 [g, f, e, f],- high $ downUp 0 [e, c, low g, low bb, low ab, c, f, ab],---- 3 bar- high $ flat 0 [g, eb, ab, g],- high $ up 0 [ab, eb, f, gb, f, db, f, ab, g, db, c, gb]- ] --alto11 = high $ line [- upDown 0 [f, low bb, db, f, bb, ab, g, ab, g, c, e, low bb],- upDown 0 [low f, c, f, e]- ]--alto12 = high $ line [- upDown 0 [f, low bb, db, f, bb, ab, g, ab],- down 0 [g, low bb, low ab, f, low g, db, low ab, c]- ]-- -altoI = line [alto0, reprise alto1 alto11 alto12]---- Part II--alto21 = high $ line [--- 1 bar- upDown 0 [- low ab, c, low bb, db, low bb, db, ab, g, - ab, eb, db, g, c, f, ab, g],--- 2 bar- down (-accDiap) [- ab, eb, low ab, gb, f, low ab, low g, db, - c, low ab, c, eb, g, c, low bb, g,--- 3 bar - db, f, g, f],- up (-accDiap) [- e, low bb, db, c,- low ab, c, f, e, f, c, low ab, low f],--- 4 bar- flat 0 [- low bb, f, g, f, low bb, eb, f, eb,- c, eb, f, eb, d, low g, low b, d- ]- ]--alto22 = high $ line [--- 5 bar- down (-accDiap) $ [- low g, c, eb, db, low g, low bb, db, c] ++- map low [eb, ab, high c, bb, high db, bb, c, high db,--- 6 bar- f, ab, high db, high c, f, ab, high c, bb, - f, ab, bb, ab, g, bb, high db, high c],---- 7 bar- up (-accDiap) [- low ab, c, eb, ab, eb, bb, high c, bb,- a, eb, gb, low a, low bb, g, low ab, f- ],---- 8 bar- down (-accDiap) [- low ab, eb, d, eb, low f, db, eb, db, - low eb, c, db, c, low bb, f, g, f,--- 9 bar- d, f, g, f, e, db, low bb, low g, - low a, c]-- ]--alto23 = en $ high f--altoII = line [alto21, alto22, alto23]--alto = pedal (1/132) $ lower 3 $ pl $ line [altoI, altoII]---------------------------------------------------------------- bass ---- Part I--bass0 = lower 1 $ line [en f, en f]--bass1 = (line $ map en [--- 1 bar- f, f, f, e, f, f, f, eb,--- 2 bar- db, db, db, db, c, c, f, f]) +:+--- 3 bar- (high $ line $ map en [c, c, c, c, c, c, low bb, low a])--bass11 = line $ map en [bb, ab, g, f, e, c, low f, low f]--bass12 = line $ map en [bb, ab, g, f, e, f, c, c]--bassI = line [bass0, reprise bass1 bass11 bass12]----- Part II--bass21 = line $ map en [--- 1 bar- db, db, eb, eb, ab, eb, f, db,--- 2 bar- low f, low f, f, f, d, e, f, db,--- 3 bar- low bb, low g, c, c, db, db, db , db,--- 4 bar- d, d, d, d, low a, low a, low b, low b- ] - -bass22 = low $ line $ map en [--- 5 bar- high c, high c, bb, bb, ab, ab, g, g,--- 6 bar- f, f, eb, eb, d, d, eb, eb, --- 7 bar- ab, ab, gb, gb, f, f, bb, bb,--- 8 bar- bb, ab, ab, g, g, f, high db, high db,--- 9 bar- b, b, high c, high c- ]--bass23 = qn $ low f-- -bassII = line [bass21, bass22, bass23]--bass = lower 3 $ line [bassI, bassII]--sco = delay (-4) $ bpm (lento $ -0.5) $ pipeOrgan' $ chord [solo, alto, bass]--file = "out.csd"-flags = "-d"--out = csd flags headerMono $ renderScore sco--main = writeFile file $ show out---main = play "totem" "tmp" "new" out-
− examples/dm.hs
@@ -1,29 +0,0 @@--- D minor chord--import CsoundExpr.Base-import qualified CsoundExpr.Opcodes as C--import Temporal.Music.Notation-import Temporal.Music.Notation.Local.Western ---- | sinusoidal oscilator-instr :: Irate -> SignalOut-instr cps = C.out $ C.oscilA [] (num 3000) cps (gen10 4096 [1])---- | pythagorean scale from middle C-scale = pyth 0 c1---- | d minor chord-sco = fmap (instr . double . frequency scale) $- line notes +:+ (stretch 2 $ chord notes)- where notes = map (note 1) [d, f, a, high d]--file = "out.csd"-flags = "-d"--out = csd flags headerMono $ renderScore sco--main = writeFile file $ show out---main = play "totem" "tmp" "new" out--
− examples/teardrop.hs
@@ -1,41 +0,0 @@--- massive attack - teardrop (intro)--import CsoundExpr.Base-import qualified CsoundExpr.Opcodes as C--import Temporal.Music.Notation-import Temporal.Music.Notation.Local.Western --import Orchestra(pipeOrgan', openHiHat', bassDrum', guitar)--scoBassDrum = low $ line [en c, qn c, en c, accent 0.5 $ hn f]-scoHiHat = line [hnr, dim 3 $ loop 4 $ ed 0]--scoDrums = loop 20 $ chord [- bassDrum' $ fl scoBassDrum,- openHiHat' $ pl scoHiHat ]---scoGuitar = sustain (1/16) $ guitar $ - dynamicRel [0, 2, 4, 4, 2] $- loop 4 $ - ppl $ high $ line [qnr, line $ map qn - [low a, e, low a, d, low a, d, e]] --scoOrgan = pipeOrgan' $ chord [q, low q]- where q = loop 2 $ lower 3 $ line $ map bn [a, g, d, low a]--sco = bpm (moderato 0.7) $ chord [- delay 10 $ scoGuitar,- scoDrums,- delay 2 $ scoOrgan,- rest 0]--file = "out.csd"-flags = "-d"--out = csd flags headerMono $ renderScore sco--main = writeFile file $ show out---main = play "totem" "tmp" "new" out-
temporal-music-notation.cabal view
@@ -1,5 +1,5 @@ Name: temporal-music-notation-Version: 0.1.2+Version: 0.1.3 Cabal-Version: >= 1.2 License-file: LICENSE License: BSD3@@ -12,20 +12,11 @@ Tested-With: GHC==6.12.3 Build-Type: Simple -Extra-Source-Files:- examples/Readme.hs - examples/dm.hs - examples/arpeggi.hs - examples/choral.hs - examples/teardrop.hs - examples/Orchestra.hs - Library Build-Depends: base >= 4, base < 5, vector >= 0.7, - temporal-media >= 0.2.1,- type-level-natural-number-decimal + temporal-media >= 0.2.1 Hs-Source-Dirs: src/ Exposed-Modules: Temporal.Music.Notation