initc7
Prev | Orchestra Opcodes and Operators | Next

## initc7

initc7 — Initializes the controller used to create a 7-bit MIDI value.

## Description

Initializes MIDI controller ictlno with ivalue

## Syntax

    initc7 ichan, ictlno, ivalue

## Initialization

ichan -- MIDI channel (1-16)

ictlno -- controller number (0-127)

ivalue -- floating point value (must be within 0 to 1)

## Performance

initc7 can be used together with both midic7 and ctrl7 opcodes for initializing the first controller's value. ivalue argument must be set with a number within 0 to 1. An error occurs if it is not. Use the following formula to set ivalue according with midic7 and ctrl7 min and max range:

ivalue = (initial_value - min) / (max - min)

## Examples

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

Example 455. Example of the initc7 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  ;;;realtime 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

    	initc7	1, 7, 1			; start at max. volume
    kamp	ctrl7	ichan, ictlno, 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

ctrl7, ctrl14, ctrl21, ctrlinit, initc14, initc21, midic7, midic14, midic21

## 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.

Prev | Up | Next
initc21 | Home | inleta