# Io Reference

Audio / LibSndFile / LibSndFile

|  | An object for encoding and decoding audio files (principally WAV and AIFF) using the Libsndfile library.

channels

Returns channels read from the audio file.
close

Closes the file if it is open. Returns self.
format

Returns format read from the audio file.
formatNames

Returns a list of strings with the names of the supported codecs.
openForReading

Opens the file at the path specified in the path slot and sets the following slots:

    frames
    sampleRate
    channels
    format
    seekable

Returns self.
openForWriting

Opens the file at the path specified in the path slot for writing. The following slots should be set first to specify the output format:

    sampleRate
    channels
    format

Returns self.
outputBuffer

Returns the output buffer.
path

Returns path to audio file.
read(numberOfFrames)

Read a given number of frames (sample pairs). Returns self.
sampleRate

Returns sample rate read from the audio file.
setFormat(aSeq)

Sets the format used for writing. Use the formatNames method to get a list of supported format names. Returns self.
setPath(aPath)

Sets path to audio file.
write(aSeq)

Writes aSeq using the format specified by the slots:

    sampleRate
    channels
    format

Returns the number of frames written.