How can I take the BPM from 'bang'?

Shaun Hu's icon

Like a vibrate signal in (heartbeat) using it to 'bang',can I using the time between two 'bangs' to find out BPM?I want use the number of BPM to control a audio to make it have diffrent rythm

Peter Ostry's icon

For example:

Use [timer] to get milliseconds between bangs (see timer help file).
Then [expr] to divide 60000/ms. This gives the BPM value for quarter notes.
Then [prepend tempo] to a running [transport] (see transport help file).

You may have to solve a couple of issues:

The first bang will give you a very long time. If this is a problem, find a way to ignore the first bang. You can identify a first bang by its long time and block it with a [gate] for example. This can generally avoid too slow tempi caused by dropouts.

With an unstable bang tempo, your musical tempo may vary too much. If this is a problem, find a way to smoothen the tempo changes. For example take the time-average of 3, 4 or more bangs to calculate the new tempo. A more rubberband-like method can be implemented with [line] where you limit the speed of tempo changes. A combination of both methods can be very effective.

I am sure there are more and probably better ways to handle unstable incoming bangs. I just mentioned what I usually do.

personal_username's icon

Have a look at "global transport" patch, in the extra menu. There's a "tap" function to detect bpm from bangs.

chrlilje's icon

To use the timer object to get the time between two bangs, use a toggle box and route on 0 and 1

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

(I found this question searching for the same, and thought I would post my solution)

rknLA's icon

For reference, since the Global Transport is actually slightly difficult to open up and peek, this is what's done there:

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