Skip to content

sc as cac (computer aided composition) by Rafael Valdez

Michael Edwards edited this page Jan 5, 2019 · 1 revision

Slippery Chicken is extensive and very robust. Its documentation is full of examples that show off the software in an impressive way. However, it was always difficult for me to navigate with-in Slippery Chicken confidently because I do not practice algorithmic composition in a purist fashion. Therefore a need to create some code to facilitate me this kind of use was necessary.

The use of technology to proliferate musical ideas or structures is a common practice among living composers. The computer offers a way to use technology in the same way mathematicians use a calculator. This means that it is possible to envision the use of Slippery Chicken as a Computer Aided Composition software. Slippery Chicken offers a great number of tools to work on musical ideas and I quickly became interested in seeking the way to take the most advantage out of these.

After discussing Abjdad with Dr. Edwards, he prepared a small example seen here that allowed me to develop the "Chord to Measure" or C2M class for Slippery Chicken. This class provides an easy and fast way of generating snippets of music with the result of different algorithms. The purpose of this is to be able to use Slippery Chicken as a Computer Aided Composition Software and have an immediate output of musical ideas without having to deal directly and in totality with the "slippery-chicken" object like the official documentation does.

Chord to Measure is based on a collection of methods that create a a sequence of measures and distributes notes and chords in that sequence according to the length of the chord and an order of placement. C2M's structure is defined

(defclass C2M ()
  ((chord :accessor C2M-chord)          ;; chord to work with
   (unit :accessor C2M-beat-unit)       ;; the rhythm unit
   (order :accessor C2M-order)          ;; an arbitrary list that represent
                                        ;; the order for the algorithm to work
   (measures :accessor C2M-measures)    ;; a placeholder for the measures of music
   (time-sig :accessor C2M-time-sig)    ;; the time signature to be used
   (req-ratio :accessor C2M-req-ratio)  ;; a number to multiply and expand the music
   (path :accessor C2M-path)            ;; not yet applied
   (name :accessor C2M-name)            ;; not yet applied
   
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;METHODS
   (one-note-out :reader one-note-out)       ;; methods to generate
   (shrink-chord :reader shrink-chord)       ;; the music
   (grab-and-pass :reader grab-and-pass)     ;; see examples
   (deal-from-chord :reader deal-from-chord)
   (requantize :reader requantize)
   ))

and the format of the information is described as follow:

measure / time signature / beats (rest - chord - note)

The format is very similar to the one used in the rhythm-seq-bar inside Slippery Chicken, but you can operate somewhat simpler and quicker by not having to read event slots. The function "print-simple" in Slippery Chicken can shows a similar way of looking at the information. What C2M provides is a way of operating with the information and creating the sequence of bars by applying different "dealing" algorithms.

To render a quick output of any code using C2M it is only necessary to call the "render-local" method and be sure that the sequence fed into that function maintains the necessary format. Below a quick example on how to render some bars of music. Notice that in this example there is no use of any method to generate the music but instead the music is entered manually.

(defparameter example (make-instance 'C2M))

(setf (C2M-time-sig example) '(3 4) ;; set time signature
      (C2M-beat-unit example) 4     ;; beat unit "quarter note"
      (C2M-measures example) '(((71 75 79) R R) ;; 6 measures with
                               ((71 75 79) R R) ;; 3 beats
                               ((71 75 79) R R) ;; - chord
			       ((71 75 79) R R) ;; - rest
                               ((71 75 79) R R) ;; - rest
                               ((71 75 79) R R)
			       ))
(write-xml (bars-to-sc (render-local example) ;; XML output
		       :instrument 'piano
		       :tempo 120))

Finally, the aim of C2M is not just to facilitate or "dumb-down" Slippery Chicken. C2M enables one way of thinking of rhythm influenced by the idea of "unit" that Pierre Boulez explores in Structures and the ways to build complex rhythms for my current work. It is designed in this way to achieve specific goals, confirming this way the flexibility that Slippery Chicken. C2M is a work in progress and will probably evolve in its structure and functionality based on my learning curve of the platform itself. The goals achieved with C2M can probably be accomplished directly in Slippery Chicken. However, it provides a particular way of thinking of rhythm and its relationship to harmony that made the time and effort worth it.

If you want to Explore more of C2M, the code is available in Github in this address: https://github.com/JRSV/C2M. Continuing below are some examples of the C2M methods.

;;; - examples - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; instantiate a C2M object and we give it the main values for its slots
(defparameter example (make-instance 'C2M))  ;; slots 
(setf (C2M-chord example) '(60 62 69 76 81)) ;; the chord
(setf (C2M-order example) '(4 2 0 3 1))      ;; the order used
(setf (C2M-time-sig example) '(5 8))         ;; the time signature

;;;;;;;;;;; Chord-in-Order Method ;;;;;;;;;;;;;;
(defparameter measures (chord-in-order example))
(setf (C2M-measures example) measures)
(lp-display (bars-to-sc (render-local example)))

The result will be a sequence of measures that contain the chord placed on the beat that is calculated according to the order slot. {{ :c2m-1.png?600 |}}

;; clear measures slot
(defparameter measures '())
(setf (C2M-measures C2M_example_seq) measures)
(print (C2M-measures C2M_example_seq))

;;;;;;;;;;; Grab-and-Pass Method ;;;;;;;;;;;;;;;
(defparameter measures (chord-in-order example))
(setf (C2M-measures example) measures)
(lp-display (bars-to-sc (render-local example)))

The result will be a sequence of measures in which the "grab-and-pass" method retains one pitch of the chord on the beat that it appears in the next iteration. {{ :c2m-2.png?600 |}}

;; clear measures slot
(defparameter measures '())
(setf (C2M-measures C2M_example_seq) measures)
(print (C2M-measures C2M_example_seq))

;;;;;;;;;;; Shrink-Chord  ;;;;;;;;;;;;;;;
(defparameter measures (shrink-chord example))
(setf (C2M-measures example) measures)
(lp-display (bars-to-sc (render-local example)))

This method reduces the chord by one pitch in each iteration {{ :c2m-3.png?600 |}}

;; clear measures slot
(defparameter measures '())
(setf (C2M-measures C2M_example_seq) measures)
(print (C2M-measures C2M_example_seq))

;;;;;;;;;;; One-Note-Out  ;;;;;;;;;;;;;;;
(defparameter measures (one-note-out example))
(setf (C2M-measures example) measures)
(lp-display (bars-to-sc (render-local example)))

{{ :one-note-out.png?600 |}} "one-note-out" will place the chord without the pitch linked to the current beat.

;; clear measures slot
(defparameter measures '())
(setf (C2M-measures C2M_example_seq) measures)
(print (C2M-measures C2M_example_seq))

;;;;;;;;;;; Deal-from-Chord  ;;;;;;;;;;;;;;;
(defparameter measures (deal-from-chord example))
(setf (C2M-measures example) measures)
(lp-display (bars-to-sc (render-local example)))

The result of "deal-from-chord" is a sequence of measures in which the chord appears always on the initial position determined by the order minus one note that is placed in the number of beat corresponding to the iteration.

{{ :deal-from-chord.png?600 |}}

Finally there is a method called requantize which multiplies the amount of units by a "req-ratio"

;; clear measures slot
(defparameter measures '())
(setf (C2M-measures example) measures)
(print (C2M-measures example))

;;;;;;;;;;; Deal-from-Chord  ;;;;;;;;;;;;;;;
(defparameter measures (deal-from-chord example))
(setf (C2M-measures example) measures)

;;;;;;;;;;;;;; Requantize ;;;;;;;;;;;;;;;;;
(setf (C2M-beat-unit example) 16)

(setf (C2M-req-ratio example) 5)
;; I can call the requantize method to expand
(setf (C2M-measures example)
      ;; measures are packed according to the relationship they expand
      ;; and the unit used inside the original measure
      (pack-in-measures (requantize example) 10))


(lp-display (bars-to-sc (render-local example)))

{{ :screenshot_from_2018-12-10_11-28-42.png?800 |}}

Clone this wiki locally