veloc
Prev | Orchestra Opcodes and Operators | Next

## veloc

veloc — Get the velocity from a MIDI event.

## Description

Get the velocity from a MIDI event.

## Syntax

    ival veloc [ilow] [, ihigh]

## Initialization

ilow, ihigh -- low and hi ranges for mapping

## Performance

Get the MIDI byte value (0 - 127) denoting the velocity of the current event.

## Examples

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

Example 976. Example of the veloc 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 -+rtmidi=virtual  -M0  ;;;realtime audio I/O with MIDI in
    ;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
    </CsOptions>
    <CsInstruments>

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

    gisine	ftgen 0, 0, 1024, 10, 1

    instr 1

    ivel veloc 0, 1				;scale 0 - 1
    print ivel				;print velocity
    asig poscil .5*ivel, 220, gisine	;and use it as amplitude
         outs asig, asig

    endin
    </CsInstruments>
    <CsScore>

    f 0 30     ;runs 30 seconds

    e
    </CsScore>
    </CsoundSynthesizer>

## See Also

aftouch, ampmidi, cpsmidi, cpsmidib, midictrl, notnum, octmidi, octmidib, pchbend, pchmidi, pchmidib

## Credits

Author: Barry L. Vercoe - Mike Berry
MIT - Mills
May 1997

Prev | Up | Next
vecdelay | Home | vexp