Karo Engine
Sample run
An example of a Karo Engine session, with annotations.
CL-USER> (load “karo.lisp”)
; file: /home/ola/src/karo/karo.lisp
…
Karo Engine v1.106 2013-05-29 12:05:00
(c) 2001-2013 Daniel Schell and Ola Rinta-Koski
http://ola.rinta-koski.net/karo/ for more info
T
A Karo Engine session is started by loading karo.lisp.
#<PACKAGE “KARO”>
All Karo Engine definitions are in the package KARO.
#<Karo 8556 (0 4 8 1 5 9 2 6 10 3 7 11) 4,4(0) 4,4(1) 4,4(2) 4,4(3)>
KARO> (get-karo 8556)
#<Karo 8556 (0 4 8 1 5 9 2 6 10 3 7 11) 4,4(0) 4,4(1) 4,4(2) 4,4(3)>
#[i] is a reader macro which returns the ith Karo (when working in Z12, i can range from 1 to 15400). #[i] simply calls the function GET-KARO.
((0 4 8) (1 5 9) (2 6 10) (3 7 11))
(AS-CHORDS {karo}) returns the notes of karo grouped as chords.
(“4,4(0)” “4,4(1)” “4,4(2)” “4,4(3)”)
(NAME-CHORDS {karo}) returns the chords of karo using the naming convention of i,j(k), where i = 1st interval, j = 2nd interval and k = base note.
(#<Karo 8556 (0 4 8 1 5 9 2 6 10 3 7 11) 4,4(0) 4,4(1) 4,4(2) 4,4(3)>)
KARO> (find-karos ‘(4 3 3 4 4 3 3 4))
(#<Karo 6326 (0 3 7 1 5 10 2 6 9 4 8 11) 3,4(0) 3,4(10) 4,3(2) 4,3(4)>
#<Karo 6356 (0 3 7 1 6 9 2 5 10 4 8 11) 3,4(0) 3,4(6) 4,3(10) 4,3(4)>
…
#<Karo 10518 (0 5 9 1 4 8 2 7 10 3 6 11) 4,3(5) 3,4(1) 3,4(7) 4,3(11)>
#<Karo 10519 (0 5 9 1 4 8 2 7 11 3 6 10) 4,3(5) 3,4(1) 4,3(7) 3,4(3)>)
(FIND-KAROS {model}) returns a list of the Karos that match model. A match is found when the intervals of the Karo notes written as chords match pairwise with the intervals specified in model. Chord order is not important.
:ROTATIONAL
KARO> (karo-class #[10519])
:SYMMETRIC
(KARO-CLASS {karo}) returns one of three values: :ROTATIONAL (all intervals are equal), :SYMMETRIC (the interval list is symmetric eg. 34 43 43 34) or :COMMON (all other cases), depending on the symmetricity of karo.
(11 ((1 4 8) (0 5 9) (3 6 10) (2 7 11)) ((1 4 8) (0 5 9) (3 6 10) (2 7 11))
(3 5 3) ((-1 1 1) (3 1 1) (-1 1 1)))
KARO> (connect #[10519] :reject-translation nil)
(11 ((1 4 8) (0 5 9) (3 6 10) (2 7 11)) ((1 4 8) (0 5 9) (3 6 10) (2 7 11))
(3 5 3) ((-1 1 1) (3 1 1) (-1 1 1)))
KARO> (connect #[10519] :fixed-order t)
(11 ((0 5 9) (1 4 8) (-1 2 7) (-2 3 6)) ((0 5 9) (1 4 8) (11 2 7) (10 3 6))
(3 5 3) ((1 -1 -1) (-2 -2 -1) (-1 1 -1)))
(CONNECT {karo} &KEY (REJECT-TRANSLATION T) (FIXED-ORDER NIL)) returns the best connection for the chords in karo.
The return value is a list of the form (a b c d):
- a = total of intervals
- b = chords of the connection
- c = chords of the connection with all notes in the positive range
- d = intervals of the connection
“/tmp/karo-10519.xml”
“/tmp/karo-10519.eps”
“/tmp/karo-10519.svg”
NIL
(DRAW {karo} &KEY (DIRECTORY "/tmp")) outputs various diagrams of karo to directory.
; Evaluation aborted on #<UNDEFINED-FUNCTION MIDI-OUTPUT {1006B919A3}>.
KARO> (load “midi.lisp”)
STYLE-WARNING: Implicitly creating new generic function MIDI::WRITE-EVENT.
…
T
KARO> (midi-output #[10519])
; Evaluation aborted on #<UNDEFINED-FUNCTION MIDI-OUTPUT {1006D476E3}>.
KARO> (load “karo.lisp”)
; file: /home/ola/src/karo/karo.lisp
…
Karo Engine v1.106 2013-05-29 12:05:00
(c) 2001-2013 Daniel Schell and Ola Rinta-Koski
http://ola.rinta-koski.net/karo/ for more info
T
KARO> (midi-output #[10519])
“/tmp/karo-10519.mid”
(MIDI-OUTPUT {karo} &KEY (DIRECTORY "/tmp")) outputs karo as a MIDI file to directory. Note that in order to use this feature, midi.lisp has to be loaded before karo.lisp.
“/tmp/karo-10519.csd”
(CSOUND-FILE {filename} {karo})) outputs karo as a Csound file named by filename. This is mainly useful when working outside Z12.
© 2013 Daniel Schell & Ola Rinta-Koski