Multichannel sfplay problem : stops playing after few seconds..?

girault's icon

Hi everyone,

Seems like I'm stuck on something...
I created some 11-channel soundfiles from multiple mono soundfiles and it's impossible to get them played with a "sfplay~ 11" : It stops playing after few seconds (and gives me a bang from the rightmost outlet, as if the sound file was over).

I created them with Sample Manager, but also tried the SoundFilesMerger from Emmanuel Jourdan, it stops everytime after few seconds of playing.
So I assumed there was a mono soundfile corrupted but when I tried to play each mono soundfile individually in a sfplay~ : no problems.
And if I open the 11-channel soundfiles in any DAW : no problems.

Few months back, I created 7, 8 and 9-channel soundfiles the same way and I never had any problems with them. I still can play them today in Max.
What did I do wrong, this time ?! Any idea ?

I'm running Max 7.1 on Mac OS 10.8.5.

The gig's in few days..... Thank you in advance for your answers ;)

girault's icon

Ok, I found the problem but don't really understand it, so maybe someone could help.

In the sfplay~ help, there's the last tab called buffer size where there's written :
"Soundfiles with 9-16 channels are now supported, but it is up to the user to ensure that the disk buffer is an integer multiple of 20160 and the product of the number of channels and the sample type bytewidth-e.g. if one wishes to use 9 channel sound files of all possible bytewidths the diskbuffer must be equal to a multiple 181440=9*20160 bytes. However, if one wishes to use 9 channel sound files that have bytewidths other than 3, the diskbuffer size may be a multiple of 60480=3*20160 bytes because 3 is a factor of 20160."

So I created one 5-channel soundfile and one 6-channel soundfile. Played through "sfplay~ 5" and "sfplay~ 6" synchronized, it works well. yeehay !

But is anyone can explain to me this bytes-buffer-size-bytewidth, I'd be grateful... i.e what should I do to make these 11-channel soundfiles work ?

riccardo dapelo's icon

As far as I understand, it should be a buffersize of 227160.
So if you type sfplay~ 11 227160 it should work, I guess...
ciao,
ric

girault's icon

Oh, as in 11*20160 = 221 760, right ?

I'll try that later !

Trond Lossius's icon

IMHO the sfplay~ object is more than overdue for a total revamp. If there is a general wisdom with respect to what buffer size should be set to for various number of channels, why couldn't that just be hardcoded in the object itself? Back in the OS9 days with limited amounts of RAM and 32 bit applications, I could see why it was necessary to tweak this to balance RAM concerns vs. performance and reliability. But that is hardly a matter any longer. These days foolproof performance has to be the only concern.

Additionally, there is a need to support larger sound files (wav64). In particular when playing longer multichannel sound files, they may easily extend beyond the 2Gb limitations. As spatial audio is one of many areas that Max excel in, better support for large multichannel sound files is needed.

pablo's icon

hello, I am also having at the moment troubles trying to play large multichannel sound files.
I am currently trying to work with a 16-channel 36min file. The smallest size I can get already reducing quality to 44.1kHz 16bit is around 3GB.

I did several tests and Max always crashes beyond 2GB. Incidentally, the biggest it plays is 2.12GB file. sfinfo~ still reports correct information for files up to 4GB. I also find the buffer size tab information quite confusing, but I think that´s not the problem. I am trying different buffer sizes but the crashes always happen after hitting the 2GB file size limit.

I see latest post by Trond is quite recent so I imagine this is still a limitation. I am not only surprised this still happens, but also not to find even more complaints in the forum, with just a few old post mentioning this.

Just in case, any ideas on how to play large files (beyond or at least up to 4GB) within Max ??

Denis's icon

Hello, I am presently struggling with the same problem : sfplay~ stops playing after a random amount of time, and I am only using 6 channel files of a few minutes each i.e. less than 300Mb.
Sometimes sfplay~ restarts playing the same file on its own.
Since the problem appears very randomly it's very hard to determine the cause.
As found in other topics, I am trying to rewrite the patch with buffer~ and play~.