midiout
Prev | Orchestra Opcodes and Operators | Next

## midiout

midiout — Sends a generic MIDI message to the MIDI OUT port.

## Description

Sends a generic MIDI message to the MIDI OUT port.

## Syntax

    midiout kstatus, kchan, kdata1, kdata2

## Performance

kstatus -- the type of MIDI message. Can be:

- 128 (note off)

- 144 (note on)

- 160 (polyphonic aftertouch)

- 176 (control change)

- 192 (program change)

- 208 (channel aftertouch)

- 224 (pitch bend)

- 0 when no MIDI messages must be sent to the MIDI OUT port

kchan -- MIDI channel (1-16)

kdata1, kdata2 -- message-dependent data values

midiout has no output arguments, because it sends a message to the MIDI OUT port implicitly. It works at k-rate. It sends a MIDI message only when kstatus is non-zero.

| Warning
Warning: Normally kstatus should be set to 0. Only when the user intends to send a MIDI message, can it be set to the corresponding message type number.

## Examples

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

Example 606. Example of the midiout 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
    ; Audio out   Audio in
    -odac -Ma -Q1 ;;;realtime audio out and midi out and midi in (all midi inputs)
    </CsOptions>
    <CsInstruments>

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

    instr 1

    midiout	192, 1, 21, 0	;program change to instr. 21
    inum notnum
    ivel veloc
    midion 1, inum, ivel

    endin
    </CsInstruments>
    <CsScore>

    i 1 0 3  80 100		;play note for 3 seconds

    e
    </CsScore>
    </CsoundSynthesizer>

## Credits

Author: Gabriel Maldonado
Italy
1998

New in Csound version 3.492

Prev | Up | Next
midiout_i | Home | midipitchbend