The UMSAudioFile is a base class used by both the UMSAudioPlayer object and the audio_editor application. For example, the UMSSndFile is an implementation of the base class for a SND file, and a UMSWavFile is an implementation of the base class for a WAVE file. The UMSAudioFile base class provides an abstraction to an audio file that can be mapped onto various audio file formats. This permits other implementations of the base class for new file formats which can be used as UMSAudioFile objects. The UMSAudioFileMClass metaclass has the following method:
make_by_pathname
This method detects the file type of a given file and instantiates the corresponding UMSAudioFile object as specified for that file type in the UMS_config configuration file. This permits the UMSAudioPlayer object to inherit support for new file formats without being modified or recompiled.
To learn more about UMSAudioFile, see:
For introductory information, see Programming with Formatted File Access Objects.
UMSAudioFile object method calls include:
The UMSAudioFile provides an abstraction to a file containing audio data. The underlying file is associated with the UMSAudioFile object through the open method and disassociated through the close method. The data in the file is accessed through the read method. File can be created or modified through the write method.
All six audio attributes (audio format, number of channels, number format, samples per second, bits-per-sample, byte_order) can be set through the corresponding set methods before reading or writing to the file.
get_ methods can get the current settings of the audio attributes. The current file location is set through the seek method or queried with the get_position method, which returns the location in the time units specified by the TimeFormat parameter.
There are two types of audio files: formatted and raw. Formatted files have audio attributes stored with the audio data; raw files have no audio attributes in the file. To determine whether the file has audio attributes, use has_attributes. Audio attributes are read and initialized when a file is opened and written when a file is closed.
For introductory information, see Programming with Formatted File Access Objects.