[Class]
midi-control-change

A MIDI control change or mode change event. See Table of Control and Mode Changes for information about MIDI control and mode messages.

midi-control-change supports the following slot initializations:

:time number
The start time of the object.
:channel integer
A MIDI channel number. The default value is 0.
:controller integer
A MIDI controller value 0-127.
:value integer
A MIDI control value 0-127.

Examples:

Example 1. Creating MIDI control and mode changes.

;;; a 'Sustain Pedal Down' control event
(new midi-control-change :time 0 :channel 3
     :controller 64 :value 127)

;;; a 'Local Control Off' mode event
(new midi-control-change :time 0 :controller 122 :value 0)

Example 2. Process with pedal control.

(define (sustain at chan val)
  ;; make sustain pedal event
  (new midi-control-change :time at :channel chan
       :controller 122 :value 0)

(define (playsome num)
  (process repeat num
           output (new midi :time (now)
                       :keynum (between 60 90)
                       :duraion (pick .2 .4 .6))
           wait (pick .1 .2 .3)
           ;; pedal up 5 seconds after end
           finally (output (sustain (+ (now) 5) 0 0))))

(events (list (sustain 0 0 127)
              (playsome 32))
        "test.mid")
 "test.mid"

Example 3. Setting pitch bend sensitivity.

(define (pbs time chan width)
  ;; a seq of control changes to set pitch bend 
  ;; sensitivity for a chan to a width in half-steps.
  (new seq :time time
       :subobjects
       (list ;; Registered Parameter Number (fine)
             (new midi-control-change 
                  :time 0 :channel chan
                  :controller 100
                  :value 0)
             ;; RPN (coarse)
             (new midi-control-change 
                  :time 0 :channel chan
                  :controller 101
                  :value 0)
             ;; Data entry
             (new midi-control-change 
               :time 0 :channel chan
               :controller 6
               :value width))))

See also: