Cabbage Logo
Back to Cabbage Site


Hi to all,
I modified PvsRecPlay.csd by Cabbage McCurdy collection, because I could used it.
This .csd is very nice but:
In downloded version PlayOnce didn’t work correctly, because after ‘else’ was missing:
kPlayOnceNdx line 0,1,1
Moreover I insert this ‘if’ conditions:
if kLoopBeg < kLoopEnd then
kPlayNdx = (kPlayNdxkLoopLen) + kLoopBeg
elseif kLoopBeg > kLoopEnd then
kPlayNdx = kLoopBeg-(kPlayNdx
kLoopLen) ;INVERT
kPlayNdx = kLoopBeg
and I replaced:
kLoopBeg portk gkLoopBeg, kporttime
kLoopEnd portk gkLoopEnd, kporttime
kLoopBeg = gkLoopBeg
kLoopEnd = gkLoopEnd
to avoid crash with begin and end point very close together.
I reduce stereo in to mono, but you can restore to stereo changing the lines with *** flags.
I added play midi instr and global envelope also.
‘Play Once’ button blink correctly now, when it turn off.
Maybe this version can be useful to someone else.
Unfortly there is an unwanted effect:
At loop, the first time the sound is better, then it’s more metallic.
Does anyone know how to avoid this?
I attach the file.
Andrea S. 2019
PvsRecPlay_07.csd (15.7 KB)

Thanks @strapparts, I’m curious to see what Iain thinks of the changes. If he’s happy with them I can update the example file.

yes, with pleasure!

Hi Andrea,
Thanks for using this and developing it. I tried out your version and I like the keyboard addition that you made.
I’m not able to recreate the issues that you describe and that inspired some of the changes you describe. For me, ‘Play Once’ works as it should. I’m also unable to make it crash by making the loop duration zero - the line:
kPlayPhasFrq divz gkSpeed, kLoopLen, 0.00001
should be preventing this anyway.
The portk lines are intended to smooth changes made to the ‘start’ and ‘end’ loop times so that interim values, that pixel resolution makes inaccessible, are explored. Of course it’d debatable how effective and necessary this is in practice. It might be more useful with longer loops.
The addition of this line:
kPlayOnceNdx line 0,1,1
is not needed because the else is follows is not in the same conditional level as the initial ‘if’. What this means is that the second kPlayOnceNdx line 0,1,1, if accessed, is simply overwriting the first one, which will already be being accessed.
Do you think that the envelope attack and release times are too long? Maybe they should be user-adjustable.
I think the metallic quality you describe when looping repeats is a glitch in the pvs implementation. mis-alignment between freq and amp bins? I’m not really sure what’s causing it but modifying the FFT attributes given to pvsanal should alter its character.
I’d like to be able to recreate the problems you describe though. Are you on Windows? On Mac it seems fine with the latest version of Cabbage.
Greetings back,

Hi Iain,
Thanks for your replay. I am on Windows 10 and I use last version of Cabbage. I attach two snapshot, with kPlayNdx and kPlayOnceNdx values printed when begin and end point are very close to each other. With those values the sound stop.
Moreover, when I invert the order begin-end point, I don’t listen to the same selection of sound.
Maybe can the optional ‘isig’ of portk cause problems? Or is it Windows Csound release?
About metallic sound: I’ll try other settings. It’s strange that the first loop is better than the following.
I attach an other version with attack and release adjustable.
Andrea S.

PvsRecPlay_07.csd (16.5 KB)

I realize now that in ‘PlayOnce’ speed slider set to negative side does not work well yet.

Hi Iain,
Maybe I found a solution to playOnce with speed inversion.
I attach a csd file.
What do you think about it?
Andrea S.
PvsRecPlay_09.csd (15.1 KB)

I send the effect plugin that I used in a performance some month ago.
Any suggestions are appreciated.
All the best.
Andrea S.

PvsRecPlay_effect.csd (25.5 KB)