Stumped with Gen~ problem

AudioMatt's icon

I'm driving a system with a phasor~ and I'd like to live-record a loop. I'm thinking something similar to ableton live where you hit record and when the phasor~ rolls around to 0 it starts recording, then when the phasor~ rolls around to 0 again it stops recording and starts playing.

***I'm @#$%ing stumped***

I could probably fake it in MSP but I'm trying to learn gen~.

This seems very tough to do in a sample accurate way. Any ideas?

AudioMatt's icon

This is some interesting work. The trick (for me) is getting this all to happen once and not repeat. You've given me ideas. I'll update you soon.

Christopher Dobrian's icon
Max Patch
Copy patch and select New From Clipboard in Max.

This is not a gen~ solution, so it won't help you in your quest to learn gen~, but this patch does what you describe in straight MSP. Note that for the phasor~ to truly lock to the transport, the scheduler has to be in Audio Interrupt mode (which is the function of the set_dsp_takeover subpatch). You could make adjustable-length loops with just a little modification, but I hard-coded this example to record one measure of 4/4 for simplicity's sake.

Graham Wakefield's icon

Hi there,

Max Patch
Copy patch and select New From Clipboard in Max.

Here's a gen~ based bar-synchronized looper. Have fun tweaking it!

AudioMatt's icon

wow that's simple.

AudioMatt's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I just noticed that this went into the examples folder. There's a bug. It doesn't play back at the right rate. Here's my work around