Forums > MaxMSP

quick sfplay~ question

April 6, 2007 | 6:47 pm

Hello all,

I’ve got a (hopefully) quick question about sfplay~

When an open file message is sent to an sfplay~ is there a quantifiable delay before playback of the file can occur?
I am currently working with only small files, but my patch is intended to handle aiff files of up to one hour in length and I don’t want to run into problems there.

The MSP reference manual says the following: "When a file is opened, its beginning is read into memory, and until another file is opened, you can play the file from the beginning by sending sfplay~ the message 1"

I am guessing that this means it will be ok, but – forgive me – I’m not entirely familiar with buffers and memory and so on, and I want to avoid constructing the patch badly.

Any answers gratefully received!

cheers,
sam


April 6, 2007 | 8:17 pm

Hi Sam,

The delay for sfplay~ may depend on the computer, but in my experience it is negligible. If you need the file to play 1 msec after loading, that may not happen — but under 1 sec even for slower computers is likely. The best way is to just try it out!

Good luck.

Zachary


April 7, 2007 | 8:54 am

On 6 Apr 2007, at 21:18, Zachary Seldess wrote:

> The delay for sfplay~ may depend on the computer, but in my
> experience it is negligible.

It may be negligible, but it is also unreliable. My take on this is
that "open, 1" is bad practice; since sfplay~ has to prebuffer audio,
it’s not reliable.

If you know in advance the files you want to play, consider
preloading them as cues.

– N.

nick rothwell — composition, systems, performance — http://
http://www.cassiel.com


April 7, 2007 | 9:45 am

On 06-avr.-07, at 20:47, sam wrote:

> When an open file message is sent to an sfplay~ is there a
> quantifiable delay before playback of the file can occur?

If you want to make sure the file is opened when you want to play it,
use preload.

For instance, when you open your patch, open your soundfile, send
[sfplay~] the message "preload 2 mySoundFile.aiff", then, when you want
to play the file, just send [sfplay~] the message "2" (which will
trigger cue 2).

Check the help files and documentation if your need more details.

p


April 7, 2007 | 1:48 pm

Thanks for the advice people – much appreciated.

I am unable to use preload, as the files I need to play are created by max using sfrecord~ while the program is in operation.
My plan is to simply allow a small period of time between sending sfplay~ the open filename.aif message and sending it a 1.

One more thing, if you don’t mind:
I am using sfplay~ to play back several different files one after the other (with gaps inbetween), all played right through from start to finish and played once only. Is there anything to be gained by sending the object an fclose message for each file once it has been used?
I have checked the manual on this but I’m not sure I understand the purpose of the fclose message.

thanks again!

Sam


April 7, 2007 | 2:34 pm


April 7, 2007 | 3:03 pm


April 7, 2007 | 4:59 pm

On 7 Apr 2007, at 14:48, sam wrote:

> I am unable to use preload, as the files I need to play are created
> by max using sfrecord~ while the program is in operation.
> My plan is to simply allow a small period of time between sending
> sfplay~ the open filename.aif message and sending it a 1.

Fair enough. (But if you’re leaving some time between "open" and "1",
which is wise, then you *are* effectively preloading, but only one
file at once.)

– N.

Nick Rothwell / Cassiel.com Limited
http://www.cassiel.com
http://www.myspace.com/cassieldotcom
http://www.loadbang.net


April 7, 2007 | 7:15 pm

Quote: nick rothwell / cassiel wrote on Sat, 07 April 2007 13:59
—————————————————-
>
> On 7 Apr 2007, at 14:48, sam wrote:
>
> > I am unable to use preload, as the files I need to play are created
> > by max using sfrecord~ while the program is in operation.
> > My plan is to simply allow a small period of time between sending
> > sfplay~ the open filename.aif message and sending it a 1.
>
> Fair enough. (But if you’re leaving some time between "open" and "1",
> which is wise, then you *are* effectively preloading, but only one
> file at once.)
>
> – N.
>
>
> Nick Rothwell / Cassiel.com Limited
> http://www.cassiel.com
> http://www.myspace.com/cassieldotcom
> http://www.loadbang.net
>
>
>
>
—————————————————-

yes, I’ve figured that out now! Cheers for the advice all; this side of my patch is now sorted.

S


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