Chordinator in Sourceforge

chordinator.lisp

After some struggles with Sourceforge, the source code for chordinator is now available.

Here’s a sample:

(defmethod colour-generator (hue-fun saturation-fun brightness-fun)
"Make a function to make a new instance of colour."
(lambda ()
(make-instance 'colour
:hue (funcall hue-fun)
:saturation (funcall saturation-fun)
:brightness (funcall brightness-fun))))

(defmethod random-colour-generator (&key (min-hue 0.0) (max-hue 1.0)
(min-saturation 0.0) (max-saturation 1.0)
(min-brightness 0.0) (max-brightness 1.0))
"Make a function to make a random colour."
(colour-generator (random-generator min-hue max-hue)
(random-generator min-saturation max-saturation)
(random-generator min-brightness max-brightness)))

(defmethod n-random-colours ((n integer) &key (min-hue 0.0) (max-hue 1.0)
(min-saturation 0.0) (max-saturation 1.0)
(min-brightness 0.0) (max-brightness 1.0))
"Make a list of n random colours."
(let ((generate (random-colour-generator :min-hue min-hue
:max-hue max-hue
:min-saturation min-saturation
:max-saturation max-saturation
:min-brightness min-brightness
:max-brightness max-brightness)))
(loop repeat n
collect (funcall generate))))

Posted in Generative Art, Projects