pset

pset — Defines and initializes numeric arrays at orchestra load time.

Description

Defines and initializes numeric arrays at orchestra load time.

Syntax

pset icon1 [, icon2] [...]

Initialization

icon1, icon2, ... -- preset values for a MIDI instrument

pset (optional) defines and initializes numeric arrays at orchestra load time. It may be used as an orchestra header statement (i.e. instrument 0) or within an instrument. When defined within an instrument, it is not part of its i-time or performance operation, and only one statement is allowed per instrument. These values are available as i-time defaults. When an instrument is triggered from MIDI it only gets p1 and p2 from the event, and p3, p4, etc. will receive the actual preset values.

Examples

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

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

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

instr 1 ;this shows an example with non-midi use

pset 1, 0, 1, 220, 0.5 
asig poscil p5, p4, 1 
     outs asig, asig
 
endin 
</CsInstruments>
<CsScore>
 
f 1 0 1024 10 1	;sine wave

i 1 0 1 
i 1 1 1 440 
i 1 2 1 440 0.1 
e
</CsScore>
</CsoundSynthesizer>


Here is another example of the pset opcode, using pset with midi. It uses the file pset-midi.csd

Example 660. Second example of the pset opcode.

<CsoundSynthesizer>
<CsOptions>
 
; Select audio/midi flags here according to platform
-odac -+rtmidi=virtual -M0 --midi-key-oct=4 --midi-velocity=5   ;;;realtime audio out and virtual midi keyboard
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o pset-midi.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>
 

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

instr 1

            pset 0, 0, 3600, 0, 0, 0
iinstrument = p1
istarttime  = p2
iattack     = 0.005
isustain    = p3
irelease    = 0.06
p3          = isustain + iattack + irelease
kdamping    linsegr 0.0, iattack, 1.0, isustain, 1.0, irelease, 0.0

ioctave     = p4
ifrequency  = cpsoct(ioctave)
iamplitude  = p5*.15			;lower volume

print p1, p2, p3, p4, p5
asig STKBandedWG ifrequency, iamplitude
     outs asig, asig

endin
</CsInstruments>
<CsScore>
f 0 60	; runs 69 seconds
e
</CsScore>
</CsoundSynthesizer>


See Also

strset