Introduction ------------ PatInfo is a program that I wrote mostly for my own enjoyment as I was exploring the structure of the Gravis Ultrasound's patch files. It shows the values of some of the data that is stored in the patch file. Using PatInfo, you can quickly get information about patches like the examples below: File: MIDI\TRUMPET.PAT This file contains 2 sample(s). Sample # 1 Sample length: 6908 Loop start: 6660 Loop end: 6890 Sample rate: 44642 Hz Low freq: 27.499 (A0) High freq: 466.163 (A#4) Base freq: 390.464 (?G4) Detune: 0 Octave: 2 Balance: 7 Mode: 0 0 0 0 1 1 0 1 Envelope/tremolo/vibrato data: 56 178 168 69 63 63 246 246 246 8 8 8 0 0 0 80 200 8 Flags: 16-bit looped forward melodic Sample # 2 Sample length: 6282 Loop start: 6166 Loop end: 6252 Sample rate: 22321 Hz Low freq: 466.163 (A#4) High freq: 4186.073 (C8) Base freq: 523.251 (C5) Detune: 0 Octave: 2 Balance: 7 Mode: 0 0 0 0 0 1 0 1 Envelope/tremolo/vibrato data: 56 178 168 69 63 63 246 246 246 8 8 8 0 0 0 80 200 8 Flags: 16-bit looped forward melodic File: MIDI\CLARINET.PAT This file contains 7 sample(s). Sample # 1 Sample length: 5172 Loop start: 4368 Loop end: 5050 Sample rate: 29761 Hz Low freq: 27.499 (A0) High freq: 146.832 (D3) Base freq: 87.306 (F2) Detune: 0 Octave: 2 Balance: 7 Mode: 0 1 0 0 0 0 0 0 Envelope/tremolo/vibrato data: 58 8 193 66 63 63 246 246 243 8 8 8 60 255 33 60 200 8 Flags: 16-bit looped forward melodic Sample # 2 Sample length: 4202 Loop start: 3720 Loop end: 4124 Sample rate: 29761 Hz Low freq: 146.832 (D3) High freq: 207.652 (G#3) Base freq: 146.832 (D3) Detune: 0 Octave: 2 Balance: 7 Mode: 1 1 1 0 0 0 0 0 Envelope/tremolo/vibrato data: 58 8 193 66 63 63 246 246 243 8 8 8 60 255 33 60 200 6 Flags: 16-bit looped forward melodic Sample # 3 Sample length: 1480 Loop start: 1212 Loop end: 1452 Sample rate: 29761 Hz Low freq: 207.652 (G#3) High freq: 293.664 (D4) Base freq: 246.941 (B3) Detune: 0 Octave: 2 Balance: 7 Mode: 0 1 1 0 0 0 0 0 Envelope/tremolo/vibrato data: 58 8 193 67 63 63 246 246 243 8 8 8 60 255 33 60 200 6 Flags: 16-bit looped forward melodic Sample # 4 Sample length: 2234 Loop start: 2046 Loop end: 2226 Sample rate: 29761 Hz Low freq: 293.664 (D4) High freq: 415.304 (G#4) Base freq: 331.828 (?E4) Detune: 0 Octave: 2 Balance: 7 Mode: 0 1 1 0 0 0 0 0 Envelope/tremolo/vibrato data: 58 8 193 67 63 63 246 246 243 8 8 8 60 255 33 60 200 5 Flags: 16-bit looped forward melodic Sample # 5 Sample length: 1804 Loop start: 1676 Loop end: 1796 Sample rate: 29761 Hz Low freq: 415.304 (G#4) High freq: 587.329 (D5) Base freq: 493.883 (B4) Detune: 0 Octave: 2 Balance: 7 Mode: 0 1 0 1 0 0 0 0 Envelope/tremolo/vibrato data: 58 8 193 67 63 63 246 246 243 8 8 8 60 255 33 60 200 5 Flags: 16-bit looped forward melodic Sample # 6 Sample length: 2216 Loop start: 2124 Loop end: 2208 Sample rate: 29761 Hz Low freq: 587.329 (D5) High freq: 830.609 (G#5) Base freq: 699.82 (?F5) Detune: 0 Octave: 2 Balance: 7 Mode: 1 0 1 0 0 0 0 0 Envelope/tremolo/vibrato data: 58 8 193 68 63 63 246 246 243 8 8 8 60 255 33 60 200 5 Flags: 16-bit looped forward melodic Sample # 7 Sample length: 1142 Loop start: 1068 Loop end: 1132 Sample rate: 29761 Hz Low freq: 830.609 (G#5) High freq: 4186.073 (C8) Base freq: 925.044 (?A#5) Detune: 0 Octave: 2 Balance: 7 Mode: 0 0 1 1 0 0 0 0 Envelope/tremolo/vibrato data: 58 8 193 68 63 63 246 246 243 8 8 8 60 255 33 60 200 5 Flags: 16-bit looped forward melodic This document shows you how to use PatInfo and how to interpret its output. An accompanying document, PATCH.DOC shows the layout of the patch files in more detail, and shows the location of the data that PatInfo prints out. How to Run the PatInfo ---------------------- PatInfo is a DOS program that you can run from the command line. The syntax is: PATINFO patchnam.pat There are no switches, you must inlcude the file extension, and you can only view one file at a time. The Output of PatInfo --------------------- You've already seen an example of the output above. Let's take a closer look at the various fields and see what they mean. >>File: MIDI\TRUMPET.PAT >>This file contains 2 sample(s). The file name is simply the filespec you entered on the command line when you ran PatInfo. The first bit of information PatInfo looks for is how many samples are in the file. Patches can contain more than one sample, usually real instruments are sampled at various points in their range to make the patch sound more realistic. In this case, the trumpet patch has 2 samples in it. >>Sample # 1 >>Sample length: 6908 Loop start: 6660 Loop end: 6890 Each sample has some information associated with it in the patch file. PatInfo will print out the data stored for every patch in the file. In this case, we are seeing the data for the first sample stored in the file. The sample length is in bytes, and the loop start and end are byte offsets into the sample. Why isn't the loop end at the end of the sample? I don't know, PatInfo just reports what it sees. >>Sample rate: 44642 Hz >>Low freq: 27.499 (A0) High freq: 466.163 (A#4) Base freq: 390.464 (?G4) The samples used on the Ultrasound will be played back at many different rates to produce different notes, or pitches. Precise information is needed to produce correct pitches. It seems that if you play back the sample at the indicated sample rate, the base frequency should be heard. The low frequency and high frequencies are the limits within which this sample can be used. PatInfo works out the actual note names for the frequencies. This can be useful for those that can read musical notation. If a question mark appears before the note name (as it does above) the note name is only approximate; the frequency that is reported lies between the notes of the equal tempered scale. It seems that many of the patches on the 2.01 installation disks have base frequencies that are not precise note frequencies. >>Detune: 0 Octave: 2 Balance: 7 Mode: 0 0 0 0 1 1 0 1 Detune is a value that is used to correct samples that were slightly out of tune. It doesn't seem to be used anymore in the 2.01 patches. The value of the octave setting determines what is the default octave the sample will play at. A setting of 2 means that the note will play at the same octave it was sampled at. That means that if the card is to play a C5, a C5 will sound. A setting of 1 means that the sample will play an octave down, that is if a C5 is to be played, a C4 will sound. A setting of 3 means that the sample will play an octave up; that is if a C5 is to be played, a C6 will sound. The balance is the default value for the stereo panning for this sample. A value of 7 means that the sound is centered in the stereo field. A value of 0 means full left and a value of 15 is full right. The value of mode is the settings of the bits in what I call the mode byte. I can't tell what these bits do; I included their settings to compare them with other patches. >>Envelope/tremolo/vibrato data: >> 56 178 168 69 63 63 246 246 246 8 8 8 0 0 0 80 200 8 12 bytes seem to be allocated to describing the amplitude envelope. I'm not exactly sure of their meaning, but I have deduced the following guidelines: The higher the value of the first byte, the slower the attack of the note is. The higher the value of the second byte, the longer the attack of the note takes. The fourth byte seems to be related to the release level. The lower the value of the seventh byte, the slower the attack is. The lower the value of the eighth byte, the longer the delay is between the note on event and the beginning of the attack. The ninth byte is the level of the release. The tenth byte is the length of the release. A small value (like above) means that the note ends as soon as the key off event is recieved. The next three bytes describe the tremolo, or a slight variation in pitch over time. The first byte is the tremolo sweep, the second is the rate, and the third is the depth of the tremolo. The last three bytes describe the vibrato, or a slight variation in the amplitude of the sustained note. The first byte is the vibrato sweep, the second is the rate, and third byte is the depth. >>Flags: 16-bit looped forward melodic One byte in the sample information seems to be flags. One flag tells if the sample is 16-bit or 8-bit. Another tells if the sample is looped if the note is sustained, or if the sample plays once straight through with no loop. Samples can also be played either forward or backward. The sample can also be of either a melodic instrument, or a percussive effect or instrument. That's it! If you want more information about the patch file, see the file PATCH.DOC. I don't own the Ultrasound SDK. Most of the information here I got from experimentation, observation, and deduction. I don't guarantee any of it, and it all may change at any time. I also might be totally wrong about the use of the some of the data in the patch file. I won't take responsibility if you destroy data or hardware by mis-using the information in these documents. If you have any comments, questions, or critizism, write to me at: aa344@yfn.ysu.edu -Joseph Maruschek