'One Button' Sampler
Hi friends,
I'm working on a small modular system and it's becoming apparent that I could find some use in having an audio feed running to computer for some sampling, as a sort of extended feedback loop. I'm wondering if folks had some pointers on building the following:
Audio comes in to Max (from modular)
I hear something (from modular) that I like
I hit one button to record, and hit it again to stop
Record feature can record from X ms prior to hitting 'record'
Samples are automatically numbered/named, in case I want them later
I can call up any of the last X samples with 1/2/3/etc.
The recalled sample is sent back into modular for processing
I've been looking over the ROBO sampling system tutorials and a couple of these goals are in there, but I'm not sure where to start re: editing for my needs. I know I can ditch the MIDI processing, since there's no note info or velocity to handle, just incoming audio. Beyond that I'm not sure what code can be removed that wouldn't brick the system. I also have no experience of JS, in Max or otherwise, but it seems like a solid way of building a naming function for files.
Recording a second or two of the audio before I physically press the button is something I'm not sure how to achieve, either. I'm sure it's possible; I'm thinking it'd be useful since I would hear something unplanned and want some kind of 'monitoring' of the audio feed to cover the gap between "hey cool" and *record press*.
Looking to do this in Max because (a). I'm not interested in modules like MN Morphagene, and (b). I already have Max. Also, recording straight to hard disk would be great if I want to use the captured audio for other things (I reuse audio files a lot across different pieces).
(I also have M4L, so open to the idea of this being a M4L Device).
Hope this is all clear enough. UI would be ultra-simple. Choose folder > turn on audio/patch is 'listening' > hit record > hit stop > sample named and saved, ready to be sent back into the modular.
Thanks!
P.S. - I'm an intermediate level user, but there is no option for that.
The pre recording could be done with circular recording, after you hit the capture button, I would apply some analysis for an onset detection and then the silence after the event, or cut it on the next onset. You could nowadays, in times of cheap memory, have the circular recording buffer very big, and ignore the fact, that from time to time you wrap around...
No code so far, but it could give you some ideas where to start...
I would do following :
use stutter~ object to keep last xx samples of incoming audio in memory.
When You hit record copy stutter memory to recording buffer, and start sampling
into it from stutter sample size position. Like count~ poke~ combo .
After recording is done, crop the buffer and store to disk.
When all this is triggered by signal, there is no discontinuity in recorded
audio.
Take a look in this patch:
There is the karma~ object as well
Not sure [karma~] would work for that: it looks like you still have to press record before sound is played (I'm not familiar with this external, I might be wrong).
With the "snapshot buffer", you might be improvising, and at any time when you think "that was cool", you just bang to get in a buffer the sound you just heard.
Thanks guys! I think a mix of both of those patches should do the job. I had a look at [karma~] as well but I'm not sure it's right for this patch, either.