cm-svg adds a svg backend to cm. It is a seperate package depending on svg-import-export and the common lisp version of Common Music.
- download Common Music, svg-import-export and cm-svg
- Put the downloaded cm folder, svg-import-export folder and cm-svg folder to a place where asdf will find it (or, if using [quicklisp](https://www.quicklisp.org/beta/) into ~/quicklisp/local-projects/ and then
with asdf or quicklisp:
(require 'cm-svg)
with quicklisp:
(ql:quickload "cm-svg")
Example:
(in-package :cm)
(events
(process
for keynum in '(60 62 64 65 67)
output (new midi :time (now) :keynum keynum :duration 0.5)
wait 0.5)
"/tmp/test.svg"
:piano-roll-vis t
:staff-system-vis t
:showgrid t
:x-scale 8)
;;; -> "/tmp/test.svg"
Importing from svg:
(defparameter *myseq* (import-events "/tmp/test.svg" :x-scale 1/8))
Converting to MIDI:
(events
(import-events "/tmp/test.svg" :x-scale 1/8)
"test.midi"
:play nil)
;;; -> "/tmp/test.midi"
When cm-incudine is installed and rts is started the svg file can be played in realtime using midi:
(sprout *myseq*)
Note: cm-svg is not defined as a package on its own. It is evaluated within the :cm package, extending its functionality.