Files of this type and auxiliary type contain instruments in the Apple IIGS Sampled Instrument Format (ASIF).
The Apple IIGS Sampled Instrument Format (ASIF) is the standard format used for storing Apple IIGS Sampled Instruments on disk. All sampled instruments supplied by Apple for the Apple IIGS Note Synthesizer will use this format. Likewise, all utilities supporting Note Synthesizer sampled instruments will also use this format.
ASIF is designed around the needs of the current Apple IIGS Note Synthesizer and Apple IIGS sound hardware. While the format of ASIF (especially INST chunks) is greatly influenced by the Note Synthesizer, the information may be sufficient for other sampled sound synthesizers to accurately render the sound.
Most instrument files for the Apple IIGS have a ProDOS file type of $D6. ASIF files are instead identified as file type $D8, auxiliary type $0002 because of their sampled nature. All other instruments for the the Apple IIGS will be identified by file type $D6.
Note: Earlier ASIF documentation, not widely circulated, defined ASIF files as file type $CA, auxiliary type $8000. As documented in this Note, ASIF has been reassigned to file type $D8 and auxiliary type $0002. Applications which read files based on the old file type and auxiliary type should not perform adversely, since no other application should be creating files with that combination. However, we strongly urge developers to create ASIF files with file type $D8 and auxiliary type $0002 only. We further encourage developers to revise existing programs to use this new assignment at their earliest convenience.
ASIF files conform to the "EA IFF 85" Standard for Interchange Format Files developed by Electronic Arts. Electronic Arts additionally has some public domain code available for reading and writing IFF files.
ASIF is provided more for compatibility than for interchange. It is a highly Apple IIGS specific file format. Those wishing the highest level of sampled sound compatibility across programs and CPUs should use Audio Interchange File Format (Audio IFF). Audio IFF is documented in Apple II File Type Note for file type $D8, auxiliary type $0000.
This Note defines the required chunks INST and WAVE, as well as the optional ("NAME"), copyright ("(c) "), author ("AUTH"), and annotation ("ANNO") chunks. These are all "standard" chunks. Additional chunks for private or future needs may be added later. Figure 1 illustrates the ASIF format in a box diagram.
An ASIF file consists of a single FORM ASIF, which contains one and only one WAVE chunk and one or more INST chunks. Each ASIF file defines at least one instrument.
INST chunks contain all of the Note Synthesizer specific information needed to define an instrument, exclusive of the actual wave form. The information in the INST chunk defines the characteristics of an instrument such as the envelope, pitch range, and maximum pitch bend. There must be at least one INST chunk for each instrument in the ASIF file.
WAVE chunks contain the waveforms for a given instrument. A WAVE chunk may contain waveforms used by more than one instrument. In most cases, the waveforms used by an application will be merged into a single 64K block that is loaded into DOC RAM when the application is launched. In this case, there would be several INST chunks referring to that single WAVE chunk. Most music applications will probably store instruments one to a file, which is the preferred way of distributing ASIF instruments.
Note: The length of any chunk must be even. If a chunk has an odd length, a pad byte of $00 must be added to the end of the chunk. The pad byte, if present, should never have a value other than $00.
Immediately following the 12-byte FORM chunk header are the data chunks of the ASIF file. There most be one and only one WAVE chunk, and at least one INST chunk. Optionally there may be name ("NAME"), copyright ("(c) "), author ("AUTH"), or annotation ("ANNO") chunks. All data chunks are part of the larger FORM chunk, referred to as the FORM ASIF because of the ID and Type of this chunk.
Note: The length byte of InstName is also referred to as INameLength.
The InstSeg is a three-byte linear segment that describes a level and a slope. The level is called the breakpoint and represents the linear amplitude of the sound. The slope is described by an increment added or subtracted from the current level at the update rate. Regardless of the increment, the breakpoint will never be exceeded. All ASIF instruments assume an update rate of 200 Hz. The increment is a two-byte fixed pointer; that is, the lower eight bits represent a fraction. Thus when the increment is one, it represents 1/256. In this case, the increment would have to be added 256 times (1.28 seconds) to cause the level to go up by 1. At a 200 Hz update rate each increment takes 5 milliseconds. If an application wishes to use an update rate other than 200 Hz, the envelope must be scaled as necessary. If the envelope is not scaled, the instrument will not sound correct.
The breakpoint is a byte between 0 and 127 ($00 and $7F). It should represent sound level in a logarithmic scale: every 16 steps change the amplitude by 6 dB.
Therefore the envelope is composed of eight InstSegs:
Increment 1 is used to go from the initial level of 0 up to the level of breakpoint 1. Increment 2 is used to go from breakpoint 1 to breakpoint 2, and so on. The sustain level of the envelope, if there is one, is created by setting the increment to zero, causing the envelope to get stuck on that level. The last segment used for release should always have a breakpoint of zero, so the sound eventually reaches silence. Unused segments should have a zero breakpoint and a non-zero increment.
The WaveList structure is a variable-length array where each entry is six bytes long. The information is particular to the DOC, and the developer should refer to the DOC information in the Apple IIGS Hardware Reference and the Apple IIGS Toolbox Reference Update when creating instruments. Each six-byte entry represents a waveform and contains information about the allowable pitch range of the waveform. This means that the waves can be "multi-sampled" across an imaginary keyboard. When a note is played, WaveListA and WaveListB will be examined, and one waveform will be picked and assigned to each oscillator.
Each wave in a WaveList has the following 6-byte format:
The next three bytes will be stuffed into the DOC registers:
The WaveList structure is designed to give greater flexibility in creating realistic instrumental timbres. It allows "multi-sampling" with different samples of sounds on different ranges of pitch. It allows mixing of various sized wave forms, with different tuning on each semitone, to allow separate tuning of each note. This is one way to duplicate special tuning systems like "just temperament." The wave pointers need not be different in this case, just the RelPitch fields.
Tuning is accurate to 1/128 of a semitone in the Note Synthesizer, subject to the resolution setting of the DOC. For accurate tuning on lower notes, it may be necessary to use higher settings in the DOC resolution register.
Note: The Audio Interchange File Format (Audio IFF) also has a chunk named "INST" which will appear to a standard IFF reader the same as the ASIF "INST" chunk. To tell the two apart, check the ckSize field. The Audio IFF "INST" chunk will always have ckSize of 20 bytes, and the ASIF "INST" chunk will never have a chunk size of 20 bytes.
Note: The length byte of WaveName is also referred to as WaveNameLen.
SampleTable is a table of the waveforms corresponding to different "samples". Each entry in SampleTable is 12 bytes long. Each sample entry is defined as follows:
There are NumSamples of these sample entries in the SampleTable.
There are currently three types of optional data chunks. These chunks may be included in an ASIF file if desired. They are considered part of the set of "standard" chunks in the Electronic Arts "EA IFF 85" definition.
This chunk names the instrument of collection of instruments defined in the ASIF file. This chunk may be used to supply a display name for a collection of instruments. This can be useful since IFF programs know about the NAME chunk, but may not know about the name field in INST or WAVE chunks.
There are many types of IFF chunks other than those described in this document. New chunks may be added to ASIF files in the future. If an application encounters a chunk it doesn't recognize when reading an ASIF file, it should ignore it. Note that all chunks should be preserved when copying an IFF file.
Figure 1 illustrates a sample ASIF file as a box diagram.
-------------------------------------------- | 'FORM' 76112 | | | | -------------------------------------- | | | 'ASIF' | | | | | | | | -------------------------------- | | | | | 'NAME' 9 | | | | | | "Jazz Band" | | | | | -------------------------------- | | | | -------------------------------- | | | | | 'INST' 50 | | | | | | 3"Sax"0 ... | | | | | -------------------------------- | | | | -------------------------------- | | | | | 'INST' 82 | | | | | | 5"Drums"1 ... | | | | | -------------------------------- | | | | -------------------------------- | | | | | 'INST' 51 | | | | | | 4"Bass"2 ... | | | | | -------------------------------- | | | | -------------------------------- | | | | | 'INST' 112 | | | | | | 5"Piano"3 ... | | | | | -------------------------------- | | | | -------------------------------- | | | | | 'INST' 65656 | | | | | | 10"Jazz Stuff" 65535 4 ... | | | | | -------------------------------- | | | -------------------------------------- | -------------------------------------------- Figure 1 - Sample ASIF File
This and all of the other Apple II Technical Notes have been converted to HTML by Aaron Heiss as a public service to the Apple II community, with permission by Apple Computer, Inc. Any and all trademarks, registered and otherwise, are properties of their owners.