midic7

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

Description

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

Syntax

idest midic7 ictlno, imin, imax [, ifn]
kdest midic7 ictlno, kmin, kmax [, ifn]

Initialization

idest -- output signal

ictlno -- MIDI 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 the imin and imax values.

Performance

kdest -- output signal

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

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

midic7 (i- and k-rate 7 bit MIDI control) allows a floating-point 7-bit MIDI signal scaled with a minimum and a maximum range. It also allows optional non-interpolated table indexing. In midic7 minimum and maximum values can be varied at k-rate.

[Note] Note

Please note that the midic family of opcodes are designed for MIDI triggered events, and don't require a channel number since they will respond to the same channel as the one that triggered the instrument (see massign). However they will crash if called from a score driven event.

Examples

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

Example 470. Example of the midic7 opcode.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac  -+rtmidi=virtual -M0    ;;;realtime audio out and realtime midi in 
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o midic7.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

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

instr 1
; This example expects MIDI controller input on channel 1
; run, play a note and move your midi controller 7 to see result

imax  = 1
imin  = 0
ichan = 1 
ictlno= 7 	; = midi volume

kamp	midic7	ictlno, imin, imax	
	printk2	kamp
asig	oscili	kamp, 220, 1
	outs	asig, asig

endin
</CsInstruments>
<CsScore>
; no score events allowed
f 0 20		;20 sec. for real-time MIDI events
f 1 0 4096 10 1	;sine wave

e
</CsScore>
</CsoundSynthesizer>


See Also

ctrl7, ctrl14, ctrl21, initc7, initc14, initc21, midic14, midic21

Credits

Author: Gabriel Maldonado
Italy

New in Csound version 3.47

Thanks goes to Rasmus Ekman for pointing out the correct controller number range.