--env:SSDIR+=../../SourceMaterials sr = 44100 ksmps = 32 nchnls = 2 0dbfs = 1 /*****Simple convolution*****/ ;example for CsoundQt ;written by joachim heintz ;apr 2009 / jan 2022 / jan 2024 ;using the code from matt ingalls (manual for pconvolve) ;please send bug reports and suggestions ;to jh at joachimheintz.de //output display in CsoundQt opcode CsQtMeter, 0, SSak S_chan_sig, S_chan_over, aSig, kTrig xin iDbRange = 60 ;shows 60 dB iHoldTim = 1 ;seconds to "hold the red light" kOn init 0 kTim init 0 kStart init 0 kEnd init 0 kMax max_k aSig, kTrig, 1 if kTrig == 1 then chnset (iDbRange + dbfsamp(kMax)) / iDbRange, S_chan_sig if kOn == 0 && kMax > 1 then kTim = 0 kEnd = iHoldTim chnset 1, S_chan_over kOn = 1 endif if kOn == 1 && kTim > kEnd then chnset 0, S_chan_over kOn = 0 endif endif kTim += ksmps/sr endop opcode SimpConv,aa,SSPVPooo Sfile,Sir,kAmp,kWDmix,kSpeed,iSkip,iLoop,iPartSize xin iPartSize = (iPartSize == 0) ? 2048 : iPartSize iDel = (ksmps < iPartSize ? iPartSize + ksmps : iPartSize) / sr // sound file mono or stereo if (filenchnls(Sfile) == 1) then aSndL diskin Sfile,kSpeed,iSkip,iLoop aSndR = aSndL else aSndL,aSndR diskin Sfile,kSpeed,iSkip,iLoop endif if (filenchnls(Sir) == 1) then ;impulsefile mono aWetL pconvolve aSndL,Sir,iPartSize,1 aWetR pconvolve aSndR,Sir,iPartSize,1 else ;impulsefile stereo aWetL pconvolve aSndL,Sir,iPartSize,1 aWetR pconvolve aSndR,Sir,iPartSize,2 endif aDryL = delay:a(aSndL,iDel) aDryR = delay:a(aSndR,iDel) aMixL = ntrpol:a(aDryL,aWetL,kWDmix) aMixR = ntrpol:a(aDryR,aWetR,kWDmix) xout(aMixL*kAmp,aMixR*kAmp) endop ;declare software channels chn_k "outL", 2 chn_k "outL_clip", 2 chn_k "outR", 2 chn_k "outR_clip", 2 chn_S "_Browse1", 1 chn_S "_Browse2", 1 chn_k "wdmix", 1 chn_k "gaindb", 1 instr Conv // input Sfile = chnget:S("_Browse1") Simpulse = chnget:S("_Browse2") kWdMix = chnget:k("wdmix") kGainDb = chnget:k("gaindb") kGain = ampdb(kGainDb) p3 = filelen(Sfile) + filelen(Simpulse) + 1 // convolution aL,aR SimpConv Sfile,Simpulse,kGain,kWdMix out(aL,aR) //show signal kTrigDisp metro 10 CsQtMeter "outL", "outL_over", aL, kTrigDisp CsQtMeter "outR", "outR_over", aR, kTrigDisp endin i 1 0 1; plays the whole soundfile 829 212 460 389 true 170 170 127 _Browse1 13 107 387 25 {bdb69a5f-4670-41f7-b175-539bc300af19} true 0 -3 left Bitstream Vera Sans 14 3 0 0 0 239 239 239 nobackground _Browse1 98 73 226 29 {ea11a81d-0041-46eb-8d6c-cb10f732f6ff} true 0 -3 value 1.00000000 fox.wav Browse Soundfile / false false false 10 17 19 398 43 {612a67ea-cd5d-4277-a43a-5528190eca4d} true 0 -3 center top Lucida Grande 26 3 0 0 0 255 255 255 noborder 1 0 _Browse2 14 178 387 25 {1fc9a97c-9593-4cc3-92d9-53cc3eaa15d6} true 0 -3 left Bitstream Vera Sans 14 3 0 0 0 239 239 239 nobackground _Browse2 99 140 229 31 {9024b704-1968-4308-a103-455699b9ffb6} true 0 -3 value 1.00000000 impulse_big_hall.wav Browse Impulse Response File / false false false 10 wdmix 67 253 282 29 {70d19d35-4ef8-49be-834d-610194e347bb} true 0 -3 0.00000000 1.00000000 0.58156028 lin continuous -1.00000000 false 145 215 130 30 {7826f399-c364-4e8f-9adc-e86168c42052} true 0 -3 center top DejaVu Sans 14 3 0 0 0 255 255 255 noborder 1 0 27 253 34 27 {173448ab-eeab-471d-b461-fbb89d17b4ad} true 0 -3 left top Lucida Grande 12 3 0 0 0 255 255 255 noborder 1 0 356 254 34 27 {9e0638ae-57cf-415f-8cf2-de5b6dfd4eb5} true 0 -3 left top Lucida Grande 12 3 0 0 0 255 255 255 noborder 1 0 outL 2 289 225 20 {56692e84-8339-4713-bedf-b81a5d5dea6b} true 0 0 outL 0.00000000 1.00000000 0.00000000 1.00000000 -inf -inf fill 1 0.00000000 jump noborder #00FF00 0 234 0 false 0 0 0 true outL_clip 221 289 25 20 {9dbc1525-61ed-4dcc-aeb3-650eb87744db} true 0 0 outL_clip 0.00000000 1.00000000 0.00000000 1.00000000 0.00000000 0.00000000 fill 1 0.00000000 jump noborder #00ff00 196 14 12 false 0 0 0 true outR 2 315 225 20 {09a3dabb-c32b-4652-b07c-a5149e90b11b} true 0 0 outR 0.00000000 1.00000000 0.00000000 1.00000000 -inf -inf fill 1 0.00000000 jump noborder #00FF00 0 234 0 false 0 0 0 true outR_clip 221 315 25 20 {d515ef65-7c19-46c4-a888-c5cbc4e5653c} true 0 0 outR_clip 0.00000000 1.00000000 0.00000000 1.00000000 0.00000000 0.00000000 fill 1 0.00000000 jump noborder #00ff00 196 14 12 false 0 0 0 true gaindb 258 313 176 24 {4d42ff3b-ba28-463f-aaf0-ef8905f4facc} true 0 0 -30.00000000 0.00000000 -14.14772727 lin continuous -1.00000000 false 258 286 45 26 {eccfbfa8-ba49-4ac2-94c3-9d70d1db6028} true 0 0 right top Arial 14 3 0 0 0 255 255 255 noborder 1 0 388 285 45 26 {8b5b92dc-f58e-406e-8262-b117e1a70803} true 0 0 left top Arial 14 3 0 0 0 255 255 255 noborder 1 0 gaindb 305 286 80 25 {126c55f6-ba72-4d42-a3f5-7bf36e0a8269} true 0 0 right top Arial 14 3 0 0 0 255 255 255 noborder 1 0