Haskore is a set of Haskell modules for creating music as MIDI, CSound, SuperCollider [1] Audio files. Because of the programming style of Haskell, the composer user can concentrate on composing rather than programming. Nevertheless the music author can benefit from the functional programming. Haskore was created by Paul Hudak at Yale in 1996.
Haskore is free use. An example ChildSong6.lhs from the official archive which contains a partial encoding of Chick Corea's "Children's Song No. 6" is:
module ChildSong6 where import Haskore -- note updaters for mappings fd d n = n d v vol n = n v v = [Volume 80] lmap f l = line (map f l) -- repeat something n times times 1 m = m times (n+1) m = m :+: (times n m) -- Baseline: b1 = lmap (fd dqn) [b 3, fs 4, g 4, fs 4] b2 = lmap (fd dqn) [b 3, es 4, fs 4, es 4] b3 = lmap (fd dqn) [as 3, fs 4, g 4, fs 4] bassLine = times 3 b1 :+: times 2 b2 :+: times 4 b3 :+: times 5 b1 -- Main Voice: v1 = v1a :+: v1b v1a = lmap (fd en) [a 5, e 5, d 5, fs 5, cs 5, b 4, e 5, b 4] v1b = lmap vol [cs 5 tn, d 5 (qn-tn), cs 5 en, b 4 en] v2 = v2a :+: v2b :+: v2c :+: v2d :+: v2e :+: v2f v2a = lmap vol [cs 5 (dhn+dhn), d 5 dhn, f 5 hn, gs 5 qn, fs 5 (hn+en), g 5 en] v2b = lmap (fd en) [fs 5, e 5, cs 5, as 4] :+: a 4 dqn v :+: lmap (fd en) [as 4, cs 5, fs 5, e 5, fs 5, g 5, as 5] v2c = lmap vol [cs 6 (hn+en), d 6 en, cs 6 en, e 5 en] :+: enr :+: lmap vol [as 5 en, a 5 en, g 5 en, d 5 qn, c 5 en, cs 5 en] v2d = lmap (fd en) [fs 5, cs 5, e 5, cs 5, a 4, as 4, d 5, e 5, fs 5] :+: lmap vol [fs 5 tn, e 5 (qn-tn), d 5 en, e 5 tn, d 5 (qn-tn), cs 5 en, d 5 tn, cs 5 (qn-tn), b 4 (en+hn)] v2e = lmap vol [cs 5 en, b 4 en, fs 5 en, a 5 en, b 5 (hn+qn), a 5 en, fs 5 en, e 5 qn, d 5 en, fs 5 en, e 5 hn, d 5 hn, fs 5 qn] v2f = Tempo (3/2) (lmap vol [cs 5 en, d 5 en, cs 5 en]) :+: b 4 (3*dhn+hn) v mainVoice = times 3 v1 :+: v2 -- Putting it all together: childSong6 = Instr "piano" (Tempo 3 (Phrase [Dyn SF] bassLine :=: mainVoice))
Category:Domain-specific programming languages Category:Audio programming languages Category:Free Haskell software
Haskore is a set of Haskell modules for creating music as MIDI, CSound, SuperCollider [1] Audio files. Because of the programming style of Haskell, the composer user can concentrate on composing rather than programming. Nevertheless the music author can benefit from the functional programming. Haskore was created by Paul Hudak at Yale in 1996.
Haskore is free use. An example ChildSong6.lhs from the official archive which contains a partial encoding of Chick Corea's "Children's Song No. 6" is:
module ChildSong6 where import Haskore -- note updaters for mappings fd d n = n d v vol n = n v v = [Volume 80] lmap f l = line (map f l) -- repeat something n times times 1 m = m times (n+1) m = m :+: (times n m) -- Baseline: b1 = lmap (fd dqn) [b 3, fs 4, g 4, fs 4] b2 = lmap (fd dqn) [b 3, es 4, fs 4, es 4] b3 = lmap (fd dqn) [as 3, fs 4, g 4, fs 4] bassLine = times 3 b1 :+: times 2 b2 :+: times 4 b3 :+: times 5 b1 -- Main Voice: v1 = v1a :+: v1b v1a = lmap (fd en) [a 5, e 5, d 5, fs 5, cs 5, b 4, e 5, b 4] v1b = lmap vol [cs 5 tn, d 5 (qn-tn), cs 5 en, b 4 en] v2 = v2a :+: v2b :+: v2c :+: v2d :+: v2e :+: v2f v2a = lmap vol [cs 5 (dhn+dhn), d 5 dhn, f 5 hn, gs 5 qn, fs 5 (hn+en), g 5 en] v2b = lmap (fd en) [fs 5, e 5, cs 5, as 4] :+: a 4 dqn v :+: lmap (fd en) [as 4, cs 5, fs 5, e 5, fs 5, g 5, as 5] v2c = lmap vol [cs 6 (hn+en), d 6 en, cs 6 en, e 5 en] :+: enr :+: lmap vol [as 5 en, a 5 en, g 5 en, d 5 qn, c 5 en, cs 5 en] v2d = lmap (fd en) [fs 5, cs 5, e 5, cs 5, a 4, as 4, d 5, e 5, fs 5] :+: lmap vol [fs 5 tn, e 5 (qn-tn), d 5 en, e 5 tn, d 5 (qn-tn), cs 5 en, d 5 tn, cs 5 (qn-tn), b 4 (en+hn)] v2e = lmap vol [cs 5 en, b 4 en, fs 5 en, a 5 en, b 5 (hn+qn), a 5 en, fs 5 en, e 5 qn, d 5 en, fs 5 en, e 5 hn, d 5 hn, fs 5 qn] v2f = Tempo (3/2) (lmap vol [cs 5 en, d 5 en, cs 5 en]) :+: b 4 (3*dhn+hn) v mainVoice = times 3 v1 :+: v2 -- Putting it all together: childSong6 = Instr "piano" (Tempo 3 (Phrase [Dyn SF] bassLine :=: mainVoice))
Category:Domain-specific programming languages Category:Audio programming languages Category:Free Haskell software