Record as long as space bar is held
This patch records while the spacebar is held down, and starts looping when the spacebar is released.
Set the buffer~ size to the largest duration you want to try to accommodate. Use a key object connected to a sel object to send a 1 message to a record~ object, and use keyup connected to sel to send a 0 message to the record~ object. Use a timer object to measure the time between key to sel and keyup to sel. Use the time output of the timer as the second argument of a start message to play~. (And have the ‘loop’ attribute of play~ set to ‘1’.)