rspline
Prev | Orchestra Opcodes and Operators | Next

## rspline

rspline — Generate random spline curves.

## Description

Generate random spline curves.

## Syntax

    ares rspline xrangeMin, xrangeMax, kcpsMin, kcpsMax

    kres rspline krangeMin, krangeMax, kcpsMin, kcpsMax

## Performance

kres, ares -- Output signal

xrangeMin, xrangeMax -- Range of values of random-generated points

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

rspline (random-spline-curve generator) is similar to jspline but output range is defined by means of two limit values. Also in this case, real output range could be a bit greater of range values, 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 rspline opcode. It uses the file rspline.csd.

Example 725. Example of the rspline 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

    krangeMin init p4
    krangeMax init p5
    kcpsmin init 2
    kcpsmax init 3

    ksp  rspline krangeMin, krangeMax, 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  5	;a bit jitter
    i 1 8  10 10 20	;some more
    i 1 16 10 20 50	;lots more
    e
    </CsScore>
    </CsoundSynthesizer>

## Credits

Author: Gabriel Maldonado

New in version 4.15

Prev | Up | Next
round | Home | rtclock