Getting Buffer Info

Hi there -

Is there a way to receive information about an audio file before attempting to load it into a Buffer?
I’d like to determine the number of frames and channels in audio file before attempting to load it.

Thank you!

Do you mean as follows?

(
~soundFiles = Platform.resourceDir +/+ "sounds" +/+ "*";

// ~soundFiles = "sound".resolveRelative +/+ "*"; 
// ~soundFiles = thisProcess.nowExecutingPath.dirname +/+ "sounds" +/+ "*";
// These codes only work if the SCD folder where the code is evaluated contains "sound" folders.

~sndsToBuf = SoundFile.collect(~soundFiles)
)

~sndsToBuf[0].numChannels
~sndsToBuf[0].duration
~sndsToBuf[0].sampleFormat
~sndsToBuf[0].sampleRate
~sndsToBuf[0].numFrames
~sndsToBuf[0].headerFormat

~sndsToBuf[0].inspect
1 Like