ampmidi

Name

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 files ampmidi.orc and ampmidi.sco.

Example 15-1. Example of the ampmidi opcode.

/* ampmidi.orc */
; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

; Instrument #1.
instr 1
  ; Scale the amplitude between 0 and 1.
  i1 ampmidi 1

  print i1
endin
/* ampmidi.orc */
        
/* ampmidi.sco */
; Play Instrument #1 for 12 seconds.
i 1 0 12
e
/* ampmidi.sco */
        

See Also

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

Credits

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

Example written by Kevin Conder.