Questions regarding Loop project - buffer~ , ~record and push buttons

kmll's icon

I am fairly new to MAX and for my setup I want to create a simple looper in M4L but I need some advise to progress. This is my first useful project and below I have listed my wanted functionality and the challenges I have for each. Any advise to get me going further will be appreciated.

1) I need to record a variable length sound file. I was planning to use buffer~ -> record~ -> and then groove~ and load the wav file into a waveform~ object and play with the sound from here. However as far as I understand this model forces me to decide the size of the buffer beforehand and this is not ideal because sometimes I want to record something that is 2 seconds and next time maybe 2 minutes. Please advise any alternatives/workarounds.

2) When recording using record~ I want to do this using an "Live press" button. I.e I want to record whilst the button is pressed down and stop recording into the buffer when the button is released. Any suggestion of an object I can do this with?

3) Same as above I want the groove~ to play only when a button is pressed and loop the selected area in the waveform~ until the button is released.

Thanks

vichug's icon

1) 3 possible solutions :
*use buffer~ intially very large, then resize when record comes to end (there are commands for this, see helpfile)
*use initially very small buffer~, record on disk with sfrecord~ then load it with 'replace' message once recording is done (probably cleaner solution)
*patch something that increase size of buffer as it is recorded. I think i saw something like this some times ago on those forums... don't remmeber, it might not have been very clean.

2) pictctrl, button, lcd, ubutton, umenu, live.button, live.tab, live.arrow

3) same as above :)

good luck !

kmll's icon

Thank you for the advise and suggestions:) I also found this thread yesterday and I will experiment with varoius options. Thanks!
https://cycling74.com/forums/recording-in-a-buffer-which-size-grows-as-the-recording-lasts/