Skip to content

arpi

Generates a series of score events, repeating a series of notes for a duration.

Syntax

arpi i/kevent[], i/kintervals[], i/konsets[] [, i/kamps[]], idur [, ievdur], [,ionsetfac] [, iampfac]
arpi(i/kevent[], i/kintervals[], i/konsets[] [, i/kamps[]], idur [, ievdur], [,ionsetfac] [, iampfac])

Usage

arpi is loosely modelled as an arpeggiator. Given an array of values representing a score event (p-fields), arpi generates a series of additional score events spread by time and pitch intervals. Additional arrays and parameters control p-fields in the generated events. Pitches are assumed to be indices into gi_CurrentScale. Onsets and durations are in beats and will be modified by current tempo.


Arguments

i/kevent[] -- An array with values holding p-fields for a score event. kevent must have at least five p-fields representing the following values: p1=instrument, p2=onset, p3=duration, p4=amplitude(0-1), p5=pitch Additional pfields up to p11 are optional (lenarray(kevent) <= 11)

P-fields

For p1 i/kevent[], the number of the instrument is required (rather than the name). For named instruments, it is recommended to extract this using n (e.g. n("piano")).

For p2 and p3, note that onset time and duration are assumed to be in 'beats' rather than seconds.

For p5. pitch is assumed to be a scale degree index in gi_CurrentScale.

i/kintervals[] -- Scale degrees calculated as intervals from p5 in kevent (kevent[4]). The pitches of generated events will cycle repeatedly through this array for idur duration.

i/konsets[] -- Relative onset time intervals between events. The value for the onset time cycles repeatedly through this array for idur duration.

i/kamps[] (optional) -- Amplitude multipliers. The generated events taken their amplitude from the value in kevent p4 (kevent[3]). This value is multiplied by the multipliers in this array. The selected multiplier value cycles repeatedly through the array for idur durations.

idur -- Overall duration for the generated events

ievdur (optional, default=karray p3 (karray[2])) -- overrides the p3 in i/kevent[2].

ionsetfac (onsetfac, default=1) -- compresses or stretches the onset times of the arpeggiation. Default is 1 (no compression/stretch). A negative ionsetfac reduces or expands onset times throughout the duration of an arpeggiation with the effect of an accelerando or decelerando.

iampfac (optional, default=0) -- Applies a power curve to p4 values in generated events throughout the duration of the arpeggiation. Positive values reduce p4 to zero (e.g. fade out). Negative values increase p4 from zero to 1 (e.g. fade in). Steepness of the fade curve increases as abs(iampfac) gets greater.

Example

loopcode.orc

arpi
instr Sound101
  ;; Sound source
  ares vco2 p4,p5
  kfr transeg 8000, 0.2, -5, p5*4, p3-0.4, 2, p5  
  ares moogladder2 ares,kfr,0.4

send ares
endin

patchsig "Sound101", "outs"

instr Sched13
  ;; recursive trigger instrument.

  if (p5 == 0) then
    p5 = -2
  elseif (p5 == -2) then
    p5 = 0
  endif
  ;;switch p5 between two values each recursion

  arpi fillarray_i(n("Sound101"),0,1/8,p4,p5), fillarray_i(-2,0,2,4,6,8), fillarray_i(1/8),6 - 0.01,-1,-0.6,0
  ;; arpeggiator.

  schedule p1, nextbeat(6), 1, 0.5,p5 ;; and around again

turnoff
endin

schedule "Sched13", nextbeat(1),1, 0.5, 0
;; start the show.