ink

ink --  Passes k-rate values into a sub-instrument.

Description

Retrieves k-rate input values inside a sub-instrument.

Syntax

k1 [, k2] [...] ink

Performance

k1, k2, etc. -- k-rate values given for the sub-instrument call.

NoteNote
 

If an instrument containing ink is called as a normal instrument, then the opcode will have no effect.

Examples

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 */
        

See Also

Calling an Instrument Within an Instrument, outk

Credits

Author: Matt Ingalls

New in version 4.21