1,554
edits
(Fixed Apple IIGS instrument header. There were duplicates for "Priority increment" and "Bend range" (I tested this with data, there shouldn't be).) |
(Syntax highlighing) |
||
Line 43: | Line 43: | ||
The actual frequency produced is the 10-bit frequency divisor given by F0 to F9 divided into 1/32 of the system clock frequency (3.579 MHz) which turns out to be 111,860 Hz. Keeping all this in mind, the following is the formula for calculating the frequency: | The actual frequency produced is the 10-bit frequency divisor given by F0 to F9 divided into 1/32 of the system clock frequency (3.579 MHz) which turns out to be 111,860 Hz. Keeping all this in mind, the following is the formula for calculating the frequency: | ||
<syntax type="C++"> | |||
f = 111860 / (((Byte2 & 0x3F) << 4) + (Byte1 & 0x0F)) | f = 111860 / (((Byte2 & 0x3F) << 4) + (Byte1 & 0x0F)) | ||
</syntax> | |||
Note: The order of the bytes are reversed for AGI sound data. | Note: The order of the bytes are reversed for AGI sound data. | ||
Line 480: | Line 481: | ||
My program reads in the duration as a 16 bit word. It then loads the two following bytes and calculates the frequency as follows: | My program reads in the duration as a 16 bit word. It then loads the two following bytes and calculates the frequency as follows: | ||
<syntax type="C++"> | |||
f = 111860 / (((Byte2 & 0x3F) << 4) + (Byte3 & 0x0F)) | f = 111860 / (((Byte2 & 0x3F) << 4) + (Byte3 & 0x0F)) | ||
</syntax> | |||
The 111860 comes from the PCjr discussion above. Note that the bytes are in the opposite order from that mentioned in the PCjr information. | The 111860 comes from the PCjr discussion above. Note that the bytes are in the opposite order from that mentioned in the PCjr information. |