ampmidi
Prev | Orchestra Opcodes and Operators | Next

## ampmidi

ampmidi — Get the velocity of the current MIDI event.

## Description

Get the velocity of the current MIDI event.

## Syntax

    iamp ampmidi iscal [, ifn]

## Initialization

iscal -- i-time scaling factor

ifn (optional, default=0) -- function table number of a normalized translation table, by which the incoming value is first interpreted. The default value is 0, denoting no translation.

## Performance

Get the velocity of the current MIDI event, optionally pass it through a normalized translation table, and return an amplitude value in the range 0 - iscal.

## Examples

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

Example 57. Example of the ampmidi 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     ;;;RT audio out
    ;-iadc    ;;;uncomment -iadc if RT audio input is needed too
    ; For Non-realtime ouput leave only the line below:
    ;-o ampmidi.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

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

    instr 1  ;expects MIDI note inputs on channel 1

    iamp	ampmidi 1	; scale amplitude between 0 and 1
    asig	oscil iamp, 220, 1
    	print iamp
    	outs  asig, asig

    endin

    </CsInstruments>
    <CsScore>
    ;Dummy f-table for 1 minute
    f 0 60
    ;sine wave.
    f 1 0 16384 10 1

    e

    </CsScore>
    </CsoundSynthesizer>

## See Also

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

## Credits

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

Prev | Up | Next
ampdbfs | Home | ampmidicurve