polyaft
Prev | Orchestra Opcodes and Operators | Next

## 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

    ires polyaft inote [, ilow] [, ihigh]

    kres 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

kres -- polyphonic pressure (aftertouch).

## Examples

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

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

Example 369. Example of the polyaft 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 polyaft.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    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

    </CsInstruments>
    <CsScore>

    t 0 120
    f 0 9 2 -2 0
    e

    </CsScore>
    </CsoundSynthesizer>

## Credits

Added thanks to an email from Istvan Varga

New in version 4.12

Prev | Up | Next
poisson | Home | polynomial