Having a quick look at the JSFL documentation(pdf link) you only have a handful of properties available:
Property Description
soundItem.bitRate A string that specifies the bit rate of a sound in the library. Available only for the MP3 compression type.
soundItem.bits A string that specifies the bits value for a sound in the library that has ADPCM compression.
soundItem.compressionType A string that specifies the compression type for a sound in the library.
soundItem.convertStereoToMono A Boolean value available only for MP3 and Raw compression types.
soundItem.fileLastModifiedDate Read-only; a string containing a hexadecimal number that represents the number of seconds that have elapsed between January 1, 1970, and the modification date of the original file (on disk) at the time the file was imported to the library.
soundItem.originalCompressionType Read-only; a string that specifies whether the specified item was imported as an MP3 file.
soundItem.quality A string that specifies the playback quality of a sound in the library. Available only for the MP3 compression type.
soundItem.sampleRate A string that specifies the sample rate for the audio clip.
soundItem.sourceFileExists Read-only; a Boolean value that specifies whether the file that was imported to the Library still exists in the location from where it was imported.
soundItem.sourceFileIsCurrent Read-only; a Boolean value that specifies whether the file modification date of the Library item is the same as the modification date on disk of the file that was imported.
soundItem.sourceFilePath Read-only; a string, expressed as a file:/// URI, that represents the path and name of the file that was imported into the Library.
soundItem.useImportedMP3Quality A Boolean value; if true, all other properties are ignored, and the imported MP3 quality is used
At the moment I can only think of a couple of hacky workarounds...well one in two versions:
- have the person exporting the sounds also export a .txt with the same name as the sound, which contains the length of the sound. You can load and read this file using FLfile, then using the document's frame rate, calculate the number of frames needed
- similar to the above method, you can whip out a command line tool whose sole purpose is to output the length of an audio file(using the sound's sourceFilePath property) or using an existing tool(*). You can call a command line application using the undocumented
FLfile.runCommandLine()
.
A few examples of command line tools are ffmpeg(e.g. ffmpeg -i yourAudioFile
) or MediaInfo. I'm sure there are others out there. It depends what operating system you need to use and if the tool can be easily installed. Ideally you would use something that outputs just the duration, but if you get more data, you should be able to parse the output and get the duration. Also note that that the function will return 1 for successful execution or 0 otherwise, so you will need to have a command that will also write the output to a text file you can read with jsfl.