
  S M I L E   S U P P O R T E D   M U S I C \ S O U N D    C O D E S


Music and Sound Codes follow the format of the BASIC language commands
PLAY and SOUND.  The major difference is a "Trigger Sequence" is needed
to turn on the Music Routine in SMILE that emulates those BASIC 
commands.  Many BBS programs and ANSI viewers also support this type of 
music format.  It just so happens that the Music "Trigger Sequence" in
these programs is ESC[ which is identical to the "Trigger Sequence" 
used to begin an ANSI Escape sequence.  So, this Music Code format has
"generally" become known as ANSI MUSIC.   For convience this document 
will use that name to describe SMILE supported Music and Sound commands.


ANSI MUSIC is actually made up of a three part string, or sequence of 
characters.

  (1)        (2)             (3)
  Trigger    Music\Sound     Terminate

  ESC[       <commands>      CTRL-N


  (1) The trigger sequence is ESCape (Dec 27) + [ (Dec 91)  followed by
      either MF (Music Foreground) or MB (Music Background).

  (2) A string of music commands (see below).  Blank spaces are ignored.

  (3) The terminate character is CTRN-N (Dec 14)

The MUSIC\SOUND routine in SMILE is triggered by ESC[MF or ESC[MB and 
begins to interpret the following charactes as MUSIC or SOUND until the 
terminate character CTRL-N is read.



MUSIC COMMANDS

          Please refer to your BASIC manual for information on the
          BASIC Play commands.  The following are all valid for
          beginning a Music string in SMILE: MF, MB, MN, ML, MS.
          Although MB (Music Background) is valid, true backgroud    
          music is NOT supported at this time.
     
          Syntax: MF T120 O2 C8D8E8F8G4



          MF  Music Foreground 
          MB  Music Background  (not supported, defaults to MF)


          MS  Music Staccato    notes play 3\4 of designated Length
          MN  Music Normal      notes play 7\8 of designated Length
          ML  Music Legato      notes play full designated Length
  
          A,B,C,D,E,F,G    Play the specified note in current octive
          Following a note:
            1-64     Set note length (Ex. A8 = play note A as 1\8 note)
            # or +   indicates Sharpened note.
            -        indicates Flattened note.   
            .        increases not length by 1\2.

          On  Octive Range (n = 0-6)    ** Default is 4
              Select from seven available octives

          >   Raise Octive one step
          <   Lower Octive one step

          Nn  Note Value   (n = 0-84)   ** Default is 4 - Quarter Note
              There are 84 possible notes in seven octives.

          Ln  Note Length  (n = 1-64) Sets following notes to the value
              of "n" until value is changed.
              1 = Whole Note, 2 = Half Note, 4 = Quarter Note  etc

          Tn  Tempo        (n = 32-255) ** Default is 120
              Number of Quarter notes per minute

    Example:  Add the Trigger Sequence and Terminate character to the 
              following Music string to PLAY Happy Birthday.


    MFT120MNO3C6C8D4C4F4E2C6C8D4C4G4F2C6C8O4C4O3A4F4E4D2B-6B-8A4F4G4F2




SOUND COMMANDS


          ( Thanks to Julie Ibarra, author of ANSIPLAY for this idea )

          Sound commands are not yet supported by any BBS software I am
          aware of.
     
          Syntax: 
          Freq;Duration;Cycle1;Delay1;Variation; Cycle2; Delay2
     
          Custom Sounds are supported in SMILET by using a SOUND CODE
          similar to that found in BASIC and the program ANSIPLAY.
          A second Cycle\Delay option was added to the SOUND code
          used in ANSIPLAY, providing a looping effect.  The frequency
          values used to produce the musical notes are listed somewhere
          down the page.
     
          The SOUND statement must begin and end in the same manner
          discussed above for a normal music string.  

          The SOUND CODE consists of the following parameters serparated 
          by a semicolons (;) :
     
          FREQ     : Frequency of note to be played.  The effective 
                     range of frequencies is 37 to 7904.  
                     (0..65535)
          
          DURATION : Time, in CLOCK TICKS, the note should be played.
                     (18.2 ticks per second)
                     (0..65535)
     		
          CYCLE1   : Number of times to repeat Frequency\Duration.
                     (0..65535)
     		
          DELAY1   : Delay Time between CYCLES (Milliseconds / 4).  
                     (0..65535)
     		
          VARIATION: Frequency value is changed by this number for
                     each CYCLE the note is played.  A negative number
                     will be subtracted, but if FREQ reaches 0 then 
                     VARIATION is added to FREQ for the remainder of the
                     cycles.
                     (-65535..65535)

          CYCLE2    : Number of times to repeat the first 5 parameters
                      <Freq;Duration;cycles;delay;variation>
                      (0..65535)

          DELAY2    : Delay Time between CYCLE2 (Milliseconds /4).
                      (0..65535)
     
          (NOTE: 1 second = 1000 milliseconds)
     		
     

     		
     
          SOUND CODE Frequency Values (84 Notes - 7 Octives):
     

            C    C#   D    D#   E    F    F#   G    G#   A    A#   B
       
            65   69   73   78   82   87   92   98  104  110  116  123 
           131  139  147  156  165  175  185  196  208  220  233  247 
           262  278  294  312  330  350  370  392  416  440  466  494 
           524  556  588  624  660  700  740  784  832  880  932  988 
          1048 1112 1176 1248 1320 1400 1480 1568 1664 1760 1864 1976 
          2096 2224 2352 2496 2640 2800 2960 3136 3328 3520 3728 3952 
          4192 4448 4704 4992 5280 5600 5920 6272 6656 7040 7456 7904  


          EXAMPLE: (Telephone jingle)
                   ESC[MF 800;1;2;50;-200;10;50 CTRL-N

                ESC[MF  Trigger sequencd
          Freq:    800  Note Frequency 
          Dura:      1  Play Note for 1 Clock Tick (18.2 ticks per second)
          Cyc1:      2  Repeat Frequency\Duration 2 times
          Dly1:     50  Delay 10/4 milliseconds before repeating 
          Vari:   -200  Decrease Note value by 200 each cycle 
          Cyc2:     10  Repeat first 5 parameters 10 times
          Dly2:     50  Delay 10/4 milliseconds before repeating
                CTRL-N  Terminate Character
          

          One advantage of the SOUND CODE is the ability to place a
          PAUSE in your ANSI screens without having to use a
          multitude of ESC[s codes.  Just use a SOUND CODE with the
          DELAY set very high to get a pause.  For example,
     
          ESC[MF ;;;60000
     
          would pause your ANSI Screen for 15 seconds (60000/4), or 
          until a key is pressed when viewing it with SMILE.  Remember,
          these SOUND CODES are not supported by bulletin boards...(yet)!
