jspline

jspline — A jitter-spline generator.

Description

A jitter-spline generator.

Syntax

ares jspline xamp, kcpsMin, kcpsMax
kres jspline kamp, kcpsMin, kcpsMax

Performance

kres, ares -- Output signal

xamp -- Amplitude factor

kcpsMin, kcpsMax -- Range of point-generation rate. Min and max limits are expressed in cps.

jspline (jitter-spline generator) generates a smooth curve based on random points generated at [cpsMin, cpsMax] rate. This opcode is similar to randomi or randi or jitter, but segments are not straight lines, but cubic spline curves. Output value range is approximately > -xamp and < xamp. Actually, real range could be a bit greater, because of interpolating curves beetween each pair of random-points.

At present time generated curves are quite smooth when cpsMin is not too different from cpsMax. When cpsMin-cpsMax interval is big, some little discontinuity could occurr, but it should not be a problem, in most cases. Maybe the algorithm will be improved in next versions.

These opcodes are often better than jitter when user wants to naturalize or analogize digital sounds. They could be used also in algorithmic composition, to generate smooth random melodic lines when used together with samphold opcode.

Note that the result is quite different from the one obtained by filtering white noise, and they allow the user to obtain a much more precise control.

Examples

Here is an example of the jspline opcode. It uses the file jspline.csd.

Example 400. Example of the jspline opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<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 jspline.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1

instr 1

kamp    init p4
kcpsmin init 2
kcpsmax init 20

ksp  jspline kamp, kcpsmin, kcpsmax
aout pluck 1, 200+ksp, 1000, 0, 1
aout dcblock aout	;remove DC
     outs aout, aout

endin
</CsInstruments>
<CsScore>

i 1 0 10 2	;a bit jitter
i 1 8 10 10	;some more
i 1 16 10 20	;lots more
e
</CsScore>
</CsoundSynthesizer>


Credits

Author: Gabriel Maldonado

New in Version 4.15