Skip to content

orn

Generates a series of score events using intervals.

Syntax

orn i/kevent[], i/konsets[], i/kdurs[] [, i/kamps[]], i/kintervals[] [,i/kp6[], i/kp7[] ... i/kp11[]], iorndur [,ipitbound, iscale] 
orn i/kevent[], ionset, i/kintervals[], iorndur [, ipitbound, iscale]
orn(i/kevent[], i/konsets[], i/kdurs[] [, i/kamps[]], i/kintervals[] [,i/kp6[], i/kp7[] ... i/kp11[]], iorndur [,ipitbound, iscale])
orn(i/kevent[], ionset, i/kintervals[], iorndur [, ipitbound, iscale])

Usage

orn generates 'ornaments' from a single note.

Given an array of values representing a score event (p-fields), orn generates a series of additional score events. Parameter arrays define the pattern that score parameters follow throughout the duration of the ornament (given by `i/korndur').

For example: An array of intervals is used to calculate the pattern of pitches, by applying each interval in the array to the next generated event pitch. The selected interval in the array is picked by an index cycling through the array for each generated event. Thus depending upon the overall sum of the array, event pitches will ascend, descend or loop. For example using, kintervals[] fillarray 2,-2, 1 will cause pitches in the generated events to ascend by 2 steps, fall by 2 steps, then ascend by 1 step, then - repeating the cycle - ascend by two steps, fall by two etc...

Accumulating calculations are also used for the other array parameters: i/kdurs[], i/kamps[], i/kp6[] etc... The exception to this pattern is i/konsets[], which reads onset rhythms without accumulation (the same way arpi does).

To constrain values, ensure the arrays sum to zero (or just populate the array with zero).

Note that additional p-field arrays (ip6[], ip7[] ... etc.) must be present if ievent[] has those p-fields (p6, p7 etc...).


Outputs and 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/konsets[] -- Relative onset time intervals between events. The value for the onset time cycles repeatedly through this array for idur duration.

i/kdurs[] / idurs -- Event duration multipliers. The durations of generated events sum the duration from the prevous event by the selected value in this array. The selected value increments and cycles through the array with each event

i/kamps[] (optional) -- Amplitude multipliers. Be careful with this! The generated events accumulate the amplitude taken from the i/kamps array and from the immediately preceding score event. This can lead to amplitude blow-ups.

i/kintervals[] -- Intervals, as specified in iscale. The pitches of generated events sum the pitch from the previous event from the selected value in this array. The selected value increments and cycles through the array with each event.

i/kp6, i/kp7, ... (optional depending on i/kevent[]), additional arrays for generating from i/kevent[] p6, p7, up to p11.

iorndur -- Overall duration for the generated events

i/kpitbound (optional, default=0) -- Sets upper or lower bounds to pitch generation. If the sum of kintervals is positive an upper bound is set, with the lower bound being the pitch in kevent[]. The reverse situation operates when the sum of kintervals is negative: i.e. a lower bound is set, with the upper bound being the pitch in kevent[]. A positive kpitbound reflects pitches using Csound's mirroropcode. A negative kpitbound uses wrap. Default is 0 - no pitch boundaries.

i/kscale (optional, default=gi_CurrentScale) -- Use this scale for pitch generation.

Example

orn.orc

orn
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.


  ;                event[]                    ,onsets, intervals         , orn duration.                  
  orn fillarray_i(n("Sound101"),0,1/8,p4,p5), 1/8,    fillarray_i(1,2,-1), p3*1.5
  ;; Generate ornaments

schedule p1, nextbeat(3), 3, 0.5,p5 ;; and around again
turnoff
endin

schedule "Sched13", nextbeat(1),3, 0.5, -2
;; start the show.