record~, how can I tell it's finished?

eirikobo's icon

I'm using a record~ object to record audio into a buffer. I have a toggle box connected to it to start/stop recording. However, I want a bang message when the record~ has finished, which is when the signal that comes out from the object box has gone from 0 to 1. I want this bang to trigger a "send 0" message to the toggle box, to indicate that the record~ has finished its job. How can I achieve that?
- Eirik

brendan mccloskey's icon

This seems easy, but can you be a little clearer as to your patch? Because I'm not very bright, "when the signal that comes from the object box has gone from 0 to 1" for example is not very clear. Have you used the [select] object before?

Brendan

brendan mccloskey's icon

ps

Max Patch
Copy patch and select New From Clipboard in Max.

1088.stopRec.jpg
jpg
David Butler's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Here's a slightly more elegant way of doing it. The record object outputs a sync signal, which shows the record position as a value between 0 and 1. Therefore, when the value is 1., recording is finished. So we simply convert the signal into a float value and test it to see if the value equals 1. If it does, a message to reset the toggle box back to 0 is triggered.

Noob4Life's icon
Max Patch
Copy patch and select New From Clipboard in Max.

iterating from David's patch, you can get even simpler if you just use change~(signal version) into edge~ like so:

@Brendan, i love the new username! cheers, my fellow noobian!

___________________________________________
*Never fear, Noob4Life was never here!*

Roth's icon

iterating from David's patch, you can get even simpler if you just use change~(signal version) into edge~ like so:

Not only simplier, but [snapshot~] and [number~] can be a significant waste of CPU at times.

Max Patch
Copy patch and select New From Clipboard in Max.

Using [==~] instead of [change~] will make this even more efficient. For example:

This includes another (*SUPER* minor) optimization: using [trigger] instead of a message box when you don't actually need to click the message.

brendan mccloskey's icon

OK,
now it's clear what "when the signal from the object box goes from 0 to 1" means; told you I wasn't too bright, hence the name change Noob4Life!

Brendan

eirikobo's icon

Thank you! This was very helpful.
I also extended it a bit - connected a toggle to a "loop $1" sending to the record~. At the same time, this toggle sends a message to a "!- 1" object, which controls the opening of a "gate 1 1" object. With this setup, a bang will not be sent if the loop setting on the record~ is turned on.

Noob4Life's icon

"hence the name change Noob4Life!"

is that why? here i thought it was because you were modest and were kicking dirt in the face to shallow labels conceived by a shallow video-game industry(where the word, "noob" originated along with the opposite word, "leet"(meaning elite) or more specifically, "733t"). Terms which have more place in hazing rituals among fraternities consisting of meathead jocks than here within the supposedly 'intelligent' technology sector.

i certainly have seen too much from you here to ever think of you as truly being a max noob, Brendan(give yourself more credit).
:)

brendan mccloskey's icon

@Noob4Life
haha

The reason(s) behind the name change, like my fluency in Max, is constantly changing - on the day I changed it, I noticed that all my solution-replies were to Max beginners, simple problems; whereas the more complex challenges left me stumped,

hey ho

ps
"i certainly have seen too much from you here to ever think of you as truly being a max noob, Brendan(give yourself more credit)"

I have good days and bad days

Brendan