Measure length of time key was pressed for looping?

Jun 23, 2012 at 9:53pm

Measure length of time key was pressed for looping?

Hey all,
My brain is sort of fried at the moment and I’m trying to put together this looper that I modified from that Delicious Tutorial (if you’re familiar) but his has a set time of 4 seconds, whereas I want to be able to start a loop and end it, and that’s my loop time that everything else will be based on. Any ideas? Here is what I have:

– Pasted Max Patch, click to expand. –
#43869
Jun 24, 2012 at 3:30am

not sure what you are looking for exactly… but look at [timer] and [clocker]…

maybe this?

– Pasted Max Patch, click to expand. –
#157553
Jun 24, 2012 at 4:37pm

Thanks for your help! That was a good start for me.
It brought up a few more questions, which is good. First, I’m hoping to only send that number coming out of clocker once the user has released the spacebar. So would the best way to do that be to have a keyup event bang the output? That seems to make sense, unless there is an object that does all the work for me.
More importantly, changing the buffer length in ms seems to be tricky. What is the correct message to send to turn the ms from clocker to the new buffer length? In addition, I’m not exactly sure what dspstate is doing for me here, but I need to adjust that number as well. I’ve tried a few configurations but it’s not working. It seems that sending the sizeinsamps message to buffer also clears it :(
And to generally clear up what I’m trying to do: a simple looper in which the first loop the user sets determines the loop length, which all future loops will follow. The loop is recorded when spacebar is held down, and it stops when it’s released.

#157554
Jun 24, 2012 at 5:45pm

You can send the message crop followed by the start and end position to [buffer~]. However, normally I wouldn’t change the buffersize. I would change the length for the playback part only. Here’s a starting point.

– Pasted Max Patch, click to expand. –
#157555

You must be logged in to reply to this topic.