home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / compute / 1989_03 / vmusic.doc < prev    next >
Text File  |  1989-01-26  |  10KB  |  259 lines

  1.                     VMUSIC -- User's Guide
  2.  
  3.  
  4. INTRODUCTION:
  5.  
  6. VMUSIC is a program designed to do what other music programs 
  7. can't do: play actual 3-part music on any PC. As you know, the 
  8. IBM PC was designed to handle only one tone at a time. VMUSIC 
  9. breaks that barrier.
  10.  
  11.  
  12. INSTALLATION:
  13.  
  14. Install VMUSIC by copying all of the files included with the 
  15. program on a floppy disk or into a directory on your hard disk.  
  16. If you're using a floppy disk system, you may want to make your 
  17. VMUSIC disk into a self-booting disk. To do this, format a 
  18. blank disk with the /S switch. Once this is done, copy the 
  19. VMUSIC files onto the new disk.
  20.  
  21.  
  22. RUNNING VMUSIC:
  23.  
  24. Start VMUSIC with the command: VMUSIC filename. Several sample 
  25. song files are included.  To play the song "Greensleeves," for 
  26. example, give the command this way:
  27.  
  28. VMUSIC GREEN <Enter>
  29.  
  30. Next, you'll be prompted for two numbers. The first controls the 
  31. speed at which the song is played. The second controls the 
  32. overall pitch of the notes played by VMUSIC. You'll see 
  33. suggestions for numbers for PCs with various clock speeds. You'll 
  34. have to experiment to find the ideal values for your own PC.
  35.  
  36. Once you determine those values, they should apply to all the 
  37. songs you want to play.
  38.  
  39. VMUSIC can also be started with three command-line arguments:
  40.  
  41.         1.      Song file name
  42.         2.      Tempo value
  43.         3.      Value to set relative pitch
  44.  
  45. A typical command line for a 12 MHZ AT might be:
  46.  
  47. VMUSIC GREEN -8 6
  48.  
  49. Negative numbers may be used for tempo on really fast ATs or 386 
  50. machines.
  51.  
  52. VMUSIC was first written for PCs and the first ATs (6 MHZ), but 
  53. the world has since moved to 10-12 MHZ ATs and is moving to 
  54. 386 machines. This version will sound right on all of them.
  55.  
  56. Here are some values for tempo and pitch parameters to try with 
  57. your PC:
  58.  
  59.            PC TYPE             Tempo         Pitch
  60.  
  61.            4.77 MHZ PC          10            1
  62.            8 MHZ XT              0            2
  63.            6 MHZ AT             -2            3
  64.            12 MHZ AT            -8            6  
  65.  
  66. VMUSIC should be able to play music for about 25 continuous
  67. minutes, ample for most purposes. It will output a total count 
  68. of notes to the screen for a given song and this count may go as 
  69. high as 30,000. For reference, BABYLON has about 400 notes.
  70.  
  71.  
  72. CUSTOM BATCH FILES:
  73.  
  74. Once you determine the best numbers for VMUSIC tempo and pitch 
  75. parameters, you can automate the process with a simple batch file.
  76. Use a text editor like SLED to create the batch file. You can 
  77. also use your word processor, but save the file as a pure ASCII 
  78. file. Consult your word processor's manual for instructions.
  79.  
  80. For example, using the sample command for an 8 MHZ XT, as shown 
  81. above, here is a batch file, called VM.BAT.
  82.  
  83. ECHO OFF          REM Turns off command display on screen.
  84. CLS               REM Clears the screen.
  85. VMUSIC %1 0 2     REM Starts VMUSIC with the song named as %1.
  86.  
  87. Now, to start VMUSIC, just give the command VM, followed by the 
  88. name of the song file. The command might look like this:
  89.  
  90. VM GREEN
  91.  
  92. The batch file supplies the necessary speed and pitch parameters. 
  93. Naturally, you'll replace the values shown in the sample file with 
  94. the ones that work best on your own PC.
  95.  
  96. WRITING YOUR OWN SONG FILES:
  97.  
  98. You can create your own song files for VMUSIC, using a text 
  99. editor, like SLED, or any other editor that can save files as 
  100. pure ASCII files. Enter the music by typing in the commands, as 
  101. described below. VMUSIC ignores carriage returns, so you can 
  102. format the file any way you like.
  103.  
  104. Each voice is a separate part of the file. Write one complete set 
  105. of instructions for each voice, then add the next voice.
  106.  
  107. VMUSIC uses the same syntax as BASICA/GWBASIC's PLAY statement for 
  108. its song files. In addition, you add another command to tell 
  109. VMUSIC which voice each line represents. All characters entered 
  110. can be either upper or lower case.  
  111.  
  112. Here are the commands used in VMUSIC song files, presented in the 
  113. order you are most likely to use. Note: Do not include the 
  114. parentheses () when typing commands.
  115.  
  116.      V(n)
  117.      This command tells VMUSIC which voice each line represents. 
  118. Replace (n) with a number from 1 to 3. Voice 1 is usually the top 
  119. line in sheet music, although you can use any order you wish.
  120.  
  121.      T(n)
  122.      This command sets the tempo for your tune. Use a
  123. number from 32-255 for (n). The tempo you select will remain in 
  124. effect until it is changed.
  125.  
  126.      O(n)
  127.      The "O" command sets the octave. Choose a value from
  128. 0-6 for (n). As with the "T" command, the octave setting remains in 
  129. effect until changed. Middle C is in octave 3.
  130.  
  131.      M(L,N,S)
  132.      The "M" command changes the way each note is played. An
  133. "ML" command plays each note full length. To play each note for 7/8 
  134. of its value, use the command "MN."  For staccato notes, each played 
  135. for 3/4 of its value, the command is "MS."  These commands remain in 
  136. effect until changed.
  137.  
  138.      A-G(n)
  139.      These are the actual notes used in "Vmusic" tune
  140. strings. They represent the normal notes of the scale. Specify the 
  141. length for each note with a value for (n) between 1 and 64. Each 
  142. number represents a type of note. For example, 1 represents a whole 
  143. note, 4 is a quarter note, which gets one beat, and so on. Triplet 
  144. figures are formed with note lengths that are multiples of 3.
  145.  
  146.      L(n)
  147.      This command sets up a default length for all notes
  148. that follow. Including the command "L8," for example, makes all 
  149. the notes that follow equivalent to eighth notes unless another 
  150. number is attached to an individual note.
  151.  
  152.      P(n)
  153.     Use this command to create rests or pauses in your music.  
  154. The values for (n) are the same as those used to specify note 
  155. length. "P8" produces an eighth rest.
  156.  
  157.      < or >
  158.      These commands are a shortcut for changing octaves. The
  159. command "<" moves the following notes down one octave, while
  160. ">" moves them up one octave. As an example, here is a one- 
  161. octave scale:  CDEFGAB>C. All VMUSIC octaves start with the 
  162. note C.
  163.  
  164.      + or #
  165.      Makes the preceding note sharp. Place this character 
  166. after the note character, but before the length parameter.
  167.  
  168.      - (minus sign)
  169.      Makes the preceding note flat.
  170.  
  171.      .(period character)
  172.      Increases the length of the note or pause by a factor
  173. of 1.5. Use this dot character in the same way you would in 
  174. standard music notation. The command "C4." produces a dotted 
  175. quarter note, equivalent to a quarter note plus an eighth note.
  176.  
  177. As a general rule, set the tempo (Tn), the mode (Mn), the voice 
  178. (Vn), and the starting octave (On) at the beginning of each voice 
  179. line. Enter other commands as you choose to create your tune.
  180.  
  181. One important caution is in order. For a VMUSIC song file to play 
  182. properly, all voices must match perfectly in length. You must give 
  183. the correct values for each note, or the voices will begin to lose 
  184. synchronization. If your song file sounds odd, the problem is 
  185. probably a mistake in writing one or more of the voices.
  186.  
  187. As an example, here's the actual text from the song file GREEN:
  188.  
  189. O4L8V1 d f4 g a. b16 a g4 e c. d16 e f4 d d c+ d e4 c+ <a4 >d f4 g 
  190. a. b16 a g4 e c. d16 e f. e16 d c+ <b >c+ d4 d d4 p8 >c4. c. <b16 
  191. a g4 e c. d16 e f4 d d. c+16 d e4 c+ <a4 p8 >c4. c. <b-16 a g4 e 
  192. c. d16 e f. e16 d c+. <b16 >c+ d4. d4
  193.  
  194. O4L8V2 <d d4 e f. g16 f >c4 c c4 c d4 <a b-4 b- a4. a4 p8 >d4 c 
  195. <f. g16 f >c4 c c4 c d4. <a4. f. g16 e d4 p8 a. g16 f f. g16 f >c4 
  196. c c4 c d4 <a b-4 b- a4 a a4 p8 a. g16 f f. g16 f >c4 c c4 c d4. 
  197. <a4. f. g16 e d4
  198.  
  199. By studying this two-voice song, comparing each line with the 
  200. commands shown above, you can see how a song file is created. Like 
  201. all musical instruments, creating music with VMUSIC takes practice.  
  202. Experiment with song files, and you'll soon be writing complex music 
  203. of your own.
  204.  
  205. For more information about the syntax of VMUSIC song files, 
  206. consult the section on the PLAY statement in your BASICA or 
  207. GWBASIC manual.
  208.  
  209. I would appreciate receiving copies of any music which you might 
  210. code up for VMUSIC, and I would appreciate hearing from anyone 
  211. able to get VMUSIC to run under any of the new multi-tasking OSs 
  212. (particularly UNIX variants) on 386 equipment, while at least one 
  213. other process is running.
  214.  
  215. VMUSIC is a public-domain program. I hope you enjoy using it to 
  216. create music on your PC.
  217.  
  218. Ted Holden
  219. HT Enterprises
  220. 5001 Seminary Rd. #621
  221. Alexandria, Va. 22311
  222. (703) 671-4562
  223.  
  224.  
  225. TECHNICAL INFORMATION:
  226.  
  227. The music produced by VMUSIC is true multi-part harmony. Unlike 
  228. PianoMan and other well known packages, nothing is being faked 
  229. here. The technique used by VMUSIC is essentially that devised by 
  230. Steve Muenter (RocketDyne).
  231.  
  232. Most programs that generate tones on the PC's speaker simply hook 
  233. the speaker up to the timer chip, leaving the 80x86 chip free to 
  234. do other things. Vmusic controls the speaker directly. There is a
  235. port in the PC, one bit of which is a push-pull handle on the 
  236. speaker;  if that bit is 0 and you move a 1 to it, or if it is a 1 
  237. and you move a 0 to it, it moves the speaker back or forward 1 
  238. count.
  239.  
  240. If you take a number, which you may regard as a frequency, and 
  241. continuously add it into a 16-bit register, you will see 1's 
  242. moving continuously to the left until the high-order bit in the 
  243. register gets set (made 1). If you do this and then zero the 
  244. register WHEN the high-order bit gets set, then you will observe 
  245. that the process is cyclic and that the FREQUENCY with which the 
  246. high-order bit gets set will be proportional to the number itself.
  247. This means that if you multiply your original number by 3 and 
  248. continue the process, then the frequency with which that 
  249. high-order bit gets set will have increased three-fold, etc.
  250.  
  251. The idea is to feed that high-order bit to the port bit each time;  
  252. you will get one push-pull each time the high-order bit gets set, 
  253. which will be proportional to the number you used for a frequency.  
  254. There are just enough registers in a PC to do this three times 
  255. inside of some kind of a timing loop, length of notes times tempo.  
  256. The proportionality of effect guarantees that, although the 
  257. ABSOLUTE pitches may be ball-park at best, the RELATIVE pitches 
  258. are perfect.
  259.