k1, k2, etc. -- k-rate values given for the sub-instrument call.
![]() | Note |
---|---|
If an instrument containing ink is called as a normal instrument, then the opcode will have no effect. |
Here is an example of the ink opcode. It uses the files ink.orc and ink.sco.
Example 1. Example of the ink opcode.
/* ink.orc */
/* Written by Kevin Conder */
; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
; Instrument Name: MyEnvelope
; Output Parameters: one k-rate signal.
; Input Parameters: one k-rate signal.
instr MyEnvelope, k, k
; Store the input parameter in the kinputparam variable.
kinputparam ink
; Fade the signal over time.
kline line 0, p3, 1
kfaded = (kinputparam - kline) * 20000
; Output the new faded k-rate signal.
outk kfaded
endin
; Instrument Name: #1
instr 1
; Create a k-rate signal.
ksig init 1
; Turn the k-rate signal into an amplitude envelope.
kenv MyEnvelope ksig
; Use the amplitude envelope with a basic sine-wave tone.
abasic oscil kenv, 440, 1
out abasic
endin
/* ink.orc */
/* ink.sco */
/* Written by Kevin Conder */
; Table #1, a sine wave.
f 1 0 16384 10 1
; Play Instrument #1 for five seconds.
i 1 0 5
e
/* ink.sco */