# PvsRecPlay.csd

**URL:** <https://forum.cabbageaudio.com/t/pvsrecplay-csd/1417>\
**Category:** Cabbage recipes\
**Created:** [29 April 2019 07:21 UTC](https://forum.cabbageaudio.com/t/pvsrecplay-csd/1417 "2019-04-29T07:21:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![strapparts](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/strapparts/32/6144_2.png) [@strapparts](https://forum.cabbageaudio.com/u/strapparts)\
**Post date:** [29 April 2019 07:21 UTC](https://forum.cabbageaudio.com/t/pvsrecplay-csd/1417/1 "2019-04-29T07:21:01Z")

</div>

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 = (kPlayNdx_kLoopLen) + kLoopBeg  
elseif kLoopBeg \> kLoopEnd then  
kPlayNdx = kLoopBeg-(kPlayNdx_kLoopLen) ;INVERT  
else  
kPlayNdx = kLoopBeg  
endif  
and I replaced:  
kLoopBeg portk gkLoopBeg, kporttime  
kLoopEnd portk gkLoopEnd, kporttime  
with:  
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?  
Greetings  
I attach the file.  
Andrea S. 2019  
[PvsRecPlay\_07.csd](https://forum.cabbageaudio.com/uploads/default/original/2X/e/e20ce4c60404941d61d42f9bcd12c250bbe34ece.csd) (15.7 KB)

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [29 April 2019 09:03 UTC](https://forum.cabbageaudio.com/t/pvsrecplay-csd/1417/2 "2019-04-29T09:03:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![strapparts](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/strapparts/32/6144_2.png) [@strapparts](https://forum.cabbageaudio.com/u/strapparts)\
**Post date:** [29 April 2019 15:01 UTC](https://forum.cabbageaudio.com/t/pvsrecplay-csd/1417/3 "2019-04-29T15:01:18Z")

</div>

yes, with pleasure!

---

<div class="post-metadata">

**Author:** ![iainmccurdy](https://forum.cabbageaudio.com/letter_avatar_proxy/v4/letter/i/8baadc/32.png) [@iainmccurdy](https://forum.cabbageaudio.com/u/iainmccurdy)\
**Post date:** [29 April 2019 16:37 UTC](https://forum.cabbageaudio.com/t/pvsrecplay-csd/1417/4 "2019-04-29T16:37:47Z")

</div>

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,  
Iain

---

<div class="post-metadata">

**Author:** ![strapparts](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/strapparts/32/6144_2.png) [@strapparts](https://forum.cabbageaudio.com/u/strapparts)\
**Post date:** [29 April 2019 19:26 UTC](https://forum.cabbageaudio.com/t/pvsrecplay-csd/1417/5 "2019-04-29T19:26:52Z")

</div>

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.  
Greetings  
Andrea S.

 ![](https://forum.cabbageaudio.com/uploads/default/original/2X/4/473c6e64eb36d749a613ee56931c7320b3fad9d9.PNG)  
 ![](https://forum.cabbageaudio.com/uploads/default/original/2X/4/42c0d85d00ecef01d24f95a64e559f27733894a5.PNG)  
[PvsRecPlay\_07.csd](https://forum.cabbageaudio.com/uploads/default/original/2X/9/9489d05f90a10d7c3890e6309d966c95bb5c6587.csd) (16.5 KB)

---

<div class="post-metadata">

**Author:** ![strapparts](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/strapparts/32/6144_2.png) [@strapparts](https://forum.cabbageaudio.com/u/strapparts)\
**Post date:** [29 April 2019 19:50 UTC](https://forum.cabbageaudio.com/t/pvsrecplay-csd/1417/6 "2019-04-29T19:50:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![strapparts](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/strapparts/32/6144_2.png) [@strapparts](https://forum.cabbageaudio.com/u/strapparts)\
**Post date:** [30 April 2019 10:47 UTC](https://forum.cabbageaudio.com/t/pvsrecplay-csd/1417/7 "2019-04-30T10:47:25Z")

</div>

Hi Iain,  
Maybe I found a solution to playOnce with speed inversion.  
I attach a csd file.  
What do you think about it?  
Greetings  
Andrea S.  
[PvsRecPlay\_09.csd](https://forum.cabbageaudio.com/uploads/default/original/2X/3/35126e42cc81660590137cc9f47a9a60eee029c4.csd) (15.1 KB)

---

<div class="post-metadata">

**Author:** ![strapparts](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/strapparts/32/6144_2.png) [@strapparts](https://forum.cabbageaudio.com/u/strapparts)\
**Post date:** [7 March 2020 18:14 UTC](https://forum.cabbageaudio.com/t/pvsrecplay-csd/1417/8 "2020-03-07T18:14:48Z")

</div>

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

 ![PVS_Rec_Play](https://forum.cabbageaudio.com/uploads/default/original/2X/6/62407e5c261b35c58c4a758591df57ecb9f170c3.png)  
[PvsRecPlay\_effect.csd](https://forum.cabbageaudio.com/uploads/short-url/jGytnPO5UyXTruFwnA7aQjgy7uW.csd) (25.5 KB)
