asig -- input signal
kincr -- amount of foldover expressed in multiple of sampling rate. Must be >= 1
fold is an opcode which creates artificial foldover. For example, when kincr is equal to 1 with sr=44100, no foldover is added. When kincr is set to 2, the foldover is equivalent to a downsampling to 22050, when it is set to 4, to 11025 etc. Fractional values of kincr are possible, allowing a continuous variation of foldover amount. This can be used for a wide range of special effects.
Here is an example of the fold opcode. It uses the files fold.orc and fold.sco.
Example 15-1. Example of the fold opcode.
/* fold.orc */
; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
; Instrument #1.
instr 1
; Use an ordinary sine wave.
asig oscils 30000, 100, 1
; Vary the fold-over amount from 1 to 200.
kincr line 1, p3, 200
a1 fold asig, kincr
out a1
endin
/* fold.orc */
/* fold.sco */
; Play Instrument #1 for four seconds.
i 1 0 4
e
/* fold.sco */