ifilcod -- integer or character-string denoting an impulse response soundfile. Multichannel files are supported, the file must have the same sample-rate as the orc. [Note: cvanal files cannot be used!] Keep in mind that longer files require more calculation time [and probably larger partition sizes and more latency]. At current processor speeds, files longer than a few seconds may not render in real-time.
ipartitionsize (optional, defaults to the output buffersize [-b]) -- the size in samples of each partition of the impulse file. This is the parameter that needs tweaking for best performance depending on the impulse file size. Generally, a small size means smaller latency but more computation time. If you specify a value that is not a power-of-2 the opcode will find the next power-of-2 greater and use that as the actual partition size.
ichannel (optional) -- which channel to use from the impulse response data file.
Performance
ain -- input audio signal.
The overall latency of the opcode can be calculated as such [assuming ipartitionsize is a power of 2]
<CsoundSynthesizer><CsOptions>; Select audio/midi flags here according to platform-odac ;;;realtime audio out-iadc ;;;uncomment -iadc if real audio input is needed too; For Non-realtime ouput leave only the line below:; -o pconvolve.wav -W ;;; for file output any platform</CsOptions><CsInstruments>; additions by Menno Knevel 2022sr=44100ksmps=32nchnls=2nchnls_i=1; assume only one mono signal for audio input!0dbfs=1instr1kmix=.5; Wet/dry mixkvol=.05*kmix; volume level of reverbkmix=(kmix<0||kmix>1?.5:kmix); do some safety checkingkvol=(kvol<0?0:.5*kvol*kmix); to make sure we the parameters a goodipartitionsize=p4; size of each convolution partion; for best performance, this parameter needs to be tweakedidel=(ksmps<ipartitionsize?ipartitionsize+ksmps:ipartitionsize)/sr; calculate latencyprints"\nConvolving with a latency of %f seconds\n",idelprints"***if no live input is given, nothing will sound...***\n\n"alivein; get live input (mono)awetl,awetrpconvolvekvol*(alive),"drumsSlp.wav",ipartitionsizeadryldelay(1-kmix)*alive,idel; delay dry signal, to align it with the convoled sigadryrdelay(1-kmix)*alive,ideloutsadryl+awetl,adryr+awetrendininstr2imix=0.5; Wet/dry mixivol=.05*imix; volume level of reverb when wet/dry mix is changed, to avoid clippingipartitionsize=1024; size of each convolution partionidel=(ksmps<ipartitionsize?ipartitionsize+ksmps:ipartitionsize)/sr; latency of pconvolve opcodekcountinitidel*kr; since we are using a soundin [instead of in] we can do a kind of "look ahead"; without output, creating zero-latency by looping during one k-passloop:asigsoundinp4,0awetl,awetrpconvolveivol*(asig),"rv_stereo.wav",ipartitionsizeadrydelay(1-imix)*asig,idel; Delay dry signal, to align it withkcount=kcount-1ifkcount>0kgotoloopoutsawetl+adry,awetr+adryendin</CsInstruments><CsScore>i10201024;play live for 20 secondsi2205"fox.wav"i2255"flute.aiff"e</CsScore></CsoundSynthesizer>