An Introduction to Collective Algorithmic Music Composition

Dynamics

Each note has three basic elements: a pitch, a duration and an intensity (loudness). In MIDI, loudness is defined as velocities. If we want to create an event we simply assign these valuse to creat the MIDI events. For example:

;pitches
(define p '(60 62 64 65 69 70 81))
;durations
(define d '(1000 1000 1000 1000 1000 1000 1000))
;velocities
(define v '(30 45 55 70 80 90 127))

(play-midi (create-events 0 p d v 1))

Sometimes we don't want to worry about specific velocities in a note. In such cases we can use the create-constant-velocities, create-random-velocities and the constant value functions.

constant-value

;pitches
(define p '(60 62 64 65 69 70 81))
;durations
(define d '(1000 1000 1000 1000 1000 1000 1000))
;velocities
(define v (constant-value (length p) 96))

(play-midi (create-events 0 p d v 1))

create-constant-velocities

If we have a sequence of chords, we can use the create-constant-velocities function to

;pitches
(define p '(60 (62 64) 65 69 70 81))
;durations
(define d '(1000 (1000 1000) 1000 1000 1000 1000))
;velocities
(define v (create-constant-velocities p 96))

(play-midi (create-events 0 p d v 1))

create-random-velocities

With the create-random-velocities function we need to specify minimum and maximum values.

;pitches
(define p '(60 (62 64) 65 69 70 81))
;durations
(define d '(1000 (1000 1000) 1000 1000 1000 1000))
;velocities
(define v (create-random-velocities p 96 120))
(play-midi (create-events 0 p d v 1))