Measure length of time key was pressed for looping?

    Jun 23 2012 | 9:53 pm
    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:

    • Jun 24 2012 | 3:30 am
      not sure what you are looking for exactly... but look at [timer] and [clocker]...
      maybe this?
    • Jun 24 2012 | 4:37 pm
      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.
    • Jun 24 2012 | 5:45 pm
      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.