(resolved) how to get length of audio sample in buffer (not buffer length)

thispatcher's icon

Hi lovely forumers, I thought using info~ would give me the length of the sample loaded into buffer, but it's giving me the buffer length instead. I'm open to a js-based solution, or any max obj that will accomplish this.

Many thanks!

Jean-Francois Charles's icon

[info~] help file -> "samples" tab?

thispatcher's icon

Hey Jean-Francois! Thank you so much. However, this is still only giving me the length of the buffer~, but not the length of the audio file loaded into the buffer. Any suggestions towards that end?

Jean-Francois Charles's icon

When you load the buffer~ with the replace message, the buffer~ will be resized to the length of the audio file, so the length will be the same.
Otherwise, maybe you really want to use [sfinfo~]?

thispatcher's icon

> When you load the buffer~ with the replace message, the buffer~ will be resized to the length of the audio file, so the length will be the same.

ah that was it. I had been using the 'read <soundfile>' message, not the 'replace <soundfile>' message. thanks again!