ctrl14

ctrl14 — Allows a floating-point 14-bit MIDI signal scaled with a minimum and a maximum range.

Description

Allows a floating-point 14-bit MIDI signal scaled with a minimum and a maximum range.

Syntax

idest ctrl14 ichan, ictlno1, ictlno2, imin, imax [, ifn]
kdest ctrl14 ichan, ictlno1, ictlno2, kmin, kmax [, ifn]

Initialization

idest -- output signal

ichan -- MIDI channel number (1-16)

ictln1o -- most-significant byte controller number (0-127)

ictlno2 -- least-significant byte controller number (0-127)

imin -- user-defined minimum floating-point value of output

imax -- user-defined maximum floating-point value of output

ifn (optional) -- table to be read when indexing is required. Table must be normalized. Output is scaled according to imax and imin val.

Performance

kdest -- output signal

kmin -- user-defined minimum floating-point value of output

kmax -- user-defined maximum floating-point value of output

ctrl14 (i- and k-rate 14 bit MIDI control) allows a floating-point 14-bit MIDI signal scaled with a minimum and a maximum range. The minimum and maximum values can be varied at k-rate. It can use optional interpolated table indexing. It requires two MIDI controllers as input.

ctrl14 differs from midic14 because it can be included in score-oriented instruments without Csound crashes. It needs the additional parameter ichan containing the MIDI channel of the controller. MIDI channel is the same for all the controllers used in a single ctrl14 opcode.

Examples

Here is an example of the ctrl14 opcode. It uses the file ctrl14.csd.

Example 192. Example of the ctrl14 opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac   -M0  ;;;RT audio I/O with MIDI in
;-iadc    ;;;uncomment -iadc if RT audio input is needed too
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

instr 1	; expects MIDI controller input on channel 1
; run and move your midi controller to see result

imax = 1
imin = 0
ichan = 1 
ictlno = 7
 
	initc14	1, ictlno, ictlno+1, 1			; start at max. volume
kamp	ctrl14	ichan, ictlno, ictlno+1, imin, imax	; controller 7
	printk2	kamp
asig	oscil	kamp, 220, 1
	outs	asig, asig

endin

</CsInstruments>
<CsScore>
f 1 0 4096 10 1

i1 0 20

e
</CsScore>
</CsoundSynthesizer>


See also

MIDI input and Initialization

Credits

Author: Gabriel Maldonado
Italy

New in Csound version 3.47

Thanks goes to Rasmus Ekman for pointing out the correct MIDI channel and controller number ranges.