polyaft

polyaft --  Returns the polyphonic after-touch pressure of the selected note number.

Description

polyaft returns the polyphonic pressure of the selected note number, optionally mapped to an user-specified range.

Syntax

ir polyaft inote [, ilow] [, ihigh]

kr polyaft inote [, ilow] [, ihigh]

Initialization

inote -- note number. Normally set to the value returned by notnum

ilow (optional, default: 0) -- lowest output value

ihigh (optional, default: 127) -- highest output value

Performance

kr -- polyphonic pressure (aftertouch).

Examples

Here is an example of the polyaft opcode. It uses the files polyaft.mid, polyaft.orc and polyaft.sco.

Don't forget that you must include the -F flag when using an external MIDI file like "polyaft.mid".

Example 1. Example of the polyaft opcode.

/* polyaft.orc - written by Istvan Varga */
sr	=  44100
ksmps	=  10
nchnls	=  1

	massign 1, 1
itmp	ftgen 1, 0, 1024, 10, 1		; sine wave

	instr 1

kcps	cpsmidib 2		; note frequency
inote	notnum			; note number
kaft	polyaft inote, 0, 127	; aftertouch
; interpolate aftertouch to eliminate clicks
ktmp	phasor 40
ktmp	trigger 1 - ktmp, 0.5, 0
kaft	tlineto kaft, 0.025, ktmp
; map to sine curve for crossfade
kaft	=  sin(kaft * 3.14159 / 254) * 22000

asnd	oscili kaft, kcps, 1

	out asnd

	endin
/* polyaft.orc - written by Istvan Varga */
        
/* polyaft.sco - written by Istvan Varga */
t 0 120
f 0 9 2 -2 0
e
/* polyaft.sco - written by Istvan Varga */
        

Credits

Added thanks to an email from Istvan Varga

New in version 4.12