Lang-music: Difference between revisions

From Nick Faro's Homepage
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
'''#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.
'''#lang music''' is a project that Michael Gunantra and I did for IU's C424 class. It's a music notation language inspired by [https://en.wikipedia.org/wiki/Music_Macro_Language 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 about 500 lines of Racket and outputs MIDI data. The playback routine is still a little buggy but it's a fun prototype to play with nonetheless.
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.


= Examples =
<b><span style="font-size:180%">
[https://github.com/SuperDisk/lang-music Github]
</span></b>
 
= Example =
 
Here's the intro to ''Sweet Child O' Mine'' that Michael coded up.


<syntaxhighlight lang="Scheme">
<syntaxhighlight lang="Scheme">
Line 65: Line 71:
   )))
   )))
</syntaxhighlight>
</syntaxhighlight>
<b><span style="font-size:180%">
[https://github.com/SuperDisk/lang-music Github]
</span></b>

Revision as of 04:54, 5 December 2018

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

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