  FM sound extended BASIC 

         MSX-MUSIC 

The  FM sound extended BASIC,  MSX-MUSIC is made so that you can use the 
 FM sounds in the FMPAC with your program an commands. Using MSX-MUSIC to 
 produce  sounds will allow you to create beautiful sounds  not  possible 
 with the PSG.

If  you have never composed music using BASIC before,  reading the BASIC 
 manual  on  the play command will give you a understanding  on  creating 
 music.

There  is  a semilar extension of BASIC call MSX-AUDIO but  they  are  a 
 little different so take care not to mix them up.

  FM sound extended BASIC 

         MSX-MUSIC 

MSX-MUSIC commands

Reading the instructions

The commands will be explained as the example below.

Example:

Command: MUSIC ------ command name

Operation ( what the command does)

Format: ( how the command is used
        CALL MUSIC [(<MODE>[, ...])]

Sample  (example)

Notes   (notes on the command)

In  the  format  of the command,  the following symbols  are  used.  The 
 symbols are not to be entered but mean the following.

[ ] --- characters and symbols within the bracket are optional
< > --- characters within theese must be entered in thsi position
"..." - characters that are repeated.


  FM sound extended BASIC 

         MSX-MUSIC 

 Command:   MUSIC 

Operation: Starts up MSX-MUSIX and determines how the channels are to be 
            divided and used. This command us used first.

Format:    CALL MUSIC [(<MODE>[,0[,<n1>[,<n2>[,......[,<n9>]]]]]]]]]])]

Modes may be 1 or 2
1 selects rhythm
The total number when adding n1-n9 must be 9 or less in mode 0
and 6 or less in mode 1 (n1-n2 specifies the number of channels used.

Sample:   CALL MUSIC
          3  channels are given different melodies to play and  3  other 
           channels are prepeared to play rhythm
          [same as CALL MUSIC(1,0,1,1,1)] 

          CALL MUSIC (0,0,1,1,1,1,1,1,1)
          9 channels are set to play different melodies ando no channels
          are set for rhuthm.

Note:     n1-n9 are allocated to MML1-MML9 for the PLAY statement.

  FM sound extended BASIC 

         MSX-MUSIC   

 Command BGM 

Operation   Specifies to allow other commands to be executed while music 
             is playing

Format:     CALL BGM(n)  n is 0 or 1 or variable of those values
                         default for MUSIC is 1

Sample:     CALL BGM(0)  no other command can be executed while
                         music is playing.

            CALL BGM(1)  commands can be executed while music
                         is playing.

 Command PITCH 

Operation   This sets the pitch of the sounds to be played with the FM
            sounds. All sounds will be adjusted to this pitch.

Format:     CALL PITCH(n) n can be from 410 to 459 (or a variable)
                          the default value is 440 (standard A)

sample:      CALL PITCH(450) Sets the pitch of the sound to be played at 
                              450Hz
                                

  FM sound extended BASIC 

         MSX-MUSIC   

 Command PLAY 

Operations:  Music will be played according to the MML settings

Format:      Play [#<MODE>,]<MML 1>[,....[,<MML n>[,<MMLm>[,<MMLp1>...[,
             <MMLp3>]]]]]]]]]]]]
             <MODE> can be 0,2,3
             <MML1> through <MMLn> are FM sound MML's
             <MML> numbers are the same as the values for CALL MUSIC
             <MML m> is for the rhythm MML
             <MML p1> through <MML p3> are for the PSG MML

Sample:      Play #2, "CD", "EF", "GA"

Notes:  If <MODE> is set to 0 or not set, PSG will be played
        only MML p1-3 can be used
        if <MODE> is set to either 2 or 3 both FM and PSG can be used
        MML 1-2 are set according to the MUSIC command as notes from 
        the  starting  order.  However if a mode that does not  use  the 
         rhythm  channels  is  specified,  the rhythm  channels  must  be 
         omitted.

Function:     PLAY

Operation:    This  detimes  if  music is being played and  returns  the 
               result as a value.

Format:       CALL PLAY (n,x)    n is the channel to check
                                 x is the name of the variable to
                                   store the value in.

Sample:       CALL PLAY(0,A):PRINT A

              When n=0 if any channels are playing, the value -1
              will be stored in A and 0 if no channels are playing.


  FM sound extended BASIC 

         MSX-MUSIC   

 Command STOPM 

Operation:   Stop play of BGM

Format:      CALL STOPM

Sample:      CALL STOPM


 Command TEMPER (temperament)  

Operation    This sets the rhythm for the FM sound

Format:      CALL TEMPER (n)   n can be from 0 to 21 or a variable
                               default value is 9

Sample:      CALL TEMPER (0)

Notes:       for a list of rhythms that can be set and their vlaues, see 
              page 45 "Table of Rhythms.


 Command TRANSPOSE 

Operation:   Will tranpose in units of half tones 1/100 units

Format:      CALL TRANSPOSE (n)   
             n can have values from -12799 to 12799 or a variable
               However, some voices have a limited setting even
               through within the +-12799 range
               Default setting is 0

Sample:      CALL TRANSPOSE (100)  tranposes a half tone.


  FM sound extended BASIC 

         MSX-MUSIC   
                                 

 Command VOICE 

Operation:    Stes  what  instrument <Voice> is to be played by  the  FM 
               sound channels.  However,  values without * mark and array 
               values  (refer  to  page  44 are limited to  2  when  used 
               together.

Format:       CALL VOICE ([@n1], [@n2], .... [@n9]
              n1-n9 can be values from 0-63 (voice nr) or variables

              default setting is @0

Note:         The   voice number canbe selected from the table  on  page 
               44's Table of voices numbers.


 Command VOICE COPY 

Operation:    This   command  copies the voice data to number 63  or  an 
               array variable.

Format:       CALL VOICE COPY (@n1, -n2)
              n1 can be voices from 0-63 that have no * mark or array
              variables.
              n2 can be 63 or an array variable name.

Sample:       DIM A%(16)
              CALL VOICE COPY (@7,A%)
              pipe organ 1 is copied to array variable A.

Note:         choose the voice from the table on page 44.


  Sample Program 

Here is an example using the MSX-MUSIC. The first 8 measures of the song 
 Flower  is shown below.  Refer to thsi song and the MML table and  enter 
 your favorite song to be played with FM sounds.


 MML Table 

This  is a table of the MML (music macro language) that can be used with 
 the PLAY command.


Music MML

 Statement  Meaning                      Range       Default Value *1 

Mn         Envelope cycle setting *2    1>=n<=65535 m255
Sn         Envelope shape *2            0<=n<=15    S0
Vn         Volume                       0<=n<=15    V8
Ln         Lenght                       1<=n<=64    L4 
Qn         Division of sound lenght     1<=n<=8     Q8
On         Octave                       1<=n<=8     O4
>          Raise 1 Octave                  -        -
<          Lower 1 Octave                  -        -
Tn         Tempo setting                32<=n<=255  T120
Nn         Plays Note raised to n       0<=n<=96    -
Rn         Rest setting                 1<=n<=64    R4
A-G        Note                         -           -
+, #       Sharp (raise half tone)      -           -
-          Flat (Lower half tone)       -           -
(period).  Lengthen note or rest by 1.5 -           -
XA$        Plays MML stored in string   -           -
           variable A$ *3
=x;        sets parameter to x          *4          -
&          Tie                          -           -
{}n        will generate even notes of  1<=n<=64    value set
           n for the number within                  with Ln
           the {}     
@n         changes the voice set to n   0<=<=63     -
@Vn        sets detail change in volume 0<=n<=127   -
@Nn        maintain lenght set by n     1<=n<=64    value set
                                                    with Ln

*1 Initial value set when CALL MUSIC is used
*2 For PSG only
*3 Adding MML after [XA$;] will result in error
*4 The   value range is dertimined by the preceeding MML but  it  cannot 
    exceed the value 32767


  RHYTHM MML 

There  are  5  different  voice  that  are  available  for  the   rhythm 
 (percussion)  MML and up to 3 voices may be played  simultaneously.  For 
 this reason the rhythm MML first lines up the instruments that are to be 
 played  simultaneously and the


 Statement     Meaning                         Range     Default 

B             Bass drum                       -         -
S             Snare drum                      -         -
W             Tom tom                         -         -
C             Cymbals                         -         -
H             Hi Hat                          -         -
n (number)    previous notes are played and
              n th note are rested            1<=n<=64  -
Vn            Volume                          0<=n<=15  8
!             Accents preceeding note                   -
@An           Sets volume for voices that     0<=n<=15  -
              are accented.


[Tn], [@Vn], [Rn], [XA$;], [=x;], [.(period)] is the same as music MML



example:      PLAY#2,"","","","BSH8H8H8S!H!8H8"


Bass, snare,hihat and wait an 8th note
Hi hat and wait an 8th note
snare, hi hat plays accented and waits an 8th note
Hi hat and wait an 8Th note


  VOICE DATA TABLE 

This is a list of the voices available for use with Voice command or the 
 MML @ statement.

Voice No.  Name               Voice no.  Name

0 *        Piano 1            32         Piano 3
1          Piano 2            33 *       Wood Bass
2 *        Violin             34         Santule 2
3 *        Flute 1            35         Brass
4 *        Clarinet           36         Flute 2
5 *        Oboe               37         Clavicord 2
6 *        Trumpet            38         Clavicord 3
7          Pipe Organ         39         Koto 2
8          Xylophone          40         Pipe Organ 2
9 *        Organ              41         P0hdsPLA
10 *       Guitar             42         P0hdsPRA
11         Santule 1          43         Church Organ L
12 *       Electric bass      44         Church Organ R
13         Clavicord 1        45         Synth Violin 
14 *       Hapsicord          46         Synth Organ
15         Hapsicord          47         Synth Brass
16 *       Vibraphone         48 *       Horn
17         Koto 1             49         Shamisen
18         Taiko              50         Magical
19         Engine 1           51         Fuwawa
20         UFO                52         Wonderflat
21         Synth Bell         53         Hard Rock
22         Chime              54         Machine
23 *       Synth Bass         55         Machine V
24 *       Synthesizer        56         Comic
25         Synth drum         57         SE comic
26         Synth rhythm       58         SE laser
27         Harmo drum         59         SE noise
28         Cow Bell           60         SE star 1
29         Hi Hat             61         SE star 2
30         Snare drum         62         Engine 2
32         Bass drum          63         no sound         

*  The name of the voice are given for reference only and they  may  not 
 sound the same as the real instruments

*   Are sounds that are build in the FM sound chip and sounds without an 
 * indicates sounds generated by software.


  RHYTHM TABLE 

Table of Rhythm usable with the TEMPER statement


No.     Rhythm

0       Pythograph
1       Mintone
2       Welkmeyster
3       Welkmeyster (adjusted)
4       Welkmeyster (seperate)
5       Kilanbuger
6       Kilanbuger  (adjusted)
7       Velotte Young
8       Lamour
9       Perfect Rhythm (default)
10      Pure Rhythm  c major    (a minor)
11      Pure Rhythm  cis major  (b minor)
12      Pure Rhythm  d major    (h minor)
13      Pure Rhythm  es major   (c minor)
14      Pure Rhythm  e major    (cis minor)
15      Pure Rhythm  f major    (d minor)
16      Pure Rhythm  fis major  (es minor)
17      Pure Rhythm  g major    (e minor)
18      Pure Rhythm  gis major  (f minor)
19      Pure Rhythm  a major    (fis minor)
20      Pure Rhythm  b minor    (g minor)
21      Pure Rhythm  h minor    (gis minor)


