pset
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 of the pset opcode. |
---|
| <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 a midi file. It uses the files pset-midi.csd and midiChords.mid
Second example of the pset opcode. |
---|
| <CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac -m0d --midi-key-oct=4 --midi-velocity=5 -F midiChords.mid
;-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>
; by Menno Knevel - 2021
sr = 44100
ksmps = 32
0dbfs = 1
nchnls = 2
; midiChords.mid can be found in examples folder
instr 1
pset 1, 0, .1
istarttime = p2
iattack = 0.005
isustain = p3
irelease = 0.06
p3 = isustain + iattack + irelease
ifrequency cpsmidi
iamplitude = p5*.2 ;lower volume
print p1, p2, p3, p4, p5
asig STKBandedWG ifrequency, iamplitude
outs asig, asig
endin
</CsInstruments>
<CsScore>
i1 0 60 ; runs for 1 minute, midifile time lasts for 35 seconds
</CsScore>
</CsoundSynthesizer>
|
See also
Initialization and Reinitialization
Orchestra Header Statements