limit sets the lower and upper limits on the xsig value it processes. If xhigh is lower than xlow, then the output will be the average of the two - it will not be affected by xsig.
This opcode is useful in several situations, such as table indexing or for clipping and modeling a-rate, i-rate or k-rate signals.
Examples
Here is an example of the limit opcode. It uses the file limit.csd.
<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 limit.wav -W ;;; for file output any platform</CsOptions><CsInstruments>sr=44100ksmps=320dbfs=1nchnls=2instr1; Limit / Mirror / Wrapigain=p4;gainilevl1=p5; + levelilevl2=p6; - levelimode=p7;1 = limit, 2 = mirror, 3 = wrapainsoundin"fox.wav"ain=ain*igainifimode=1gotolimitifimode=2gotomirrorasigwrapain,ilevl2,ilevl1gotooutsignallimit:asiglimitain,ilevl2,ilevl1gotooutsignalmirror:asigmirrorain,ilevl2,ilevl1outsignal:outsasig*.5,asig*.5;mind your speakersendin</CsInstruments><CsScore>; Gain +Levl -Levl Modei1034.00.25-1.001;limiti1434.00.25-1.002;mirrori1834.00.25-1.003;wrape</CsScore></CsoundSynthesizer>