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 35. 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
; Audio out   Audio in   No messages  MIDI in
-odac           -iadc     -d         -M0  ;;;RT audio I/O with MIDI in
; For Non-realtime ouput leave only the line below:
; -o ampmidi.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

; Instrument #1.
instr 1
  ; Scale the amplitude between 0 and 1.
  ; This example expects MIDI note inputs on channel 1
  i1 ampmidi 1

  print i1
endin


</CsInstruments>
<CsScore>

;Dummy f-table to give time for real-time MIDI events
f 0 8000
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

Example written by Kevin Conder.