Sound Files
Sound Files Saving Sampled Sounds in FilesavailableCmd33Although most sampled sounds that you want your application to produce canavailableCmd@Ebe stored as resources of type 'snd ', there are times when it is preferable toavailableCmdM6store sounds in sound files, not in resources. For example, it is usuallyavailableCmdZ;easier for different applications to share files than it is to share resources. SoavailableCmdg-if you want your application to play sampled sounds created by otheravailableCmdt3 applications (or if you want other applications to be able to play sampledavailableCmd 6sounds created by your application), it might be better to store the sampledavailableCmd Asound data in a file, not in a resource. Similarly, if you are developingavailableCmd 2 versions of your application that are intended to run on other operatingavailableCmd F systems, you might need a method of storing sounds that is independent of theavailableCmd -Macintosh Operating System and its reliance on resources to store data.availableCmd@Generally, it is easier to transfer data stored in files from one operatingavailableCmd4system to another than it is to transfer data stored in resources.availableCmdË8There are other reasons you might want to store some sampled sounds in filesavailableCmdı;and not in resources. If you have a very large sampled sound, it may beavailableCmd 5impossible to create a resource large enough to hold all the audio data.availableCmd 3Resources are limited in size by the structure of resource files (and inavailableCmd 5particular because offsets to resource data are stored as 24-bit quantities).availableCmd @Sound files, however, can be much larger because the only size limitations areavailable6Athose imposed by the file system on all files. If the sampled data for some soundavailableCmd Aoccupies more than about a half megabyte of space, you should probably storeavailableCmd the sound as a file.availableCmd ;To address these various needs, Apple and several third-party developersavailableCmd /have defined two sampled sound file formats, known as the AudioavailableCmd <Interchange File Format (AIFF) and the Audio Interchange File Formatavailable ;extension for Compression (AIFF-C). The names emphasize that the formatsavailableCmd @are designed primarily as data interchange formats. However, you should findavailable Bboth AIFF and AIFF-C flexible enough to use as data storage formats as well.available 4Even if you choose to use a different storage format, your application should beavailablePable to convert to and from AIFF and AIFF-C if you want to facilitate sharing ofavailable sound data among applications.availableCmd AThe main difference between the AIFF and AIFF-C formats is that AIFF-CavailableCmd 0allows you to store both compressed and noncompressed audio data, whereasautomatically7AIFF allows you to store noncompressed audio data only. The AIFF-C format isavailableCmdEmore general than the AIFF format and is easier to modify. The AIFF-C formatavailableCmd6can be extended to handle new compression types and application-specific data.automatically+3As a result, you should revise any application that currently supports onlyavailableCmd82AIFF files to also support AIFF-C files. An application that currently readsautomaticallyE6AIFF files should also be able to read AIFF-C files. An application thatautomaticallyR7currently writes AIFF files should also be able to write AIFF-C files. It isavailableCmd_8recommended that the default write format be AIFF-C. The following Tableautomaticallyl2summarizes the capabilities of the AIFF and AIFF-C file formats.automatically AIFF and AIFF-C capabilitiesavailableCmd File Read Read Write WriteavailableCmd type sampled compressed sampled compressedavailableCmd AIFF Yes No Yes Noautomatically