Lang-music

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.

Github

Example

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

(defseq bass2b

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

(defseq bass2c

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

(defseq bass3a

 < < d
 d > >)

(defseq bass3b

 < a
 a >)

(defseq bass3c

 < d
 d >)

(dump-to-midi

"sweet.mid"
(play
 (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)
                lead5)
           (seq bass2a bass3a)
           (seq bass2b bass3b)
           (seq bass2c bass3c)
 )))

</syntaxhighlight>