quick sfplay~ question

Apr 6, 2007 at 6:47pm

quick sfplay~ question

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

#31233
Apr 6, 2007 at 8:17pm

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

#101172
Apr 7, 2007 at 8:54am

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

#101173
Apr 7, 2007 at 9:45am

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

#101174
Apr 7, 2007 at 1:48pm

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

#101175
Apr 7, 2007 at 2:34pm

#101176
Apr 7, 2007 at 3:03pm

#101177
Apr 7, 2007 at 4:59pm

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

#101178
Apr 7, 2007 at 7:15pm

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

#101179

You must be logged in to reply to this topic.