From Nick Faro's Homepage
Jump to: navigation, search

#lang music is a project that Michael Gunantra and I did for IU's C424 class. It's a music notation language inspired by MML, but instead of manipulating and concatenating strings, it's a structured language with full support for manipulating notes and bars.

It was done in Racket and outputs MIDI data. The playback routine is still a little buggy but it's a fun prototype to play with nonetheless.



Here's the intro to Sweet Child O' Mine that Michael coded up.

<syntaxhighlight lang="Scheme"> (defseq bass2a

 < < d4. > f#4. f#8 g8 
 > a4 b8 a8 < g8 f#8 d8 < r32 c32 e32 g32
 c2 > g2
 > d8 c4 d4. c8 < < r32 g32 > b32 d32
 < g2. > r8 r32 g32 > b32 d32

(defseq bass2b

 < < f#2. r4
 d2 r2
 > b2. r4
 > b

(defseq bass2c

 < a2. r4
 g2 r2
 > d2. r4
 > d  <

(defseq bass3a

 < < d
 d > >)

(defseq bass3b

 < a
 a >)

(defseq bass3c

 < d
 d >)


 (together (with-voice electric-guitar-clean (seq (loop 8 lead1)
                (loop 2 lead2)
                (loop 2 lead3)
                (loop 2 lead4)
                (loop 2 lead2)))
           (with-voice electric-bass-finger bass1)
           (loop 0 (with-voice side-stick (drumseq lead1)))
 (together (seq (loop 2 lead2)
                (loop 2 lead3)
                (loop 2 lead4)
           (seq bass2a bass3a)
           (seq bass2b bass3b)
           (seq bass2c bass3c)