Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!wells!alba2l!rescon!pacs!ewb6720 From: ewb6720@pacs.UUCP ( Eric W. Bray) Newsgroups: comp.sys.ti Subject: Re: Rave 99 keyboard and hard-floppy drive controllers Summary: MIDI INTERFACE CRYSTAL SOFTWARE SYMBOLIC NOTE FORMATION Message-ID: <409@pacs.UUCP> Date: 24 May 91 16:07:37 GMT References: <2737@lee.SEAS.UCLA.EDU> <406@pacs.UUCP> <408@pacs.UUCP> Distribution: usa Organization: Philadelphia Area Computer Society Lines: 365 ============================================================================== ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Documentation (Public Domain) On the Symbolic Note Format (SNF) Language definition by Michael J Maksimik Current language specification 1.0 as of 04/23/91 The Symbolic Note Format (hereafter known as SNF) is a music notation specification designed for the MIDI Master 99 compiler. Music placed in SNF is easy to read into a compiler, and easy to read from a human standpoint. The versatility of SNF can be seen as it is ready to accept whole works of music, to individual tracks which can be imported into already existing data. This is the beginning of the specification: New versions are already planned and this note format will remain upwardly compatible. Features: SNF can handle up to 16 voices. Each voice is monophonic (one note may play at any time per channel) for a combined capability of 16 note polyphony. The voices may be independently assigned to MIDI channels. There are 16 MIDI channels to choose from. You may assign all of the 16 voices in any number or combination to the 16 MIDI channels. Example: a song has 8 voices. Three of the voices will be played as a piano, two more voices will be played as violin, two more played as trumpet, and a final voice will be a trombone. The programmer then chooses to play voices 1..3 on MIDI channel 1, assigned to the piano waveform; voices 4,5 on MIDI channel 2, assigned to the violin waveform generator; voices 6,7 on MIDI channel 3 assigned to the brass (trumpet) waveform; and voice 8, which the programmer has chosen to assign to channel 4, the trombone sound. If the MIDI keyboard allowed this combination (4 different waveforms, each to its own channel) then the octet of instruments would play in harmony, in 8-note polyphony. As a comparison, the TI sound chip (9914) can create one waveform, the square wave, and has three voices which may independently be sounded on or off, plus one noise channel, in which the waveform is selectable according to the noise type desired. SNF can DYNAMICALLY change the instrument assignments. Suppose the musical work is played, and at the beginning, the main instrument is the piano. At any point after that assignment, the instrument can be re-selected, and the note data following that change will sound like the new instrument you have selected. SNF allows most notes to be compiled, including whole, half, quarter, eighth, sixteenth, 32th, and 64th and triplets of all but the 64th variety. Notes may also be dotted (not staccato) but dotted timewise..a dotted half note is three beats, not two in (4/4) time. Double dotted format is also available, which will give 1 3/4 the total note value (a double dotted quarter is 1 and 3/4 of a beat in (4/4) time). You may not have a dotted triplet, that is not permissible even in regular music! SNF allows notes to be compiled over a wide multiple-octave range. The lowest note allowed in this format is MIDI note # 32, which is C below low C. The highest note possible is MIDI note # 96, which the 2 c's above high C. Sharps and flats are possible, with postfix notation. Finally, the song may be commented. The asterisk (*) is used to begin a comment, at the beginning of a line. SNF definition (by line) (Assume n lines in the file) line 1: SongTitle,NumberOfVoices,SongVersion Line 1 must contain the header. SongTitle is the name of your song, in text. The text must be surrounded by single or double quotes, or parentheses. SongVersion is a numeric field indicating the version of the song in the file. The above fields are neccessary, but ignored. NumberOfVoices is necessary to indicate the total number of voices you wish to use. This value partitions memory in (NumberOfVoices) segments, equally divided. If you choose to select 8 voices, the 24k available to notes will be split eight ways, that is, each voiceline can handle about 3k, which amounts to about 1600 notes per voiceline. (each note occupies one word of memory). line 2...line n-1: the next lines, except the last line, must contain note data and directives, or comments. The comment form is a line of characters in any combination, preceded by an asterisk in the first column (*), as follows: * this is a comment. The comment asterisk must be used to space lines also, as blank lines are NOT allowed, and are interpreted by the compiler as an error. Always use the asterisk in column 1 of any comment (or blank) line. The music note data format is as follows: Voice,Note,Duration Where Voice is a value from 1..16 inclusive. Note is a symbol indicating the note desired. It is of the form: XN[A] Where X is a value from 0..5, N is a character from A..G, and A is an optional accidental indicator, that is # for a Sharped note, and @ for a Flatted note. A sharped note will have a 1/2 step on the octave added to the note value, and a flatted note will have 1/2 step subtracted from the note value. In MIDI notation, a 1/2 step is exactly one note number above (for sharps) or below (for flats). There is no notation for natural, note is to simply omit the sharp sign (#) or the flat sign (@). Rests are indicated by the symbol R. A rest is a note that is not played, instead, it is a period of rest, determined by duration value. Duration is a symbol indicating the length of the note, (or rest). The syntax of the duration is as follows: [-][{.}][3]D Where the [-] sign indicates that the note is tied to the previous note. Tied notes are only allowed if this note is the same octet value of the previous note. You may not use the [-] sign to slur notes, as slurring is not allowed under MIDI conditions. The [{.}] sign represents one or two optional periods. The [-] sign and the [{.}] may be used in combination with each other. The [3] sign indicates that the note is to be timed as a triplet, that is, 3 notes in series, as triplets, will equal double the D value for duration. It essentially allows a note to take on 2/3 its D value. You may not use the [3] option in combination with the [{.}] option. Finally, the D value is one of a number of letters indicating the base timing of the note. The values allowed for D are: W = whole note H = half note Q = quarter note E = Eighth note S = 16th note T = 32nd note I = 64th note There are many possible combinations of timing, but follow these rules: a single dot will add 1/2 the note value to it, for a total duration of 1 1/2 times the note value. a double dot will add 3/4 the note value to it, for a total duration of 1 3/4 times the note value. a 3 will indicate a total timing value of 2/3 the note value. a - will indicate that the note is to be appended to the previous timing value. Using the above rules, a wide variety of notes can be created, from simple tunes to mordents and turns. While I have not yet defined a mordent in terms of a dedicated note value or qualifier, that is up to the user to enter into the computer. Trills are possible, as are staccato notes. For trills, use the 16th and 32nd note values to add color to the music. For Staccato notes (those notes with a dot above them, as opposed to dotted notes, with the duration dot beside and to the upper right of the note) use the value of 1/4 the selected value, and rest the remaining 3/4 of the time. Here is a short example. *this is a comment. remember it has an asterisk in front of it * *the above line is blank. * 1,2G#,.Q 1,2G#,-..E 1,2F,3Q 1,2E,W 1,2E,-H *THE NEXT VOICE. 2,0A,Q 2,0B,H 2,1C,E 2,1D,S 2,1E#,T 2,1E@,I 2,1E@,-.W *THE NEXT LINE ENDS THE SONG FILE END. As indicated above, the END. directive ends the file. There are two other directives in the SNF format. The CHANNEL directive is of the form: 0,VoiceNumber,ChannelNumber The 0 indicates CHANNEL directive, the VoiceNumber is the number of the SNF voice you wish to assign (a value from 1 to 16), and ChannelNumber is the number of the MIDI Channel you wish to have the VoiceNumber assigned to. It has a value from 1 to 16. The PROGRAM directive allows you to equate an SNF voice to a program, which is most cases is a particular instrument on the MIDI device. An instrument can have a value from 0..127, and can be widely varied. The most common instruments are piano, organ, violin, harpsichord, clavicord, bass, and drums. There are variations to these, and there are even possibilities on certian MIDI devices to create your own waveforms, through digital sampling. This is dependent on the MIDI device, and to make it as independent as possible, the MIDI Master software (as well as most other sequencers) have built in translators called patch librarians which translate one instrument into another. For example, If you compile a song in SNF format, and it was originally written for instrument #4, which is organ on the CASIO MT 240, to sound correctly on the YAMAHA DX-7 it would have to be tranlated, or patched, to instrument #57. You do not have to know the instrument numbers when you first program a song in. It is possible to change the patch, or translation, when the program us running. It may be handy, however, to know the numbers that the instruments have. They are usually listed in sequence on the front panel of the keyboard or instrument. If not, there are so few instruments that they are simple to memorize. The syntax of the PROGRAM directive is: 17,VoiceNumber,InstrumentNumber The 17 indicates the PROGRAM directive, VoiceNumber is the number of the SNF voice (1..16) and InstrumentNumber is the number of the instrument which is to be assigned to VoiceNumber. Until the PROGRAM directive is encountered again, all notes played on VoiceNumber (and all notes played on other voices assigned to the same MIDI channel that VoiceNumber is assigned to) will play on the instrument assigned (in your MIDI keyboard) to InstrumentNumber. For example, suppose that the following CHANNEL directives appear at the start of the SNF file: 0,1,1 0,2,1 0,3,1 0,4,2 0,5,2 And then if the following directives appear somewhere in the SNF file: 17,1,32 17,5,16 Then all notes played on SNF voices 1..3 will be played on instrument 32, and all notes played on SNF voices 4 and 5 will be played on instrument 16. The CHANNEL directive, if ommitted, defaults all voices to MIDI channel 1. IF the PROGRAM directive is ommitted, all voices will default to instrument #0, and hence, all channels will activate the MIDI instrument #0. This is usually the piano on most CASIO and YAMAHA keyboards, although there are many exceptions. If later in the file more PROGRAM directives appear: 17,3,24 17,4,21 Then SNF voices 1..3 will now be played on instrument 24, since they were all assigned to the same MIDI channel at the beginning of the file. Also, voices 4 and 5 will now play on instrument #21. IMPORTANT: you may only have ONE CHANNEL directive for each voice..and they should appear before any notes. The CHANNEL directives are static in nature..that is, once they are set, you cannot change them without re-compiling the file, after first changing the CHANNEL directives. On the other hand, the PROGRAM directives are DYNAMIC, and you may have as many of them in the file as you like. REMEMBER that the PROGRAM directives on one voice in any channel group also changes the PROGRAM assignment for all other voices in the group. This allows you to create polyphonic effects, with multiple instruments, among 16 monophonic channels. While this is an elementary level to program with, future versions will allow an infinite number of notes per voice, (actually 32767 polyphonic notes). The code to do this is very intricate, and there was very little room for that method in this version. Planned songs will sound just as colorful and versatile as the polyphonic voice music, and will also take up less memory. CakeWalk files, which are polyphonic voice songs, require that the data be represented by three words in memory instead of the SNF format, which only requires one word of memory per note. It is possible, however, to generate equivilent CakeWalk files from SNF files. However, it is much, much easier to program using the syntax of SNF, other than using the raw numeric data that is CakeWalk file format. That is the definition of SNF. Below is an example of an independent SNF music file, a C major scale, covering 2 octaves. C Scale,1,1 *assign to channel #1 0,1,1 *use the organ, on MT-240 by casio, instrument number 4 17,1,4 * * *now begin the scale * 1,1C,H 1,2D,Q 1,2E,Q 1,2F,Q 1,2G,Q 1,2A,Q 1,2B,Q 1,2C,H *now change to honky tonk piano * 17,1,20 * 1,3D,Q 1,3E,Q 1,3F,Q 1,3G,Q 1,3A,Q 1,3B,Q 1,4C,Q * *here is the end of the song. END. The above example shoulf clearly indicate how an SNF file should be formed. It is possible to use comments to delimit verses of songs, refrains, interludes, and special passages in the music, to allow for customization of the music, and adding color and variety to the notes. I suggest starting with something VERY simple, and after familiarity with the coding, choose more intricate works. The more difficult the music, the more interesting it will be to listen to, in live performance. ONE FINAL NOTE:: the files must be in DV80 format. It is possible to enter all of the data using an extended BASIC program such as the following: 10 INPUT "OUTPUT FILENAME: ":F$ 20 OPEN #1:F$,SEQUENTIAL,DISPLAY,OUTPUT,VARIABLE 80 30 PRINT "ENTER A BLANK LINE TO QUIT" 40 LINPUT A$::IF A$<>"" THEN PRINT #1:A$::GOTO 40 50 CLOSE #1 60 END The above program will only allow input of one line at a time, and no editing of previously entered lines. I suggest that you use TI WRITER, The E/A editor, c99 program editor, or MY-Word, or any such text file editor. It does not matter whether you use tabs or not (that is, in TI WRITER whether you use the print file or save file options.) Additional suggestions: Since the SNF file format is easy to generate from a human point of view, it is also easy to gererate from a computing point of view...that is, it is easy to covert CALL SOUND statements into MIDI notes. Just use the table in the Extended BASIC reference manual on notes/frequencies, and wherever a call sound statement exists, replace it with a CALL SOUNE statement, and then define the 2000 SUB SOUNE(D1,f1,v1,f2,v2,f3,v3) 2010 REM place the code here to convert d1,f1,f2,f3 to SNF file statements. 2020 REM use 3 SNF voices, and one channel to directly emulate the ti sound 2030 REM chip..ignore the volume values, SNF version 1.0 does not allow volumes As stated above, SNF version 1.0 does not allow volumes, or dynamics to be used in the music. The reason for this is prudence. Allowing volume variations (some notes softer than others) uses an extra byte of memory, and requires more notation, plus directives to handle dynamics (gradually louder or softer). For now, place the dynamic indicators in comments. Future versions already support the volume parameter and dynamics. Keep in mind that most MIDI keyboards within the price range of people reading this do not have the hardware to play the notes at independent volumes--that is, there is one master volume switch, and it controls ALL notes. Only the more expensive keyboards (above $600.00) allow each note to have it's own volume. MIDI refers to volume as note velocity. If your keyboard specification allows velocity values, you will be able to get full use of the keyboard with the next release of MIDI Master 99, version 3.0. There is only one program that uses SNF version 1.0 files. That is MIDI Master 99. It requires a ti home computer, 32k, disk system, supercart or superspace, or equivilent, rs232 interface, and a MIDI device. Strongly encouraged is the TI writer editor. Alternatively, a Myarc 9640 can be used. While MIDI Master requires 40k of memory (32k plus 8k at >6000) it does not use any additional memory on the 9640. However, it does run from MDOS using EXEC (for maximum reliability, use MIDI Master 99 in GPL mode). If you would like MIDI Master 99, please send $44.95 to Michael Maksimik 635 Mackinaw ave Calumet City, IL 60409 Make all checks payable to Michael Maksimik. All orders for MIDI Master 99 v. 2.2 will recieve a free upgrade to version 3.0, IF the registration postcard is sent in. The SNF is a one of the Crystal Software Projects. CakeWalk is a registerd trademark of TwelveTone Systems YAMAHA and CASIO are tradenames of YAMAHA LTD. and CASIO LTD. respectively. Dealer inquiries invited.