/ HALion Developer Resource / HALion Script / Reference /

AudioFile.open

AudioFile.open(filename)

Description

The AudioFile.open function creates an AudioFile object of the specified audio file. The AudioFile object can be used to retrieve information from the audio file, for example, the sample rate, bit depth, length in samples, etc. The location of the audio file can be a folder or a VST Sound archive.

Available in: Controller.

Arguments

ArgumentDescriptionValue Type
filenameThe file path and name of the audio file.string

Return Values

Returns an AudioFile object of the specified audio file.

Example

-- Open an audio file from Skylab.
fname = "vstsound://F29C895D6D8E4D6C9BCBBA5198412192/.samples/Ambient Pad 01/Ambient Pad 01 - C3.tg3c"
af = AudioFile.open(fname)
-- Print the sample rate and bit depth.
print("Sample Rate: "..af.rate)
print("Bit Depth: "..af.bits)

See also: AudioFile, getPeak