User-Defined Opcode Database

sampleSlicer

Reads a function table in incremental slices.

Download UDO File

Description

Reads a function table in incremental slices. Frequency is independent.
Uses lposcil, allowing GEN01 function tables with zero size.

Syntax

asig sampleSlicer kamp, kfreq, kminslice, kmaxslice, kmininc, kmaxinc, ifn

Initialization

ifn -- the function table containing sample to be sliced. can be zero size.

Performance

kamp -- amplitude
kfreq -- .5 = half speed, 2 = double speed... same as lposcil
kminslice/kmaxslice -- minimum/maximum length of slice in seconds
kmininc/kmaxinc -- minimum/maximum length of increment per slice in seconds

Code

	opcode sampleSlicer, a, kkkkkki
kamp, kfreq, kminslice, kmaxslice, kmininc, kmaxinc, ifn xin
isize = ftlen(ifn)
kphase init 0
kslice random kminslice, kmaxslice
kinc random kmininc, kmaxinc

redo:
timout 0, i(kslice), continue
kphase = (kphase < (isize - i(kslice) * sr)?kphase + kinc * sr:0)
reinit redo

continue:
aenv linseg 0, .01, 1, i(kslice) - .02, 1, .01, 0
asig lposcil3 kamp, kfreq, 0, 0, ifn, i(kphase)
rireturn
asig = asig * aenv
xout asig
	endop

Examples

/* .orc */
nchnls=2

instr 1
al sampleSlicer 32000, .5, .101, .23, .1, .4, 1
ar sampleSlicer 32000, .5, .105, .21, .1, .4, 1
outs al, ar
endin

instr 2
asig sampleSlicer 32000, 1, .1, .1, .005, .005, 1
outs asig, asig
endin

/*.sco*/
f1 0 0 1 "soundfile.aif" 0 0 0
i1 0 5
i2 6 5

Credits

credits


Previous Home Next
Statevar   stereoGrain