packages feed

temporal-music-notation-0.1: examples/dm.hs

-- 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