Suggestions for how to generate a click track sync'd to wave file

Jul 18, 2012 at 10:36am

Suggestions for how to generate a click track sync'd to wave file

I have a short wave file (length is 4 beats) that I need to play as a loop and that will be heard for about 16 bars at occasional points in the song.
I’m going to have to feed our drummer with a click derived from this loop so that he can make sure that the band is always playing at the right speed for when the loop is audible.

I know I can use sfplay~ to play the wave file and I could use the seek message to start and end it (the actual loop is a few samples less than the actual wavefile) and retrigger that seek message from the bang that’s generated each time the wave file plays.

The problem is that I need to generate a click that triggers every beat, not every 4 beats and I’m wondering how best to do that.

The “obvious” solution that comes to my mind is to have four sfplay~ objects each of which has a seek message with 1 beat’s worth of sample start/end time and then daisy chain them using the “end of play” bang that comes out (and using that bang to generate a click), but this seems quite kludgy.

I’m wondering if anyone knows of a cleaner solution for this.

Thanks,
David

#32333
Jul 18, 2012 at 10:38am

I’m not even sure the ‘seek’ message is good enough as it only seems to have a resolution of 1 millisecond and I would need to have sample-accurate playback to avoid clicks in between each chunk.

#106158
Jul 18, 2012 at 11:17am

By the way, I looked at splitting up the original wave file into four parts which could then be loaded into buffers and played back using the [groove~] object but there does not seem to be any way to detect when [groove~] has finished playing one buffer so that the next one can be started.

#106159
Jul 18, 2012 at 11:47am

How about recording your click track and then sync’n the playback of the two files.

#106160
Jul 18, 2012 at 11:47am

(This is turning into a documentary on problem solving – but maybe it will be useful to someone else)

Looks like I might be able to just have the entire loop in [groove] and then use snapshot to detect the current position and then trigger something every quarter of the way through.

#106161
Jul 18, 2012 at 11:49am

caveat, i am not yet fully awake. here is what i use for click tracks when playing back from (groove).

– Pasted Max Patch, click to expand. –
#106162
Jul 18, 2012 at 12:01pm

OK, problem solved — I suspect this has been solved many times but here’s my quick hack solution in case it’s useful to anyone.

– Pasted Max Patch, click to expand. –
#106163
Jul 18, 2012 at 12:09pm

Sorry, I didn’t realize that others had replied and so I apologize for having ignored the posts (just noticed via email).
@kthozoid, my sympathies, I’ve been up since 4:30am having realized last night that I was going to have to figure something out.
Thanks for your suggestion, which I will have to study, it seems a lot more complicated than what I did so I presume it has other benefits that I don’t yet understand.

#106164
Jul 18, 2012 at 12:20pm

@dhj, no worries. indeed my solution is probably overcooked. it just has a few extra functionalities for metric sub-divisions and altering the click track sounds and that kind of thing.

#106165
Jul 18, 2012 at 12:23pm

ok —- I am not generating the click sound inside Max — I will be sending MIDI events to a remote device that the drummer can hear. So I just needed to make sure that I could break up a long loop into the right number of even segments….not having much familiarity with the MSP side of Max, I wasn’t aware of [groove] and more importantly [snapshot]. Once I discovered the latter, the problem became trivial for me.

#106166
Jul 18, 2012 at 12:36pm

ok, then your solution will do just fine then. and here is a quick (sfplay) version just for the general purpose of completion.

– Pasted Max Patch, click to expand. –
#106167
Jul 20, 2012 at 8:22pm

I just noticed that the groove stuff using a buffer seems to only have audio coming out one channel. The example for groove shows a single channel being split into two. How can I play a stereo sample?

Here’s my current patch

– Pasted Max Patch, click to expand. –
#106168
Jul 21, 2012 at 9:13am

your buffer~ was mono.

– Pasted Max Patch, click to expand. –
#106169
Jul 21, 2012 at 11:24am

Thanks, pid, I had tried that before (although I used a positive value for the duration (while being annoyed that I had to put the duration before the number of channels so glad to see one can put -1 there) and it didn’t work. I’ll check that again.

#106170
Jul 21, 2012 at 12:34pm

This doesn’t work — unless I’m doing something really stupid (which is quite possible), there’s something else wrong.
I’ve attached the patches (and the stereo aiff file) if you’re willing to take a quick look

– Pasted Max Patch, click to expand. –
– Pasted Max Patch, click to expand. –
#106171
Jul 21, 2012 at 7:50pm

Works here.

– Pasted Max Patch, click to expand. –
#106172
Jul 21, 2012 at 8:34pm

Hmmm, that’s Max 6 — I’m doing it with Max 5 right now — I wonder if that’s an issue.
(But at least I know there’s nothing wrong with the sample or my patcher)

#106173
Jul 21, 2012 at 9:12pm

Try this…

– Pasted Max Patch, click to expand. –
#106174

You must be logged in to reply to this topic.