Forums > MaxMSP

sfplay~ cues set from end of file

November 6, 2009 | 9:09 am


I am trying to trigger an event (a bang would be fine) from the sfplay~ object.

I have a number of small (about 100ms but they vary from 94 to 278) wavs, and would like to place a cue a set time from the end of the file. So I want to have a cue that always occurs say 30ms from the end of the file. if it is 100ms long the cue would be at 70ms if it was 250ms the cue would be at 220ms. The cue is not meant as a guide for the playback of the file, rather I want it to send out a bang while the file continues to play to the end.

Is this possible with sfplay? If not, do you have any recommendations on how to achieve it?

I have worked out a patcher that I think will work but it seems very ungainly especially when loading sounds every 100ms into 2 sfplay objects. The patcher is below. Thanks for any help


– Pasted Max Patch, click to expand. –
November 6, 2009 | 9:57 am

Here is asmall patch that may help you.

You don’t really need the [sflist~] and could preload directly into [sfplay~], but I like to use [sflist~].

This is one of the few patches I did that needs a [del¬†10] to solve some ordering/scheduler/? mystery. The usual [deferlow]¬†doesn’t work here. There may be something I don’t understand…
Anyway, as your wav are longer than 94, it shouldn’t be an issue.

BTW, you don’t need to load sounds every 100ms, you can simply preload them all at startup.

– Pasted Max Patch, click to expand. –
November 6, 2009 | 10:31 am

When you preload the files at the beginning you could also store their lengths in a [coll] using the preload number as the index. Then you can use the [coll] to query the length instead of relying on [sfinfo~] and do away with the [del] object.


November 6, 2009 | 3:55 pm

Patrick and Thereoishopeforus,

Thanks for the suggestions. I completely missed the line in the documentation saying how you could add an outlet to display positioning info. Pre-loading everything will be much easier as well. Your solutions will work much better than the solution I came up with. Thank you for the help.


Viewing 4 posts - 1 through 4 (of 4 total)

Forums > MaxMSP