fold — Adds artificial foldover to an audio signal.


Adds artificial foldover to an audio signal.


ares fold asig, kincr


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 file fold.csd.

Example 155. Example of the fold opcode.

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

; Select audio/midi flags here according to platform
; Audio out   Audio in    No messages
-odac           -iadc     -d     ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o fold.wav -W ;;; for file output any platform

; 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


; Play Instrument #1 for four seconds.
i 1 0 4



Author: Gabriel Maldonado

New in Csound version 3.56