1h=/2!89 A Complete Guide to Processing a MIDI File for the Atari Jaguar Table of Contents September 23, 1994 Introduction 1 About the Jaguar Music System 1 Terminology 1 Procedure Summary 1 Step-by-Step Procedure 5 Step 1. Install the Jaguar Music System tools 5 Step 2. Create your sound patches. 7 Step 3. Prepare your MIDI File. 8 Step 4. Copy your MIDI Type 0 files, patch ASCII files, and samples. 10 Step 5. Extract patch data, envelope, waveform, and wavetable data to separate ASCII files. 10 Step 6. Modify the file synth.s. 12 Step 7. Add MIDI information to parse.cnf 13 Step 8. Run the parse program to parse your MIDI files. 14 Step 9. After testing your music one section at a time, run the merge tool to combine.your sections. 14 Step 10. For each MIDI file, change the MIDIFILE entry in the makefile. 15 Step 11. Run the make tool. 15 Step 12. Load and run test.db. 15 Step 13. Refine your MIDI files, patches, and voice settings. 15 Step 14. Adjust volume and tempo in synth.cnf if necessary. 16 Step 15. Repeat steps 5 through 14 until your music plays correctly. 16 More About Voicing Samples 16 Looping MIDI Files 17 Example Files 18 makefile 18 parse.cnf 20 synth.cnf 21 synth.s 23 Introduction This guide teaches you how to process MIDI files for use in a Jaguar game. After completing the steps presented here, you will have an executable version of your music that you can combine with other game software. About the Jaguar Music System The Jaguar Music System is designed to be extremely flexible, allowing you to play MIDI-based music using a mixture of synthesized sounds, samples, and modified samples. The system consists of a real-time music interpreter and an onboard digital signal processor (DSP). The music interpreter uses Type 0 MIDI files to play your music through the DSP.The DSP is a synthesizer and sample player in one. It generates or plays the sounds used in your music. With the exception of samples, all of the information necessary to play your music on the Jaguar is stored in the memory of the DSP. Samples are actually stored in the dynamic RAM (DRAM) of the Jaguar and are fetched by the DSP as needed. With this exception, the DSP is self-contained and requires minimal interaction from the rest of system. Terminology The terminology that describes processing a MIDI file can be confusing. The following is a list of terms we use in this document. channel a MIDI channel. module a distinct synthesis technique implemented by the synthesizer. envelope a volume envelope used by some modules in the synthesizer. patch data used to create a particular sound in the synthesizer. The contents of a patch depends on the module it uses. voice a single sound produced by the Jaguar synthesizer to represent an instrument played by your MIDI file. waveform a collection of sound wave shapes used by the synthesizer. Built-in waveforms are permanently stored in the ROM of the DSP. You can also design user waveforms. These waveforms occupy 512 bytes and are stored in the DSP memory at 512 byte boundaries. Procedure Summary The basic tasks for processing MIDI files consist of: converting (or parsing) your MIDI file into a form that the Jaguar can use creating synthesizer and sample patches incorporating patch information into files used by the Jaguar synthesizer Figure 1 illustrates these tasks. The following is a summary of the steps required to complete these tasks. Each of these steps is described in detail in later sections of this document. 1. Install the Jaguar Music System tools. a. Install the tools and sample code from the distribution archives b. Create a new directory for your music project. c. Copy the Jaguar sound files to the new directory. 2. Create your sound patches. a. Design and save your synthesized and sample patches. b. Save ASCII versions of your patches. c. Convert your samples to raw format, compress them, and write down sample information. 3. Prepare your MIDI file. a. Clean up your MIDI sequences. b. Write down information about your MIDI sequences. c. Save your MIDI file in sections as separate type 0 MIDI files. 4. Copy your MIDI Type 0 files, patch ASCII files, and samples. 5. Extract patch data, envelope, waveform and wavetable data to separate ASCII files. a. Extract patch data to separate ASCII files. b. Replace the label names in your patch data. c. Adjust other patch values in your patch data. d. Extract envelope data to separate ASCII files. e. Extract user waveform data to separate ASCII files. f. Extract wavetable data to separate ASCII files. 6. Modify the file synth.s. a. Set the number of patches. b. Include patch data files. c. Write down patch numbers. d. Add sample labels and include sample files. e. Initialize the voice table to the correct number of voices. f. Add waveform labels and include user waveform files. g. Add envelope labels and include envelope files. h. Add wavetable labels and include wavetable files. 7. Add MIDI information to parse.cnf. 8. Run the parse program to parse your MIDI files. 9. After testing your music one section at a time, run the merge tool to combine your sections. 10. For each MIDI file, change the MIDIFILE entry in the makefile. 11. Run the make tool. 12. Load and run test.cof. 13. Refine your MIDI files, patches, and voice settings. 14. Adjust volume and tempo in synth.cnf if necessary. 15. Repeat steps 5 through 14 until your music plays correctly. COp&,CO( i 4  > .  & --Cj & -Q680Courier NewxK- !MIDI SequencerED &  & PT5 ! Sound ToolE &  & -nnQj7ll'-- $dmmvvmdm &  & -m%P!#6#'- $l$u-ll & !Extract information !from ASCII patch-JFHH'- $@IR@-njll'- $dmvd- '- $!Create MIDI file<-u6 & -%!##'-- $$- &  & -%!+##'- $$- &  & -P%3!j##'- $O$X-OO &  & ! Section A>-~6 &  & ! Section BcZ &  & ! Section C~ & i!Create patches and ! save as ASCIIgu & ! Patches,  ! Waveforms, # ! Envelopes, / ! Wavetables;EL &  !synth.sz & !makeC &  & !rdbjag(3C & !Listen to music grYW!Parse and merge sections - ! one at a time N)$- $c2l)u2c2 & -%!##'- $$- &  & -b%E!+#|#'- $a$j-aa & -w`' & --O 4 !SamplerD &  & -lO5'-- $ktkk & !Create samples - s ! Convert to !raw format and  !compress -x'-- $-)'yuGwwl' & --Y-$GG !makefile  & -o2kmMm'!Refine music and patches*-- gk- flgo_k'r 4 -i,'-- $ $LnCwLLn & -%!##'- $$- & -%!r##'- !Includeb:n6'- $q~hqq~ & '@ Figure 1. Processing a MIDI File Step-by-Step Procedure This section presents the steps for processing a MIDI file in detail. Step 1. Install the Jaguar Music System tools a. Install the tools and sample code from the distribution archives. The Jaguar Music System tools and sample files are installed automatically when you install the disks that come with a Jaguar Development System. If you have received updated archives containing the tools (or downloaded them from an online service), then you should extract the archives into a temporary directory. The directory structure used in the archives is: JAGUAR\BIN - Various tools such as the MIDI parser, sound sample file format conversion utilites, etc. JAGUAR\MUSIC\FULSYN - The Jaguar Synthesizer, source code and linkable object code. JAGUAR\MUSIC\SNDTOOL - The Jaguar Synthesizer Sound Tool - Used for creating patches for the Jaguar Synth. JAGUAR\MUSIC\SNDTOOL.MID - The MIDI version of the Sound Tool. JAGUAR\MUSIC\SOUNDS - A variety of ready-made sound patches for use with the Jaguar Synth and the Sound Tool. JAGUAR\MUSIC\MUSICDRV - The sample program for the Jaguar Synth. This is the sample program described in this document. JAGUAR\MUSIC\SYNDEMO - This is an alternate sample program for the Jaguar Synth. This one includes a more complex MIDI score that uses multiple instruments and looping. Also, this one uses multiple FM patches and no samples. To extract the various archives using this directory structure, use the following command: pkunzip -d music.zip Where music.zip is the name of the archive you are extacting at the moment. The PKUNZIP tool is supplied on your original Jaguar Developer System disks. If you are installing an update, please always extract the archives to a temporary directory first, so you can backup the existing files before copying over the new ones. b. Create a new directory for your music project. Make a new directory on your hard disk. You will use this directory to hold your MIDI file, synthesizer patches, samples, and several Jaguar files and programs . The Jaguar Music System Tools distribution includes two sample projects. One plays a simple scale of notes using the Jaguar Synths Sample module. This project is contained in the JAGUAR\MUSIC\MUSICDRV directory. The second sample plays a more complex song with multiple voices, and uses FM patches instead of samples. This project is found in the JAGUAR\MUSIC\SYNDEMO directory. c. Copy the Jaguar sound files to the new directory. This document uses the MUSICDRV project as its example. You will need the following files to perform the procedure described in this document. During this procedure, you will need to modify some of these files. Be sure to save the original copies of these files so you can use them for other projects. You will need to change the following files using a text editor. makefile This file is used by the MAKE tool to compile various files into an executable program file. parse.cnf This file contains MIDI channel, MIDI note range, voice number, and transposition data for the MIDI parsing process. It is used by the PARSE utility. synth.s This file is used to assemble patch data, samples, envelopes, user waveforms, and wavetables that must reside in the Jaguar's memory. synth.cnf This file contains settings for global and MIDI volume of the synthesizer and the system clock used to adjust music tempo. This file also allows the Jaguar Synth to be reconfigured for the optimum performance and memory usage requirements for individual projects (this requires that the Jaguar Synth source code be reassembled -- see below). You will not need to change the following files: driver.s This file contains initialization information for the Jaguar synthesizer. fulsyn.inc This file contains parameter settings and instructions for the Jaguar synthesizer. (This file is located in the JAGUAR\MUSIC\FULSYN directory.) fS02_50.das This file is the Jaguar DSP source code for the Jaguar synthesizer. You should not have to change it, but you may recompile it to add or delete different synthesizer modules according to the needs of individual projects (controlled by the SYNTH.CNF file). (This file is located in the JAGUAR\MUSIC\FULSYN directory, but depending on the version, the filename may change.) fS02_50.oj This file is the linkable object module for the Jaguar synthesizer (This file is located in the JAGUAR\MUSIC\FULSYN directory. Depending on the version, the filename may change.) Step 2. Create your sound patches. a. Design and save your synthesized and sample patches. Create the sound patches to be played by your MIDI file. You may want to perform this step before you compose your music, or perhaps at the same time. This way, you will have a better idea of what sounds the Jaguar is capable of producing. You can use the Sound Tool to create synthesized patches or use sampling software to create 16-bit samples. If you use samples, we suggest you use a sampling rate of approximately 20 KHz to match the default playback frequency of the Jaguar. You must use mono samples. If you have stereo samples, you can use the MONO utility to convert them to mono. We suggest you use the Sound Tool to set parameters of your samples, including pitch, loop parameters, and envelopes. For more on voicing samples on the Jaguar, see the More on Voicing Samples section. Load the Sound Tool into the Jaguar using rdbjag by typing the following: rdbjag load sndtool.db g For more information about creating sound patches, see the Jaguar Sound Tool Users Guide and the Jaguar Synth document. The Sound Tool creates two kinds of patch files. One is an ASCII file designed to be assembled as Madmac source code as part of your project. The other is a binary file used to load and save patches that are being edited. Although it creates both types of files, the Sound Tool only knows how to load the binary files. Therefore, after creating a patch, we suggest you always save it in a non-ASCII file so you can reload it into the Sound Tool at a later time and make changes as needed. When saving these files, we suggest you save the files with an extension of .ptc in a directory called sounds. Important: Synthesizer patches use a lot less memory than samples. And, samples use outside resources that are shared by graphics, causing slower game play and possible sample distortion. Because of these problems, you should avoid using samples as much as possible and instead use synthesized sounds for your music. This is particularly important for games in which the available space for music is very limited. If you must use samples, restrict them to important sounds that you cannot synthesize. b. Save ASCII versions of your patches. For each patch you create, use the Sound Tool to save it as an ASCII file. If you created any patch data information for samples, you should save this patch data as ASCII as well. To save a patch in ASCII format, go to the main page of the Sound Tool and select the Save Patch command. We suggest you name these files with an extension of .asc, and place these files in a directory called ascii. c. Convert your samples to raw format, compress them, and write down sample information. The Jaguar DSP plays raw samples only. Raw samples contain the sample sound information, but do not contain other information such as looping data. If you created your sample in another format, such as the Audio Interchange File (AIF) format, you need to convert your samples to raw format for them to play correctly on the Jaguar. To do this, use the stripaif tool on your samples, and create other sample parameters (looping and pitch) in the patch data using the Sound Tool. Next, compress your samples using the sndcmp tool. This tool compresses samples from 16 bit to 8 bit. Also, write down the file name and file sizes of each sample. You may need the file size information when adding patch data to synth.s. Step 3. Prepare your MIDI File. a. Clean up your MIDI sequences. After composing your music, you may want to clean up or modify your MIDI sequences before processing them for the Jaguar. Use your sequencing software to inspect each of your MIDI tracks. When examining your tracks, look for the following and make changes as needed: 1. Verify that the number of voices being played by all of your tracks at one time (the polyphony) does not exceed the polyphony you are allowed for your game music. The Jaguar's polyphony is determined by the amount of time the synthesizer has to create each sound. The amount of time the Jaguar takes to create a sound depends on which synth module is for the sound. The total time available for the Jaguar to create sounds is 168 time units. Therefore, when determining the polyphony for your music, you must add the time values for each module you use to make sure the total time is at or below 167. Also keep in mind that some of the Jaguar synth's time available may be used to synthesize sound effects instead of music. For more information about calculating polyphony, see the Jaguar Synth document. 2. Check the quantization of your tracks to be sure that the timing of your notes (when notes start and end) is what you want. You may choose to leave your music as you recorded it to give it a more natural feel. Or, you may need to quantize some or all of your notes to correct for timing problems. 3. Check that the note durations are what you want them to be. For example, if a note is used to trigger a sample that does not use an envelope, you may want to shorten the note duration to prevent undesired looping. You can also adjust the loop parameters of a sample and apply an envelope to it using the Sound Tool. Be aware that any notes that trigger patches with long decays may affect your polyphony calculations since decay of the patch sound may overlap new notes being triggered. Too avoid this problem, be sure that your patch envelopes decay before the next note is triggered for that patch. For example, suppose there are two sequential half notes, with the first note ending before the second is triggered. Also suppose that the tempo of your music causes each note to last for one second. If the patch you use for these notes has an envelope that decays in one second or less, there is no problem. However, it the envelope decays in longer than a second, another voice will be needed to play the second note. If you are at the limit of your polyphony, the second note may not play at all. 4. Verify that the note on velocities are set to the desired level. For example, you may want to make the attack of a track consistent. On the other hand, you may want to leave them exactly as you performed them. 5. Adjust the volume the instruments used for each track (MIDI controller 7) as needed. You will likely be using different sounds on the Jaguar than the ones you used to compose your music. Because of this, it is hard to predict the what the relative volumes will be for your Jaguar sounds. For example, you might set the volume of your kick drum to be just right when you play it back on your sequencer. But, when you play it on the Jaguar, the kick may not be loud enough. Because it is hard to know ahead of time what the relative volumes will be for your patches, you may want to set some or all of your instruments volumes to a constant level (such as MIDI value 100). You can then mix the volumes on the Jaguar as needed from within the patch data file (synth.s) until they sound right. 6. If you want to have your MIDI file loop in the game, you need to set loop points in your MIDI file. For more information about how to set MIDI file loop points, see the Looping MIDI Files section of this document. b. Write down information about your MIDI sequences. Write down your MIDI file information for later use. 1. Write down the MIDI channel numbers for each track in your MIDI sequences. You will need these numbers when you parse your MIDI file in step 11. 2. Write down the MIDI note ranges (as MIDI note numbers) for each track. This information is required if you intend to play different sounds on the same MIDI channel. For example, if you recorded a track using a split keyboard, or drum machine, you need to write down which notes are for which sounds. You will use this information when you parse your MIDI file. c. Save your MIDI file in sections as type 0 MIDI files. The Jaguar music driver software plays type 0 MIDI files. This is a standard MIDI file format that merges multiple-channel tracks into single tracks. Type 0 MIDI files still retain the MIDI channel information of your tracks. Therefore, to play your MIDI music, you must first convert it to one or more type 0 MIDI files. To test your music on the Jaguar, we suggest you save individual tracks (or groups of musically related tracks) as separate type 0 MIDI files. This way, you can test and refine separate parts of your music, making it easier to identify and fix problems you may find. After testing and refining your tracks, you can use the merge tool to merge these files into one file for use on the Jaguar. When saving your MIDI sequences, we suggest you name them with an extension of .mid. Step 4. Copy your MIDI Type 0 files, patch ASCII files, and samples. If they are not already there, copy your MIDI type 0 files, each of the ASCII patch files you created, and your samples, to your music project directory. Step 5. Extract patch data, envelope, waveform, and wavetable data to separate ASCII files. a. Extract patch data to separate ASCII files. Edit each ASCII patch file you created and locate the patch data. This data is a column of .dc.l values used by the Jaguar synthesizer and music driver. The patch data is located after the label _sounddata: Each ASCII patch file contains data for all pieces needed for your synthesis module. All envelopes, user waves etc. associated with your sound will be save in one file. Once you have located the patch data, copy it from your ASCII patch file to a separate file. We suggest you name these files with an extension of .dat, and place them in a directory called patches. b. Replace the label names in your patch data Replace the temporary label names (_env0, _env1, and so on) in your patch data to match the label names you will put in synth.s. For synthesized patches, you may need to replace envelope, user waveform, and wavetable labels within your patch data. For sample patches, you will need to replace sample and envelope labels. We suggest you prefix label names for envelopes with e_ , user waveforms with w_, wave tables with t_, and samples with s_. For consistency across platforms, we also recommend you use labels of eight or fewer characters. c. Adjust other patch values in your patch data. There are other voice parameters you may want to modify in the voice data of your patches. These parameters include the volume and pan value, among others. The location of the volume parameter varies with the type of patch you are editing. The pan parameter is always the four rightmost digits in the last parameter in a patch. You can adjust the pan value between 00000000 (pan full right) and 00007FFF (pan full left). Setting this parameter to 00003FFF centers the balance. Refer to the Jaguar Synth document for descriptions of these and other parameters for the type of patch you are adjusting. d. Extract envelope data to separate ASCII files. Edit each ASCII patch file you created that uses envelopes (such as FM envelope and sample patches). Within each file, locate the envelope data that your patch actually uses. Envelope data is located in the file after the patch and user waveform data. Each ASCII patch file contains data for the envelope used in your sound (_env0 - _env7). Once you have located the envelope data for your patch, create a separate file and copy the data into the file. Do this for each patch that uses an envelope. We suggest you name each file as patch.env, where patch is an abbreviation of the patch name associated with the envelope. Write down the file names for future reference. You will need to include these file names in synth.s. When saving an envelope data file, we suggest you place it in one of two directories, env or slopeenv. Place envelopes you extracted from sample envelope patches in slopeenv directory. Place all other envelopes in the env directory. e. Extract user waveform data to separate ASCII files. Edit each ASCII patch file you created that uses a user waveform. Within each file, locate the user waveform data that your patch actually uses. User waveform data is located after the envelope data in the file. Once you have located the wavetable data for your patch, create a separate file and copy the data into the file. Do this for each patch that uses a user waveform. We suggest you name each file as patch.wav, where patch is an abbreviation of the patch name associated with the user waveform. Place these files in a directory called waveform. Write down the file names for future reference. f. Extract wavetable data to separate ASCII files. Edit each ASCII patch file you created that uses a wavetable. Within each file, locate the wavetable data that your patch actually uses. Wavetable data is located after the patch data in the file. Once you have located the user waveform data for your patch, create a separate file and copy the data into the file. Do this for each patch that uses a wavetable. We suggest you name each file as patch.tbl, where patch is an abbreviation of the patch name associated with the user waveform. Place these files in a directory called wavetabl. Write down the file name for future reference. Step 6. Modify the file synth.s. a. Set the number of patches. Set the dc.w value under patches:: to be the number of patches you are using. For example: ... patches:: dc.w 7 ; NUMBER OF PATCHES b. Include patch data files. Once you have created separate ASCII patch files include the file names in synth.s. The location for including these patch files is labeled in synth.s as patches:: It is important to realize the order in which you put your patches in synth.s defines the patch number used by the Jaguar. For example, the first patch in synth.s will be patch 0. ... ; Patch 0 .include 'patches\\strlow.ptc' ; strlow patch ( \\ is ; needed because \ is a ; special character ) ; uses 's_strlow' sample ; and 'e_strlow' envelope ... For a complete example of this file, see the Example Files section. c. Write down patch numbers. Write down the numbers for the patches you add. You will need to know these numbers when you modify parse.cnf to map your MIDI channel numbers to the actual patches you use d. Add sample labels and include sample files. Add labels for your samples and include your sample files. The labels you choose must match those you specified in your ASCII sample patch files. For example: ... s_strlow: .incbin "samples\\synstrgs.cmp" ; sample used in patch 0 ... e. Initialize the voice table to the correct number of voices. Add a zero to the voice table field that is the last voice to be used. For example, the following table places a zero at voice 7, indicating eight voice polyphony: ... .ORG tablestart TABSSTART:: ; DO NOT EDIT THIS LABEL dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 0 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 1 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 2 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 3 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 4 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 5 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 6 dc.l 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 7-LAST dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 8 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 9 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 10 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 11 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 12 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 13 dc.l 0 ... f. Add waveform labels and include user waveform files. Add labels for your user waveform and include your waveform files. The labels you choose must match those you specified in your ASCII patch files that use the waveform. g. Add envelope labels and include envelope files. Add labels for your envelopes and include your envelope files. The labels you choose must match those you specified in your ASCII patch files that use the envelopes. h. Add wavetable labels and include wavetable files. Add labels for your wavetable and include your wavetable files. The labels you choose must match those you specified in your ASCII patch files that use the wavetable. Step 7. Add MIDI information to parse.cnf Edit the file parse.cnf to set the polyphony of your music, map your MIDI channels to the voice numbers you set in synth.s, define the note ranges for your voices, and transpose your tracks if necessary. The format for entering this information is: n = note_polyphony MIDI_channel - 1: note_range patch_number transpose_value MIDI_channel - 1 sets the MIDI channel number. You must subtract one from it since the Jaguar voice numbers are zero-based. note_range sets the range of notes played by a particular sound. This allows you to achieve the same effect as a split keyboard or a drum machine in which one MIDI channel is used but different sounds are triggered depending on the notes played. For example, for MIDI channel 1, MIDI note 36 may trigger a kick drum sound, while MIDI note 38 will trigger a snare. patch_number is the number of the patch to use based on the sounds you defined in synth.s. transpose_value is the amount in which to transpose the defined note range The transposition is in one note increments and can be either positive or negative A value of 12 will transpose up an octave, a value of -12 will transpose down an octave, and a value of 0 will leave the notes untransposed For example: ... n = 8 ; 8 note polyphony 0: 36-36 0 0 ; kick 0: 42-42 1 0 ; clsdhat 0: 46-46 2 0 ; openhat ... For a complete example of this file, see the Example Files section. Step 8. Run the parse program to parse your MIDI files. Normally you would edit the makefile file for your project to include the names of your MIDI files so that the PARSE tool is called automatically when required. See the makefile for the sample programs for examples of this. However, you can also run the PARSE utility directly from the commandline if necessary. Type the following command to parse your MIDI files: parse -q yourMIDIfile The -q is an optional flag to suppress the output of the parse command. If you want to examine the parsing process as it occurs, do not use this flag. The parse output will be displayed to the screen. You can also redirect this output to a file so you can inspect it later. The parsing information may be useful for finding a problem if your MIDI file does not play correctly. A common error you may see is that note on or note off has failed. This occurs when the polyphony of your MIDI file exceeds the polyphony you defined in parse.cnf. If this happens, increase the polyphony value (if possible) or reduce the polyphony in your MIDI file. See also the PARSE utility release notes (in the JAGUAR\DOCS directory). Step 9. After testing your music one section at a time, run the merge tool to combine your sections. Merge your separate MIDI sections into one file. Use the merge tool to do this as follows: merge merged_file input_file1.out input_file2.out ... where merged_file is the resulting merged MIDI file, and input_files are the parsed output files of your individual sections generated by the parse program. Normally, you would edit your projects makefile so that the MERGE tool would be called by the MAKE utility when appropriate. Step 10. For each MIDI file, change the MIDIFILE entry in the makefile. Edit the makefile and change the file name of the MIDI file you are processing. For example: ... MIDIFILE = cscale ... For a complete example of this file, see the Example Files section. Note: Do not change anything else in the makefile unless you are familiar with how it works. Changing other text , spaces, or tabs in this file may cause it to not work correctly. Step 11. Run the make tool. Run the make program as follows to create the file test.cof. This file is the executable version of your music for the Jaguar. Type: make Step 12. Load and run test.cof. Run the debugger rdbjag and load the file test.cof. This command will play your music on the Jaguar as it will sound in the actual game. Type the following commands: rdbjag aread test.cof g Step 13. Refine your MIDI files, patches, and voice settings. Repeat the steps above as needed to refine your MIDI files, patches, and voice settings. It is often necessary to adjust the volume of your instruments and mix between them using the pan parameters. You may also need to adjust the pitch and loop parameters for your samples. Step 14. Adjust volume and tempo in synth.cnf if necessary. If necessary, adjust the global or MIDI volume settings in synth.cnf. Also, adjust the tempo. If your music plays too slowly adjust the SCLKVALUE parameter down. If it plays too quickly, adjust the parameter up. For example: ... GLOBALVOLUME equ $7fff MIDIVOLUME equ $7fff ... SCLKVALUE equ 19 Step 15. Repeat steps 5 through 14 until your music plays correctly. Rerun parse, merge, and make to generate a new test.cof file. Then, run rdbjag, load test.cof, and type g to play your music. Repeat this process until your music plays correctly. More About Voicing Samples We suggest you minimize your use of samples in your music because they use a lot of memory. However, if you use samples, you can either use the Sound Tool to create sample patch data for you, or copy the patch data of any sample that already exists in synth.s and modify it as needed. In general, we suggest you use the Sound Tool to set sample parameters, particularly if you need to adjust loop parameters, such as beginning, ending, and length of the loop, or if you want to apply a volume envelope to your sample. If you have not used the Sound Tool to create the voice data for your samples, and instead have copied data for an existing sample, you must change the following .dc.l parameters of the sample voice: voice type The first parameter in the voice data of a sample. The voice type must be $0000002C for 16-bit compressed samples. volume The second parameter in the voice data of a sample. The volume can be any hexadecimal number that occupies the four rightmost digits. The maximum volume is 00007FFF. sample label The third parameter in the voice data of a sample. The sample label is a label you define to identify the sample in the makefile. This parameter is also known as the start of the sample. sample pitch The fourth parameter in the voice data of a sample. The sample pitch is typically $00001000, which indicates no change from the original sample pitch. A value of $00002000 doubles the pitch (raises it an octave) and a value of $00000800 halves the pitch (lowers it an octave). end of loop point The fifth parameter in the voice data of a sample. The end of loop point for the sample. The value for this parameter is: ((file_size/2) <<8) - 1 where the file_size is the size of the sample you noted in step 9. loop length The sixth parameter in the voice data of a sample. The loop length for the sample. The value for this parameter is also: ((file_size/2) <<8) - 1 end of sample The ninth parameter in the voice data of a sample. The end of sample point for the sample. The value for this parameter is also: ((file_size/2) <<8) - 1 sample envelope label The tenth parameter in the voice data of a sample. The label of the sample envelope as defined in tables.das: Looping MIDI Files During game play, you may want one or more of your MIDI files to repeat until the player completes a task of moves to another level. To do so, you need to add loop parameters to your MIDI file before processing it. The following procedure describes how to add this information. 1. Identify the point in your MIDI file where you want to start looping. This is called the loop target. At that point in your MIDI file, insert a MIDI controller 12 event with a value of the target number (for example, a 0 for the first target, a 1 for a second target (if any). 2. Locate the position in your MIDI file where you want to stop looping. At this point in the file, insert a MIDI controller 13 with a value of the loop target you defined in step 1. 3. Insert a MIDI controller 14 event with a value of the number of times to loop (up to 127 times). If you set the value to a negative number, the MIDI file will loop forever. Insert controller 14 right after the controller 13 event. 4. You can loop for longer than the value you assigned for controller 14 by setting the loop count value in synth.s. For example, setting this value to 128 will cause the MIDI file to loop infinitely. Example Files The following code listings are examples of the four files (makefile, parse.cnf, synth.cnf, and synth.s) you need to modify when preparing music for the Jaguar. makefile #========================================== # Makefile MUSIC DRIVER #========================================== SYNTHPATH = /jaguar/music/fulsyn #========================================== # Use 'erase' and 'rename' on MS-DOS # Use 'rm' and 'mv' on Atari w/ csh #========================================== ERASE = erase RENAME = rename #========================================== # MIDI FILE WITHOUT EXTENTION (!!) #========================================== MIDIFILE = cscale #========================================== # MIDI Parser flags #========================================== PARSERFLAGS = -q #========================================== # Assembler & Linker flags #========================================== MACFLAGS = -fb -i$(SYNTHPATH);$(MACPATH) ALNFLAGS = -g -e -l -a 802000 x 4000 #========================================== # Default Rules #========================================== .SUFFIXES: .scr .mid .mid.scr: parse $(PARSERFLAGS) -o $*.out $*.mid mac $(MACFLAGS) -o$*.scr $*.out $(ERASE) $*.out #========================================== .SUFFIXES: .out .mid .mid.out: parse $(PARSERFLAGS) -o $*.out $*.mid #========================================== .SUFFIXES: .scr .out .out.scr: mac $(MACFLAGS) -o$*.scr $*.out #========================================== .SUFFIXES: .o .s .s.o: mac $(MACFLAGS) $* #========================================== .SUFFIXES: .oj .das .das.oj: mac $(MACFLAGS) -o$*.oj $*.das #========================================== FULSYN = $(SYNTHPATH)/fs02_50.oj OBJS = driver.o synth.o $(MIDIFILE).scr SCORE = $(MIDIFILE).scr EXEC = test.cof #========================================== # EXECUTABLES #========================================== $(EXEC): $(OBJS) $(FULSYN) aln $(ALNFLAGS) -o $(EXEC) $(OBJS) $(FULSYN) #========================================== # Dependencies #========================================== driver.o: driver.s synth.cnf $(SYNTHPATH)/fulsyn.inc synth.o: synth.s synth.cnf $(SYNTHPATH)/fulsyn.inc $(MIDIFILE).scr: $(MIDIFILE).mid $(FULSYN): $(SYNTHPATH)/fs02_50.das synth.cnf $(SYNTHPATH)/fulsyn.inc mac $(MACFLAGS) -o$*.oj $*.das #========================================== # EOF #========================================== parse.cnf * File: parse.cnf * Description: MIDI information file for the parse utility. * Project: * Composer: * Date: * * Format: Change the data in this file according to the * following format. * * n = max_note_polyphony (default is 8 note polyhony) * midi_channel - 1: lowest_note - highest_note patch_number transpose_value * n = 8 ; 8 note polyphony 0: 36-36 0 0 ; kick 0: 42-42 1 0 ; clsdhat 0: 38-38 3 0 ; snare 3: 43-55 6 0 ; bass synth.cnf ;----------------------------------------------------------------------- ; This is a simple sample program to play a tune on the synth code. ; ; MODULE: SYNTH CONFIGURATION FILE ; DESCR: THIS FILE CONTAINS THE FULSYN CONIFGURATION ; (WHICH MODULES TO INCLUDE), GLOBAL VOLUME, SCLK, etc. ; ; COPYRIGHT 1992,1993,1994 Atari U.S. Corporation ; UNAUTHORIZED REPRODUCTION, ADAPTATION, DISTRIBUTION, ; PERFORMANCE OR DISPLAY OF THIS COMPUTER PROGRAM OR ; THE ASSOCIATED AUDIOVISUAL WORK IS STRICTLY PROHIBITED. ; ALL RIGHTS RESERVED. ;----------------------------------------------------------------------- ; ;_______________________________________________________________________ ; Configuration for Fulsyn. ; To save DSP memory, turn only those module on that are needed. ;_______________________________________________________________________ ON equ 1 OFF equ 0 FMSIMPLE_MOD equ ON FMCMPLX_MOD equ OFF FMENV_MOD equ ON WAVEFM_MOD equ ON WAVEFM2_MOD equ ON WAVETAB_MOD equ ON SMPL8_MOD equ OFF SMPL16_MOD equ OFF CSMPL16_MOD equ ON SMPLENV_MOD equ OFF CSMPLENV_MOD equ ON ;_______________________________________________________________________ ; The following is for the note on/off modules. ; This section does not need to be edited. ;_______________________________________________________________________ WAVEFM_NOTE equ WAVEFM_MOD + WAVEFM2_MOD FMCMPLX_NOTE equ FMCMPLX_MOD FM_NOTE equ FMSIMPLE_MOD + FMENV_MOD SMPL_NOTE equ SMPL8_MOD+SMPL16_MOD+CSMPL16_MOD+SMPLENV_MOD+CSMPLENV_MOD WAVETAB_NOTE equ WAVETAB_MOD ;_______________________________________________________________________ ; SET GLOBAL & MIDI VOLUME ;_______________________________________________________________________ GLOBALVOLUME equ $7fff MIDIVOLUME equ $7fff ;_______________________________________________________________________ ; SET SCLK ;_______________________________________________________________________ SCLKVALUE equ 19 ;_______________________________________________________________________ ;____________________________________EOF________________________________ synth.s ;----------------------------------------------------------------------- ; This is a simple sample program to play a tune on the synth code. ; ; MODULE: SYNTH DATA FILE ; DESCR: THIS FILE CONTAINS THE PATCHES, SAMPLES, ENVELOPES, ; USER WAVEFORMS AND AN INITIALIZED VOICE TABLE. ; ; COPYRIGHT 1992,1993,1994 Atari U.S. Corporation ; ; UNAUTHORIZED REPRODUCTION, ADAPTATION, DISTRIBUTION, ; PERFORMANCE OR DISPLAY OF THIS COMPUTER PROGRAM OR ; THE ASSOCIATED AUDIOVISUAL WORK IS STRICTLY PROHIBITED. ; ALL RIGHTS RESERVED. ;----------------------------------------------------------------------- ;----------------------------------------------------------------------- ; INCLUDE FILES ;----------------------------------------------------------------------- .include 'jaguar.inc' .include 'fulsyn.inc' .include 'synth.cnf' ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; DATA SECTION ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .data .even ;*********************************************************************** ;** EDIT AFTER THIS POINT ** ;*********************************************************************** ;----------------------------------------------------------------------- ; PATCHES ;----------------------------------------------------------------------- patches:: dc.w 1 ; NUMBER OF PATCHES ; Patch 0 .include 'patches\\strlow.ptc' ; strlow patch ; uses 's_strlow' sample ; and 'e_strlow' envelope ;----------------------------------------------------------------------- ; SAMPLES ;----------------------------------------------------------------------- strlow_s: .incbin "samples\\synstrgs.cmp" ; sample used in patch 0 ;----------------------------------------------------------------------- ; +++ START OF DSP SECTION +++ ;----------------------------------------------------------------------- .DSP TABS_COPY:: dc.l TABSSTART ; DO NOT EDIT THIS LABEL dc.l TABSEND - TABSSTART ; DO NOT EDIT THIS LABEL ;----------------------------------------------------------------------- ; INITALIZED VOICETABLE ; A zero in the first field tells FULSYN that this is the last voice ; to be used! ;----------------------------------------------------------------------- .ORG tablestart TABSSTART:: ; DO NOT EDIT THIS LABEL dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 0 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 1 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 2 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 3 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 4 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 5 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 6 dc.l 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 7-LAST dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 8 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 9 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 10 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 11 dc.l -4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; voice 12 dc.l 0 ;----------------------------------------------------------------------- ; USER WAVEFORMS ;----------------------------------------------------------------------- ;----------------------------------------------------------------------- ; ENVELOPES ;----------------------------------------------------------------------- strlow_e:: .include "slopeenv\\string5.env" ; envelope used in patch 0 ;*********************************************************************** ;** EDIT UP TO THIS POINT ** ;*********************************************************************** ; have slop for sloppy loader .dc.l 0,0 TABSEND:: ; DO NOT EDIT THIS LABEL .dc.l 0 .end ;____________________________________EOF________________________________ wsttqumi\f{b _ [, X3 U $ 3 E xK u r o l iK fP c ` ] Z VS x"u%rol:i<fjcs`]ZWT       .x6uDrLo[l_ixfc`]8Zb'Vc'R      c''x't'q(n[(j)g)d6*aI*^*[*X*U+R +=+xP+u+r+o*,l>,in-f-b._/[(1X^1T2Q, 22x2u2r>3oI3l3i3fx4c4`4]4Z5W5T      56x6ug6rs6o7l7i8f8cR9`w9]9Y;V;S      ;<x<u<r=o=l7=hr=e=b=_=\?Y?V@S ,  @ @x@u@rBo.Bk9ChCCeCbC_C\CYDUxER    xEExFu#FrFoFlFiGf*GbKK_XK\UYUVUS   UUwXtYXpZmZjv[gz[d}[a[^_\[\X\TG]Q   G]L]x]u]r^o^l%_i/_f\_b^_^_[_X_U_R       __x_u`r`o`l`iafaca`a]aZaV!cS      !c)cx?cuGcrsco{clcicfdcAd_e\eYeVeS     eXfx]fuafrifonflgigfogcrg`vg]~gZgWgT      ggxguhr;hnikihieibi_]j\ejYjVjR    jYlx^lublrjloolllilfmc2m`9m]ee7f7fgh;hiijjk8lmk}ʠߠ ;=_;jl֢آFHjlգף 9;;G[JΥgӦ CFy":Ѩ1{}ĩש)>Si˪)su1PR35֭5ծ8xQ:LƱƱݱ'8ܲ&psȳ<>Iy]_j*t{}7P-h޸Tʹ E4=??3@ּؼ"l׽ fhi=/2!;(fhiO 2fhiO 2On 1l Tms RmnSymbol Helv 0CourierTimes New Roman Arial MS Serif MS Sans SerifTimes Helvetica System 0Courier NewPZapfDingbats Wingdings Arial Rounded MT Bold Arial Super Avant Guard Balloonf PBauhaus 93Bookman Old StyleCandy Caslon 3 Caslon 540Corporate BlackCorporate CompressedfhCorporate Compressed ExtraCorporate Compressed UltraCorporate CondensedCorporate MonoCorporate RoundedEurostile ExtendedFlare GothicFlare Light Gothic Franklin Cond. Gothic Franklin Extra Cond. Gothicf Franklin Gothic0Letter Gothic News Serif0OratorSans Sans Black Sans Black Cond. Sans Condensedf Sans Light Sans Light Cond. Sans Narrow Zingbats MT Extra 0MS LineDraw PAlgerian PBraggadociof Britannic Bold@Brush Script MT Century Gothic PColonna MT PDesdemonaFootlight MT Light Impact PKino MT Wide Latin@Matura MT Script Capitals PPlaybill@American UncialBernard MT Condensed Calisto MTfhEngravers MTGoudy Old Style HaettenschweilerPImprint MT ShadowModern No. 20 News Gothic MT0OCRBf@Palace Script MTPerpetua Titling MT RockwellRockwell Extra Bold PWestminster Albertus (W1)fh Albertus Xb (W1) Antique Olv (W1) CG Omega (W1)CG Times (W1)Clarendon Cd (W1)@Coronet (W1)fh0Courier (W1)Garmond (W1)0Letter Gothic (W1) 0LinePrinter@Marigold (W1) Univers (W1) Univers Cd (W1)0Modern@ScriptRoman MS Dialogfhi