Trouble with poke~, quantized loop sampler

Orkester's icon

Hi,
I've been working on a larger patch housing a number of bpatchers to cover all the aspects of audio production I need. I control global time, or numerous simultaneous times, through a number of counters.

I've dumbed it down to one counter for this, my looping patch. Problem is I had it working with record~, but now that I've replaced it with poke~ so that I could overdub continuously, I can't write to the buffer at all.

I'm using groove~ for playback, and everything is timed to bang relative to the downbeat. I was just hoping someone could take a look and suggest why I'm not able to manage continuous overdub. I suspect I am missing something very obvious, I can't get past this hurdle.

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

Thanks

Orkester's icon

Thanks for looking, Devo. I'd looked at index, but I opted to use groove for it's variable rate functions. Are poke~ and groove~ incompatible or something.

I'm sure I could figure out a workaround for all the reverse functions with count~ and index~, but mostly I'm curious why this particular setup isn't writing to the buffer. Is it the timing system?

Tim Lloyd's icon

There are a couple of problems with the patch:

1) You can't use [number~ ] to pass audio through - connect directly from [count~ ] to [selector~ ]

2) [poke~] writes in sample values. If you want to continuously loop record the entire buffer, you need a sample index that goes from 0 to ((sample rate) * (buffer length in seconds)-1) ... so if your buffer is 1 minute long, your index needs to go from 0 to 2,645,999.

This means that [count~] would need to have a modulo of 2,646,000 :)

Orkester's icon

Thanks a lot, Tim. I thought it would be something simple like that. I'm now using mstosamps~ for the conversion, and things are working alright. I'm still getting some grainy distortion, which I think is due to index~ or poke~ not interpolating, as I've read in a few other looper threads. I'll see what can be done about cleaning things up. Though, with this as a basis, now I'm excited to see what cool features I can rig up.

Tim Lloyd's icon

Pay no heed to the poh-pohing of [index~ ], because as long as you playback and record at the same speed, it will output exactly what is in the buffer, sample for sample. There is no need for interpolation if you're playing back at the right speed, which is (sample rate)samples every second.

If that's what you're doing, and you're getting distortion, post the patch up :) I use [index~ ] for looping all the time. Set it up right and it's rock solid.

gavspav's icon

Probably irrelevant but a lot of my looping distortion problems were caused by not paying enough attention to rounding up/down of calculated index float variables.

Wow what a sentence!

Also if you need to do varispeed recordings, ~ipoke is a useful tool.

Orkester's icon

Only irrelevant for what I'm working on at the moment, gavspav. I'm developing these patches for my band to use, so as to not have to carry around a number of other delay/loop pedals, and worry about time sync issues. In the future I might be doing varispeed recording, though it's not in the plans at the moment. Certainly I'll keep that in mind.

I've torn everything apart a number of times now, stuck in the reverse function (!-~ after count), inserted a punch-in/continuous overdub control, and I'm working on a double/half time mode.

I was worried for a bit by some jumps and skips in playback/recording, it wasn't recording downbeats, and there was some phantom noise going on. I think I have it figured out now, there are still some problems, but I'm pretty sure it can be blamed on my soundcard and built in laptop mic. I'll be testing everything out real soon with my proper audio interface, guitar and ASIO settings configured.

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

Here's a simplification of my current patch, as it says in the patch, I have other things being driven by the same counting mechanism. As soon as I have a single channel looper finalized, I'll be hooking it up to the rest of my main interface/timing control, and starting recording with the band soon after. I'll be sure to post some tracks when they're done.