clojure-school-of-music/src/music.clj

11 lines
529 B
Clojure
Raw Normal View History

2018-07-16 22:39:51 +00:00
(ns music)
;; an octave is an int, e.g. 4
;; a pitch class is a keyword from :Abb to G##
;; a pitch is a [pitch class, octave] vector, e.g. [:C 4] is middle C
;; a duration is a rational number, e.g. 1/8
;; a note has a duration, optionally a pitch, and optionally any other necessary keys (e.g. loudness)
;; {:duration 1/8 :pitch [:A# 3]} is a note. {:duration 1/4} is a note (really, a rest)
;; (:=: noteA noteB) represents noteA played simultaneously with noteB
;; (:+: noteA noteB) represents noteA played followed by noteB