wrap wraps-around the signal that exceeds the low and high thresholds.
This opcode is useful in several situations, such as table indexing or for clipping and modeling a-rate, i-rate or k-rate signals. wrap is also useful for wrap-around of table data when the maximum index is not a power of two (see table and tablei). Another use of wrap is in cyclical event repeating, with arbitrary cycle length.
Examples
Here is an example of the wrap opcode. It uses the file wrap.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 wrap.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>