GEN GRAINSTRETCH - USING GEN 100% CODE BOX CODE

jo geisler's icon

Dear all,

i have programmed a looper (100% code box code) in gen where I use a master counter to read through the buffer recordings using peek. I currently slow down and speed up the loopers by increasing or decreasing (>1 or <1) the counter steps. I want now to incorporate time stretch and found the grain stretch object which sounds great but has unfortunately 2 limitations:

1. It is not written in gen - as I have a sample accurate implementation it will not work for me
2. What I understood from grainstretch implementation is that the loop length is equal to the buffer size. In my implementation the loop length is always different to the buffer size as I dynamically calculate loop length on the fly.

So here are my questions:

Is there any gen grain stretch implementation (or similar) which I could utilize?
It would be great to have an implementation that utilizes code box code which would make it possible to integrate it in my looper implementation.

Any hints, links or thoughts are welcome.

BR

Jo

jo geisler's icon

Dear,

if you are gen experts please provide a hint where I could get answers to my question.

BR

Jo

.quasar's icon

Hi Jo,

I think the following project by Brendan McCloskey should give you pretty much what you need to get started :

https://cycling74.com/projects/granary-a-hybrid-granulation-engine

The actual granular process is done entirely in gen~ and you can easily modify it as you wish.

Evan's icon

I'm actually in the process of implementing time stretchin/pitch shifting via granular in a looper I am doing in codebox - I started with the ola.granular example that comes with Max. Got some good stuff happening from that. There's probably a bunch of different ways to do it, depending on what exactly you're after.

jo geisler's icon

Dear all, was on holiday so I just can thank you for your feedback a little bit late ;-)

I checked Brendan McCloskeys Implementation. Unfortunately it is not a documented code box code but rather a gen object patch.

To EVAN: I would love to have a look in your gen codex code implementation to see if I could utilize parts it in my looper project.

BR

Jo

Evan's icon

The granular technique I'm using is based entirely on the ola.granular example that comes with Max.

If you want to see the gendsp file, I can send it over, but its over 1000 lines of code and not very well commented.

I'd be happy to give you some help if you get stuck after playing with the example I referenced above, or if you have any specific questions. I fear that just sending you my gen code will likely cause more confusion than answers.

Its not too tough to translate objects to codebox. If you pop open the code pane, gen will show you the text equivalent of the objects.

Gregory Taylor's icon

The fact that Brendan's excellent patching isn't in a codebox makes no difference in terms of speed. Operators and codebox contents are all converted to GenExpr for compiling on the fly. Exporting code exports operators and codebox content without prejudice. The man who created gen~ tends to mix and match in his patches, come to that.

jo geisler's icon

EVAN, thanks for your support. I will then start with Brandons Patch and try to translate it to genCode. In case I get stuck concerning a specific questions I will get in touch with you. Thanks Jo