home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / basic / pow_10 / manual.exe (.txt) < prev    next >
Encoding:
David's Readme Compiler Executable  |  1994-01-19  |  114.3 KB  |  1,788 lines

  1. >V    r"
  2. H9D0}
  3.  G H I O P Q v 
  4. YYG;>
  5. LLVW3
  6. 0RY_^
  7. <Ar    ,@
  8. _^_^]
  9. YYF;v
  10. ;Dz~    
  11. '2(2(((
  12. (2(?(!(U
  13.  H I K M P Q0.
  14. DF_^]
  15. YY9|,uK
  16. ;D@ui
  17. ;DDu2
  18. H9D0~
  19. 9D<|    u
  20. Y;D2v
  21. H9D0u
  22. YY_^]
  23. YY_^]
  24. Y;D2wK
  25. t0Nt-
  26. !r.RP
  27. !r$RP
  28. u/SQR
  29. [C[J[O[
  30. Zx[V[Z[^[
  31. \D\d\
  32. [[XP3
  33. Turbo C++ - Copyright 1990 Borland Intl.
  34. Null pointer assignment
  35. Divide error
  36. Abnormal program termination
  37. %-50.50s
  38.  Print this section 
  39. Ready printer and press a key (ESC to cancel)
  40. ---- Printing ----
  41.  PgUp/Dn: 
  42. =print
  43.  Line %d of %d 
  44. Readme error: no attached data.
  45.  Topics 
  46. MMMODE
  47.  ; < = > ? @ A B C D T U V W X Y Z [ \ ]
  48.  G O w u R S s t
  49. EAEIIOOUUYIOU
  50. Insert paper in printer then press
  51. a key (<ESC> cancels print)
  52.  Printer error 
  53. The printer on LPT%d: is
  54. confused
  55. out of paper
  56. off line
  57. Correct then press a key
  58. or hit <ESC> to cancel print
  59.  Insert Paper 
  60. <ESC>
  61.  key pressed:
  62. Please confirm cancel/quit
  63. Accept this data?  
  64.  Insufficient disk space 
  65. There is not enough space on the target
  66. disk to receive the file(s): please replace
  67. the disk with another formatted disk, then
  68. press any key to retry, or <ESC> to cancel 
  69.          !!!!!                  
  70. @@@@@@@@@@@@@@@
  71. @@@@@@@
  72. @@@@@@
  73. @@@@ 
  74. (E(E(E
  75. (null)
  76. Data file generated by RCOM.
  77. POW! Toolbox for PB3 - Online Manual
  78. Introduction
  79. Disclaimer
  80. About the POW! Toolbox
  81. Installation and Setup
  82. Quick Reference
  83. About .POW Files
  84. Direct Vs. DMA Routines
  85. POW! Reference
  86. (1) SBARRAYLOAD
  87. (2) SBARRAYPLAY
  88. (3) SBARRAYRECORD
  89. (4) SBARRAYSAVE
  90. (5) SBBEEP
  91. (6) SBCHECKDMA
  92. (7) SBCMFCANCEL
  93. (8) SBCMFCHECK
  94. (9) SBCMFDETECT
  95. (10) SBCMFPAUSE
  96. (11) SBCMFPLAY
  97. (12) SBCMFRESUME
  98. (13) SBCMFSETSPEED
  99. (14) SBCMFTRANSPOSE
  100. (15) SBCPUSPEED
  101. (16) SBDELAY
  102. (17) SBDETECT
  103. (18) SBFMCLEAR
  104. (19) SBFMDETECT
  105. (20) SBFMNOTE
  106. (21) SBFMPARMS
  107. (22) SBFMPLAY
  108. (23) SBFMPORTOUT
  109. (24) SBFMRHYTHM
  110. (25) SBFMSETPORTS
  111. (26) SBFMSOUND
  112. (27) SBGETPOW$
  113. (28) SBMIDIREAD
  114. (29) SBMIDIWRITE
  115. (30) SBPASYSTEM
  116. (31) SBPLAYDMA
  117. (32) SBPLAYFILE
  118. (33) SBPLAYPOW
  119. (34) SBPLAYSTRING
  120. (35) SBPOWNAME$
  121. (36) SBPRESETMIXER
  122. (37) SBPSETMIXER
  123. (38) SBRESET
  124. (39) SBSAMPLE$
  125. (40) SBSAMPLEBYTE
  126. (41) SBSAY
  127. (42) SBSETBASE
  128. (43) SBSETDMA
  129. (44) SBSETINT
  130. (45) SBSPEECH
  131. File Format Info
  132. VOC File Format
  133. CMF File Format
  134. POW File Format
  135. License Info
  136. Registration Form
  137. POW! Bibliography
  138.       
  139.        
  140.       
  141.       
  142.        
  143.       
  144.       
  145.       
  146. The Soundblaster Toolbox for PowerBASIC 3.0
  147.               Version 1.0
  148.        (C) Copyright 1994 by Tim Gerchmez
  149.            All Rights Reserved
  150.     Soundblaster is a trademark of Creative Labs
  151.      Adlib/Ad Lib is a trademark of Ad Lib, Inc.
  152.       The Creative Voice (.VOC) file format is
  153.        (C) Copyright Creative Labs.
  154.   The RIFF WAVE (.WAV) file format is (C) Copyright
  155.            Microsoft Corp.
  156.   The POW! Digital Library (.POW) file format is (C)
  157.            Copyright Tim Gerchmez.
  158.    All other software and/or hardware mentioned is
  159.    copyrighted and/or trademarked by its respective
  160.              companies.
  161.  This manual is compiled with Dave's Readme Compiler
  162.  (RCOM.EXE), a freeware text menuing utility which
  163.      is (C) Copyright 1991 by Dave Harris.
  164. POW! Toolbox Disclaimer of Liability
  165. ------------------------------------
  166. This software is provided as-is.  There are no
  167. warranties made, either expressed or implied.  You
  168. accept all responsibility for the consequences of
  169. the use or misuse of the routines in this software
  170. package.
  171. THE AUTHOR OF THIS SOFTWARE DISCLAIMS ALL WARRANTIES
  172. RELATED TO THIS SOFTWARE, WHETHER EXPRESSED OR IMPLIED,
  173. INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  174. MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
  175. NEITHER THE AUTHOR OF THIS SOFTWARE (TIM GERCHMEZ) NOR
  176. ANYONE ELSE WHO HAS BEEN INVOLVED IN THE CREATION,
  177. PRODUCTION OR DELIVERY OF THIS SOFTWARE SHALL BE LIABLE
  178. FOR ANY INDIRECT, CONSEQUENTIAL, OR INCIDENTAL DAMAGES
  179. ARISING FROM THE USE OR INABILITY TO USE THIS SOFTWARE,
  180. EVEN IF THEY HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
  181. DAMAGES OR CLAIMS.  IN NO EVENT SHALL THE AUTHOR OF THIS
  182. SOFTWARE'S LIABILITY FOR ANY DAMAGES EVER EXCEED THE PRICE
  183. PAID FOR THE LICENSE TO USE THE SOFTWARE, REGARDLESS OF THE
  184. FORM OF CLAIM.  THE PERSON(S) USING THE SOFTWARE BEARS ALL
  185. RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE.
  186. Some states do not allow the exclusion of the limit of
  187. liability for consequential or incidental damages, so the
  188. above limitation may not apply to you.  This agreement
  189. shall be governed by the laws of the State of Washington
  190. and shall inure to the benefit of the author of POW! and
  191. any successors, administrators, heirs and assigns. Any
  192. action or proceeding brought by either party against the
  193. other arising out of or related to this agreement shall be
  194. brought only in a STATE or FEDERAL COURT of competent
  195. jurisdiction located in King County, Washington. The
  196. parties hereby consent to in personam jurisdiction of
  197. said courts.
  198. Use of the POW! Library and/or related routines in any
  199. way constitutes implied agreement with the above conditions
  200. and disclaimer.
  201. What is the POW! Toolbox?
  202. -------------------------
  203. POW! is a complete 
  204. Soundblaster programming library
  205. PowerBASIC 3.0.  It is written in 
  206. 100% 80x86 assembly
  207. language
  208.  for blazing speed, power and small code size
  209. (only about 12K will be added to your programs using
  210. any or all of the routines in this library).  POW!
  211. supports the 8-bit 
  212. Soundblaster card
  213.  and all other
  214. closely compatible sound cards, and it also supports
  215. Adlib card and compatibles
  216. Good Soundblaster programming libraries are difficult
  217. to find, and especially scarce in the BASIC programming
  218. arena.  To my knowledge, there's only one other
  219. Soundblaster library available for PowerBASIC at
  220. this time.  
  221. POW! was designed to fill a need
  222. , one
  223. that is very evident from reading the online E-mail
  224. programming echos.  Programmers have been looking for
  225. a Soundblaster library for BASIC that's fast, powerful,
  226. and not dependent on external drivers.  
  227. POW! fulfills
  228. those needs
  229. , and more.  Unlike most other Soundblaster
  230. libraries, 
  231. POW! gives you a choice
  232.  - it has both built-
  233. in internal Soundblaster digitized I/O and FM Music
  234. routines, and ALSO 
  235. supports the more popular drivers
  236. like SBFMDRV.COM for .CMF files and SBTALKER for speech
  237. synthesis.  With POW! you can create files that are
  238. completely stand-alone, or files that require a driver
  239. be present or loaded before running a program - it's
  240. entirely your choice
  241. , and will depend on what you want
  242. to do with the SB card.  One of POW!'s more innovative
  243. features lets you play FM-synthesized music which is
  244. COMPLETELY independent of files - you create a string
  245. in the PB IDE similar in syntax to the PLAY statement
  246. in BASIC - but the music plays on the Soundblaster
  247. rather than over the PC Speaker.
  248. POW! also supports several 
  249. file formats
  250. , including
  251. .VOC, .WAV and its own proprietary format, .POW.  A
  252. .POW file lets you store up to 32 digitized samples in
  253. one file, and play back any of the 32 with a simple
  254. command.  POW! 
  255. includes several utilities
  256.  like MAKEPOW,
  257. which lets you create a .POW file from .VOC and .WAV
  258. files, and MAKERAW, which converts .VOC and .WAV files
  259. to raw sample information.  At this time, POW! supports
  260. only 8-bit and low-speed (<22222 Hz.) samples, although
  261. support for additional sample formats may be added in a
  262. future version.
  263. In addition to playing back digitized samples, FM music,
  264. sound effects and synthesized speech, POW! also allows you
  265. RECORD digital samples
  266.  in a PowerBASIC program and then
  267. manipulate the recorded sample data.  You can record a sample
  268. and then play it back immediately, or save it to a file for
  269. later playback.  You can even 
  270. sample a single byte
  271.  from a
  272. microphone hooked up to the Soundblaster card, and use the
  273. sampled value to signal your program!  With POW!, the
  274. possibilities are limitless
  275. .  You'll find that with POW!'s
  276. flexibility and your imagination, you'll be creating programs
  277. that go beyond what you thought possible with BASIC and a
  278. Soundblaster card.  Your programs will 
  279. really stand out in
  280. a crowd
  281.  and make people take notice!
  282. Although POW! is a very flexible and powerful programming
  283. library, you'll find that you need to acquire some knowledge
  284. about the Soundblaster and how it works before you'll be able
  285. to use all the routines effectively.  Unfortunately, a complete
  286. tutorial on the Soundblaster is beyond the scope of POW!'s
  287. documentation, and would easily fill a large book.  You will
  288. pick up much information as you experiment with POW! routines,
  289. but it's recommended that you also find a book and some public
  290. domain text files on the Soundblaster that you can refer to as
  291. you use some of the demos included with POW!  Many of POW!'s
  292. routines are easy to use, however, and by studying the included
  293. demonstration PowerBASIC programs you'll learn how to add your
  294. own music and digitized samples to your BASIC programs.
  295. Bugs:  In the first release of a library as technically complex
  296.        as POW!, it's possible that a few bugs may exist, or
  297.        maybe even more than a few.  I depend on YOU for info.
  298.        regarding bugs in the routines, as I have a fairly
  299.        limited system setup and testing facilities.  Bug fixes
  300.        are always free to registered users of POW!, and bug
  301.        fixes of the Shareware version will be released as soon
  302.        as is feasible.  Unlike certain other major software
  303.        companies, it's the policy of this author to admit that
  304.        bugs in software do happen, and that at least a small
  305.        number of minor bugs will be unavoidable.  Different
  306.        hardware setups may also experience problems, especially
  307.        with sound cards other than the genuine Soundblaster.
  308.        If you find a bug in POW!, I would really appreciate it
  309.        if you'd contact me at the address below so I can fix
  310.        it and release an updated version:
  311.        Tim Gerchmez
  312.        12648 S.E. 81st Pl.
  313.        Renton, WA  98056-9121
  314.        
  315. Thanks a million for your help!
  316. Installing POW!
  317. ---------------
  318. To install POW!, you should first create a subdirectory underneath
  319. your main PowerBASIC 3.0 directory.  You could call this \POW, or
  320. anything you like.  Copy all the files included in the POW! archive
  321. or distribution disk to this directory.  After you do this, copy
  322. the following files to the directories you have specified in the
  323. PowerBASIC IDE:
  324. POW.PBL
  325.  (main POW! library) - 
  326. Copy to Link/Library directory
  327. POW.INC
  328.  (Include file)      - 
  329. Copy to Include directory
  330. As long as PowerBASIC can find the correct files at compile time,
  331. that's about all you need to worry about.  When you run the
  332. included demo files, you should do so from the main \POW directory
  333. you created, as some of these demos access other files that were
  334. included with POW!.
  335. Adding POW! commands to your programs is very simple
  336. .  All you need
  337. to do is include the following statements at the top of any BASIC
  338. program that uses POW! routines:
  339. $STRING 32
  340. $LINK "POW.PBL"
  341. $INCLUDE "POW.INC"
  342. The $STRING 32 is not absolutely required, but is recommended for
  343. most of the routines that utilize strings to hold Soundblaster
  344. sample data (there are several in the POW! toolbox).  32K is not
  345. a lot when it comes to digital samples (which can get very big),
  346. but it will be sufficient for most of your needs.
  347. The actual assembly language routines in POW! will not be included
  348. in your program unless you use them (PB3.0+).  The entire POW!
  349. toolbox uses only one code segment, and adds about 12K to your
  350. BASIC programs, no matter how often or how many routines you use
  351. (of course, the code that calls the routines adds size to a BASIC
  352. program too).
  353. Please note:  You 
  354. may compile and link
  355.  to standalone .EXE files
  356. with the shareware version of POW! - this is 
  357. not restricted in any
  358. .  You may try POW! routines in your programs for a period of
  359. 60 days
  360. , after which time you should register POW! or discontinue
  361. using the routines.  You 
  362. may not distribute
  363.  programs compiled with
  364. the shareware version of POW!, as it is for evaluation purposes only.
  365. Once you've registered POW!, you'll be able to do anything you want
  366. with the programs you write that use POW! routines, including sell
  367. them without further royalties or fees of any kind.  Please see the
  368. section in this manual regarding registration.
  369. Version 1.0 Note:
  370.  The DMA (background) digital routines in this
  371.               version of POW! will not run in the IDE, and must
  372.               be run in a program as a standalone .EXE file.
  373.               I apologize for any inconvenience this may cause
  374.               you, but it was found that there was too much
  375.               potential for serious system conflicts and data
  376.               damage when the DMA routines were used within the
  377.               IDE environment.  Although these problems can be
  378.               avoided through careful programming practices, I
  379.               cannot be responsible for the possibility of lawsuits
  380.               caused by lost data and damaged disks.  Hopefully
  381.               I'll find a solution to this problem, and this
  382.               inconvenience will disappear by the next version
  383.               of POW!
  384. The best way to go about learning POW! is to first load and run the
  385. included 
  386. demonstration programs
  387. .  Each of these programs demonstrates
  388. one or more routines included in the POW! toolbox.  When you've looked
  389. at all the demos, you might want to read through the main reference
  390. to the routines in this manual, and print out any of the routines that
  391. you feel you might use.  Remember, just 
  392. $LINK "POW.PBL"
  393.  and 
  394. $INCLUDE
  395. "POW.INC"
  396. , and all the POW! routines will be immediately accessible
  397. to your programs, just like the regular PowerBASIC statements are.
  398. If you don't have a microphone for your Soundblaster card, this
  399. might be the time to find an inexpensive one, so you can experiment
  400. with POW!'s sampling capabilities.  If you're interested in transposing
  401. music for the 
  402. SBFMPLAY
  403.  statement, you might also be interested in
  404. picking up several "easy-play" music books available for electronic
  405. keyboards, which have the note names and chords written out for
  406. easy identification.  If you can read music, you should have no
  407. problem transposing music for SBFMPLAY, once you learn the syntax
  408. of the command.
  409. POW! Toolbox Quick Reference
  410. ----------------------------
  411.  (1A) Digitized I/O routines (internal) -
  412.       String/File record/playback functions:
  413.       --------------------------------------
  414.          -----------------------------------------------
  415. SBPLAYFILE
  416. :      Plays back a file containing raw sample data
  417.          (foreground/direct)
  418. SBPLAYSTRING
  419. :    Plays back a string containing raw sample data
  420.          (foreground/direct)
  421. SBPLAYDMA
  422. :       Plays back digitized information contained in a
  423.          string (background/DMA)
  424.          -----------------------------------------------
  425. SBSAMPLE$
  426. :       Records a sample from the SB's Line/Mic Inputs
  427.          into a string (foreground/direct)
  428. SBSAMPLEBYTE
  429. :    Records a single byte from the SB's Line/Mic
  430.          Inputs (foreground/direct)
  431.          -----------------------------------------------
  432. SBPLAYPOW
  433. :       Plays back a sample from a special .POW file
  434.          format (background/DMA)
  435. SBGETPOW$
  436. :       Retrieves a sample from a .POW library file
  437.          into a string
  438. SBPOWNAME$
  439. :      Retrieves the name of a .POW file sample
  440.          -----------------------------------------------
  441.  (1B) Digitized I/O routines (internal) -
  442.       Array record/playback functions:
  443.       --------------------------------
  444.          ----------------------------------------------
  445. SBARRAYRECORD
  446. :   Records a sample from the SB's Line/Mic Inputs
  447.          into an integer array (background/DMA)
  448. SBARRAYPLAY
  449. :     Plays a sample in an array (background/DMA)
  450. SBARRAYSAVE
  451. :     Saves a sample contained in an array to disk
  452. SBARRAYLOAD
  453. :     Loads a sample from disk into an array
  454.          -----------------------------------------------
  455.  (1C) Digitized I/O - related routines (internal):
  456.       --------------------------------------------
  457.          ------------------------------------------------------
  458. SBRESET
  459. :         Resets the SB card, preparing for digitized I/O
  460. SBCHECKDMA
  461. :      Indicates whether a sample is currently being played
  462.          back or recorded in the background
  463. SBSETBASE
  464. :       Sets the base port for the SB card (0220h Default)
  465. SBSETDMA
  466. :        Sets the DMA to use with the SB card (1 Default)
  467. SBSETINT
  468. :        Sets the interrupt to use with the SB card (7 Default)
  469.          ------------------------------------------------------
  470.  (2) FM Music (Adlib-Compatible) and related routines (internal):
  471.      ------------------------------------------------------------
  472.            ----------------------------------------
  473. SBFMNOTE
  474. :          Plays a note on the Soundblaster
  475. SBFMSOUND
  476. :         Plays a sound on the Soundblaster
  477. SBFMRHYTHM
  478. :        Plays a rhythm sound on the Soundblaster
  479. SBFMPLAY
  480. :          Plays music contained in a string
  481.            ----------------------------------------
  482. SBFMCLEAR
  483. :         Clears the Soundblaster's FM Music Registers
  484. SBFMPARMS
  485. :         Sets parameters for the FM Music Channels
  486. SBFMPORTOUT
  487. :       Outputs directly to the FM Music Registers
  488. SBFMSETPORTS
  489. :      Sets the FM Music Register addresses
  490. SBFMDETECT
  491. :        Detects whether an FM Music-Capable (Adlib/SB)
  492.                    card is present
  493.            -----------------------------------------
  494.  (3) .CMF FM Music Playback (driver):
  495.      --------------------------------
  496.          ---------------------------------------------
  497. SBCMFDETECT
  498. :     Checks if the SBFMDRV.COM driver is loaded
  499. SBCMFPLAY
  500. :       Plays a .CMF file in the background (SBFMDRV.COM)
  501. SBCMFTRANSPOSE
  502. :  Transpose the pitch of a .CMF file (SBFMDRV.COM)
  503. SBCMFSETSPEED
  504. :   Changes speed of default CMF file playback (SBFMDRV.COM)
  505. SBCMFCHECK
  506. :      Checks whether a .CMF file is still playing (SBFMDRV.COM)
  507. SBCMFPAUSE
  508. :      Pauses playback of a .CMF file (SBFMDRV.COM)
  509. SBCMFRESUME
  510. :     Resumes playback of a .CMF file (SBFMDRV.COM)
  511. SBCMFCANCEL
  512. :     Cancels playback of a .CMF file (SBFMDRV.COM)
  513.          ---------------------------------------------
  514.  (4) MIDI Routines (internal):
  515.      -------------------------
  516.          ------------------------------------------------------
  517. SBMIDIREAD
  518. :      Reads a byte from the MIDI port, or returns -1 if none
  519. SBMIDIWRITE
  520. :     Writes a byte to the Soundblaster MIDI port
  521.          ------------------------------------------------------
  522.  (5) Speech Synthesis Routines (driver):
  523.      -----------------------------------
  524.          ----------------------------------------------------------
  525. SBSAY
  526. :           Speaks a string through the SB Speech driver (SBTALKER)
  527. SBSPEECH
  528. :        Checks to see if the SB Speech driver is loaded (SBTALKER)
  529.          ----------------------------------------------------------
  530.  (6) General SB-Related Routines (internal):
  531.      ---------------------------------------
  532.          ---------------------------------------------------------
  533. SBBEEP
  534. :          Sounds a beep through the Soundblaster's FM
  535.                 Music Channel
  536. SBCPUSPEED
  537. :      Returns CPU Speed in MHz (used by SB routines)
  538. SBDELAY
  539. :         Delay specified number of milliseconds (used by SB
  540.                 routines)
  541. SBDETECT
  542. :         Detects whether a Soundblaster card is present
  543. SBPASYSTEM
  544. :       Turns the SB card into a temporary "P.A. System"
  545.          ---------------------------------------------------------
  546. SBPRESETMIXER
  547. :   Resets the Soundblaster Pro card's mixer chip
  548.          (SOUNDBLASTER PRO ONLY)
  549. SBPSETMIXER
  550. :     Sets the Soundblaster Pro's mixer chip settings
  551.          (SOUNDBLASTER PRO ONLY)
  552.          ---------------------------------------------------------
  553. The POW! toolbox has its own proprietary file format, called .POW.  A
  554. .POW file is a sort of .PBL for .VOC and .WAV files.  You can store up
  555. to 32 .VOC and/or .WAV files in a single .POW file, of different lengths,
  556. recording speeds and compression types.  Future versions of POW! may allow
  557. for 64 or more samples in a .POW file, if demand warrants.  You can play
  558. back a sample in a .POW file with the command SBPLAYPOW - you simply
  559. provide the filename and sample number.  You can also retrieve a .POW
  560. sample into a string with the SBGETPOW$ command.  SBPLAYPOW plays samples
  561. in the background - your program continues while the sample plays!
  562. Included with the POW! package for PB3 is a special MAKEPOW utility that
  563. lets you add .VOC and .WAV files to a .POW library.  See MAKEPOW.EXE for
  564. more information.  
  565. Note:
  566.  Since .POW files play in the background, they
  567. can only be used within a standalone .EXE file, and not in the PB IDE
  568. environment.
  569. Two different methods of digital recording and playback are used
  570. in POW! - the 
  571. direct method
  572. , and the 
  573. DMA method
  574. .  Both of these are
  575. discussed further in the documentation for the SBPLAYSTRING command.
  576. In essence, the direct method records and plays back samples in the
  577. foreground
  578. , and does not allow compression, while the DMA method plays
  579. them in the 
  580. background
  581. , and allows compressed sound data as well as
  582. uncompressed.  SBPLAYSTRING and SBPLAYFILE use the direct method of
  583. digital playback, while SBPLAYDMA and SBPLAYPOW (among others) use the
  584. DMA method.  SBSAMPLE$ uses the direct method in reverse, to record a
  585. sample from the Soundblaster's input jacks, while SBARRAYRECORD uses the
  586. DMA method in reverse (analog to digital rather than digital to analog).
  587. Please read the documentation for SBPLAYSTRING to gain a better
  588. understanding of both the direct and the DMA methods of sound
  589. recording and playback.
  590. If some of this seems confusing at this point, it will clear up as you
  591. browse through the documentation for each command.  It may take a bit of
  592. experimentation, though, to decide which commands are appropriate in which
  593. situations.
  594. As of this release of POW!, the DMA background digital routines will only
  595. run within a standalone .EXE file, and will not function in the PB IDE
  596. environment.  I apologize for any inconvenience this may cause, but was
  597. implemented to protect your data from possible corruption.  I was unable
  598. to safely find a way to implement DMA background recording and playback
  599. while developing within the IDE.  This was not only a problem with POW!,
  600. but was encountered when testing an interface to the Creative Labs .VOC
  601. driver CT-VOICE.DRV as well.  After many attempts at finding a solution
  602. to this problem, I finally had to limit the DMA routines to standalone
  603. .EXE files only.
  604. ================================================================================
  605. sub sbarrayload(f$,ln%,sr%,ary%())
  606. Loads a .VOC file into an array, which can then be played back
  607. with SBARRAYPLAY.  The .VOC should contain a data block as its
  608. first block, and should be uncompressed.  The SBARRAYSAVE command
  609. saves an array as a .VOC file in this format, and a file saved with
  610. this command can be loaded with SBARRAYLOAD.  If compression is
  611. detected in the specified .VOC file by this routine, the routine
  612. will abort and the .VOC will not be loaded.  See SBARRAYSAVE for
  613. more information on the SBARRAY commands.
  614. To play back a compressed .VOC file, you must first add it to a
  615. .POW library with the MAKEPOW utility, or read a block from a .VOC
  616. file directly and play it back with SBPLAYDMA.  See SBPLAYPOW for
  617. more information about .POW digital library files.
  618. f$: Set to the filename to load the array from.  This file should be
  619.     a .VOC file in the format specified above.
  620. ln%: Returns the length of the .VOC file sample in ln%.  You can
  621.      then use ln% as a parameter in SBARRAYPLAY to play back the
  622.      array sample in the background.  If an error occurs and the
  623.      .VOC is not loaded, ln% will return 0.
  624. sr%: Returns the sample rate of the .VOC file in sr%.  You can then
  625.      use this value as a parameter in the SBARRAYPLAY command to play
  626.      back the sample contained in the array.
  627. ary%(): Set to the first element of an integer array that you have
  628.     previously DIMmed to a large enough value to hold the entire
  629.     .VOC file sample.  It's best to DIM the array to hold 32767
  630.     bytes (DIM 1:16384) if you're not sure of the size of the .VOC
  631.     file to be loaded.
  632. Example: dim ary%(1:16384)  '32K byte array
  633.      sbarrayload "sample.voc",ln%,sr%,ary%(1)
  634.      if ln%=0 then print "Error loading .VOC":stop
  635.      sbarrayplay ln%,sr%,ary%(1)
  636. ================================================================================
  637. sub sbarrayplay(ln%,sr%,ary%())
  638. NOTE: This routine will only function within a standalone .EXE
  639.       file, and will have no effect when run from a program within
  640.       the PowerBASIC IDE.
  641. Plays back an array recorded with SBARRAYRECORD or loaded from
  642. disk with SBARRAYLOAD.  The sample plays in the background.  You
  643. can check when the sample is done playing with SBCHECKDMA (see the
  644. SBCHECKDMA command).
  645. ln%: Set to the length of the sample to be played back.  This
  646.      should be the same length you used for SBARRAYRECORD or
  647.      retrieved from a file with SBARRAYLOAD.
  648. sr%: Set to the sample rate for playback.  This should be the
  649.      same rate used with SBARRAYRECORD or retrieved from a file
  650.      with SBARRAYLOAD.
  651. ary%(): Set to the first element of an integer array holding
  652.     the sample data to be played back.
  653. Example: sbarrayplay 32767,8000,ary%(1)  'Play back a 32K array
  654.                      'at 8000 Hz.
  655. ================================================================================
  656. sub sbarrayrecord(ln%,sr%,ary%())
  657. NOTE: This routine will only function within a standalone .EXE
  658.       file, and will have no effect when run from a program within
  659.       the PowerBASIC IDE.
  660. Records a sample from the Soundblaster's Microphone or Line
  661. Inputs into an integer array in the background.  This sample
  662. can then be manipulated with the other SBARRAY commands.
  663. Recording is done using ADC DMA techniques to record in the
  664. background, while your program continues.
  665. ln%: Set to length in bytes of sample to be taken (up
  666.      to 32767).  You should DIM an integer array big
  667.      enough to hold the amount of data specified.  Each
  668.      integer in the array can hold 2 bytes, so the formula
  669.      to use would be ln%\2.  You can use SBCHECKDMA to detect
  670.      when the recording is done (see SBCHECKDMA).
  671. sr%: Set to the sample rate in Hz. of the sample to be taken.
  672.      A typical sample rate would be 8000 Hz.
  673. ary%():  Pass the first element of an integer array that you
  674.      DIMensioned to a large enough value to hold the
  675.      sample this routine will return.  Caution: if you
  676.      don't DIM the array to a large enough value, memory
  677.      will be overwritten and corrupted.
  678. Example:  DIM ary%(1:16384) '32767 byte sample (16384*2)
  679.       sbarrayrecord 32767,8000,ary%(1)  'Record the sample -
  680.                          about 4 sec. at 8000 Hz.
  681. ================================================================================
  682. sub sbarraysave(f$,ln%,sr%,ary%())
  683. Saves a sample contained in an array recorded with
  684. SBARRAYRECORD as a 1-block .VOC file that can be loaded
  685. with SBARRAYLOAD or added to a .POW library with MAKEPOW.
  686. f$: Set to the filename to save the array to - should end with
  687.     the .VOC extension if you want to indicate it as a .VOC file.
  688.     This file will be saved in standard .VOC format as a single data
  689.     block with no compression.  It can be converted to a .RAW file
  690.     with MAKERAW, loaded with SBARRAYLOAD, or added to a .POW library
  691.     with the MAKEPOW utility.  If the specified file already exists,
  692.     IT WILL BE OVERWRITTEN, so be sure to check for it with the DIR$
  693.     command before using this routine if you think it might already
  694.     exist.
  695. ln%: Set to the length of the sample to save.  This should be the
  696.      same length value you used with SBARRAYRECORD.  Each element of
  697.      an integer array is 2 bytes in length.
  698. sr%: Set to the sample rate you recorded the sample at with
  699.      SBARRAYRECORD.
  700. ary%(): Set to the first element of an integer array you used with
  701.     SBARRAYRECORD.
  702. Example: DIM ary%(1:16384) '32767 byte sample (16384*2)
  703.      sbarrayrecord 32767,8000,ary%(1)  'Record the sample -
  704.                          about 4 sec. at 8000 Hz.
  705.      sbarraysave "sample.voc",32767,8000,ary%(1) 'Save the sample
  706. ================================================================================
  707. sub sbbeep
  708. Plays a BEEP through the soundblaster.  This is one of the "highest
  709. level" routines in the POW! Toolbox, requiring no parameters at all.
  710. Similar to the BEEP statement, but plays through the SB's speakers
  711. rather than the PC speaker.  You don't even have to detect if an SB
  712. card is present, as SBBEEP does this for you, and plays a normal BEEP
  713. through the PC speaker if not!
  714. Example: sbbeep [or] call sbbeep
  715. ================================================================================
  716. function sbcheckdma
  717. NOTE: This routine will only function within a standalone .EXE
  718.       file, and will have no effect when run from a program within
  719.       the PowerBASIC IDE.
  720. Works in conjunction with the DMA-related (background)
  721. digital sound commands in POW! to tell you whether the
  722. current sample is done recording or playing.
  723. sbcheckdma: Returns 0 if sample is still recording/playing,
  724.         or -1 if sample is done recording/ playing or
  725.         no DMA command was ever called.
  726. Example: print sbcheckdma
  727. ================================================================================
  728. sub sbcmfcancel
  729. Cancels (stops) playback of a .CMF file originally started with
  730. SBCMFPLAY.  You can then use SBCMFPLAY again to restart the song
  731. from the beginning, if desired.
  732. Example: call sbcmfcancel
  733. ================================================================================
  734. function sbcmfcheck
  735. Checks whether a .CMF file is still playing (SBFMDRV.COM),
  736. and returns nonzero if yes, or zero if not.  Use with
  737. SBCMFPLAY to determine status of playing file.
  738. Example: print sbcmfcheck
  739. ================================================================================
  740. function sbcmfdetect
  741. Detects whether the FM Music Driver (SBFMDRV.COM) for the
  742. Soundblaster card is installed.  Returns 0 if not, or IRQ
  743. number (&h80-&hbf) if it is.  You should use this before
  744. calling any of the other SBCMF commands to determine whether
  745. the driver was loaded.
  746. Example: print sbcmfdetect
  747. ================================================================================
  748. sub sbcmfpause
  749. Pauses a currently playing .CMF song (that you started with
  750. SBCMFPLAY).  You can use SBCMFRESUME to continue playback.
  751. Example: call sbcmfpause
  752. ================================================================================
  753. sub sbcmfplay(f$,ary%(1))
  754. Plays a .CMF file in the background, using the SBFMDRV.COM driver.
  755. You should pass this routine a 64K integer array to hold the CMF
  756. music data, and the CMF files you select should be less than 64K
  757. in size.  You do not have to check for the SBFMDRV.COM being installed
  758. if you don't want to ; this routine does it automatically, and will
  759. terminate if the driver is not installed.  If a song is already playing
  760. when this function is called, it will be ended and a new song started.
  761. f$: Set to path\filename of .CMF file to play
  762. ary%(1): Set to the first element of a 64K integer array
  763.      (see example below).  Array can be shorter than 64K
  764.      if you're sure that the size of the CMF file is less
  765.      (you can open for binary access and use the LOF function
  766.      to determine the length of a file).  If you forget to
  767.      DIMension the array, or DIM it to too small a size, memory
  768.      will be corrupted when the .CMF file loads.
  769. Example:  'SBFMDRV.COM should already be loaded (can be loaded high using
  770.       'the DOS 5+ LH or LOADHIGH command.
  771.       DIM cmfary%(1:32767) '64K integer array to hold .CMF data
  772.       call sbcmfplay "test.cmf",cmfary%(1)  'Play the file
  773. You can use SBCMFCHECK to determine whether the piece is still playing
  774. or has finished (see SBCMFCHECK for details).
  775. ================================================================================
  776. sub sbcmfresume
  777. Resumes playback of a song after pausing it with the
  778. SBCMFPAUSE command.
  779. Example: call sbcmfresume
  780. ================================================================================
  781. sub sbcmfsetspeed(s%)
  782. Changes the SBFMDRV.COM driver clock rate.  This rate is specified
  783. in each .CMF file, and determines the speed the .CMF file will be
  784. played back.  Using a positive value for this function will increase
  785. the default value read from a file and passed to the CMF driver by the
  786. specified amount, and using a negative value will decrease the default.
  787. This function can either be used with a CURRENTLY PLAYING .CMF file (to
  788. slow it down or speed it up), or can be used before a file is played to
  789. change the speed at which the next file will be played back.  Using a
  790. value of 0 will set the SBFMDRV.COM speed back to the default rates.
  791. Example:
  792.      sbcmfsetspeed -8              'Slow down all .CMF files by 8 Cycles
  793.      sbcmfplay "test.cmf",ary%(1)  'Plays back .CMF file slower than
  794.                        'normal
  795.      do:loop until sbcmfcheck=0    'Wait til song is over
  796.      sbcmfsetspeed 0               'Returns playback speed to default
  797. ================================================================================
  798. sub sbcmftranspose(nm%)
  799. Transposes the pitch of a piece of music up or down by
  800. a particular number of half-tone steps.  Use this command
  801. either before playing a .CMF file or during playback to
  802. change the base pitch of the music.
  803. nm%: Set to number of half-tone steps to transpose.  A
  804.      positive value will transpose up, while a negative
  805.      value will transpose down.  Using a value of zero
  806.      will turn transposing off and set the tone of the
  807.      music back to the original.
  808. Example: sbcmftranspose -4  'Transpose 4 steps down
  809. ================================================================================
  810. function sbcpuspeed
  811. Calculates and returns approximate CPU speed in MHz
  812. using a timing loop.  Called by the digital playback
  813. routines to determine non machine-dependent playback
  814. speeds.
  815. sbcpuspeed: Returns approx. CPU speed in mHz
  816. Example: print sbcpuspeed
  817. ================================================================================
  818. sub sbdelay(ms%)
  819. Pauses the specified number of milliseconds.
  820. ms%: Set to milliseconds (thousandths of a second) to pause.
  821.      (0-32767).  Max is about 32 seconds.
  822. Example: sbdelay 1000 'Delay one second exactly (hardware-independent).
  823. ================================================================================
  824. function sbdetect
  825. Detects whether a Soundblaster or compatible card is installed,
  826. and returns -1 if yes or 0 if no.  You should use this routine
  827. before calling any Digital (sampling) I/O functions in this library.
  828. Use SBFMDETECT instead before calling FM Music-related routines, as
  829. the Adlib card will return a not-installed status with this routine
  830. (it's not upward compatible with the Soundblaster).  Note: This
  831. routine also RESETS the SB card, and can be used in lieu of SBRESET
  832. if desired.
  833. Example: d% = sbdetect
  834. ================================================================================
  835. sub sbfmclear
  836. Clears and initializes the soundblaster's FM music registers.
  837. Use this to (1) stop a sound, (2) before playing sounds to clear
  838. previous values.  Returns all internal POW! FM Music settings
  839. to default values.  To reset the soundblaster hardware, use
  840. SBRESET instead (this command just clears the FM Music Adlib-
  841. compatible registers).
  842. Example: call sbfmclear
  843. ================================================================================
  844. function sbfmdetect
  845. Detects if an Adlib/FM Music-Capable card is installed, and returns
  846.  -1 if yes or 0 if no.  This routine will return -1 for the Soundblaster,
  847. as it's fully compatible with the Adlib card.  Call this before calling any
  848. of the other FM-Music related routines to determine if an appropriate sound
  849. card is installed.  Use SBDETECT instead to check for the Soundblaster card
  850. specifically (for digital I/O and related functions).
  851. Example: print sbfmdetect
  852. ================================================================================
  853. sub sbfmnote (ch%,fr%,oc%,ad%,sr%,wv%,dly%)
  854. Play a note on the soundblaster using the specified FM music
  855. channel and the specified values (see below).  This is the
  856. one of the "lower level" FM Music commands in the POW!
  857. toolbox, and it gives you a lot of control over parameters.  For
  858. a higher-level command that requires less parameters, see SBFMSOUND.
  859. ch%:  Set to Soundblaster Melody Channel (voice) (1-9).
  860. fr%:  Set to frequency (pitch) (0-1023).  The approximate
  861.       frequency values for a scale are:
  862.       C:  345    C#: 366         D: 388  D#: 409         E: 431
  863.       F:  458   F#: 486   G: 515    G#: 545   A: 579
  864.       A#: 614   B:  650   C: 688
  865. oc%:  Set to octave (0-7) (Controls pitch)
  866. ad%:  Set to Attack/Decay (AD) value:
  867.       Attack: Bits 4-7 (0=slowest) (0-15)
  868.       Decay : Bits 0-3 (0=slowest) (0-15)
  869.       Formula: ad% = 16 * attack + decay
  870.            attack = ad% \ 16
  871.            decay  = ad% and 15
  872. sr%:  Set to Sustain/Release (SR) value:
  873.       Sustain: Bits 4-7 (0=loudest) (0-15)
  874.       Release: Bits 0-3 (0=slowest) (0-15)
  875.       Formula: sr% = 16 * sustain + release
  876.            sustain = sr% \ 16
  877.            release = sr% and 15
  878. wv%:  Set to waveform (controls sharpness of tone).
  879.       0-3, where 0="softest" and 3="sharpest."
  880. dly%: Set to delay value (in milliseconds) (0-32767, or about
  881.       32 seconds max).  For a delay of zero, routine will play
  882.       note and immediately return without "turning note off" -
  883.       this is appropriate for certain AD and SR values (see
  884.       example below).  If a delay is specified, the routine will
  885.       play the note ("key on"), delay the specified time, then
  886.       turn the note off ("key off").
  887. Example: sbfmnote 1,345,5,240,4,1,0 'Play a note on the Soundblaster
  888. ================================================================================
  889. sub sbfmparms(ch%,am%,vb%,sus%,hm%)
  890. Sets extra parameters for a particular SB FM music channel
  891. that will be used with the other SBFM commands (except SBFMPLAY).
  892. This allows you to "fine-tune" the sound of each channel.
  893. These parameters will remain in effect until you do an SBFMCLEAR
  894. or change the soundblaster's registers directly.
  895. Note: SBBEEP uses channel 1, and can be a way to quickly test
  896.       new parameter values.  Simply call SBFMPARMS followed by an
  897.       SBBEEP statement to hear the changes.  SBFMCLEAR resets all
  898.       values set by SBFMPARMS.
  899. ch%: Set to Soundblaster channel (1-9) to set parameters for
  900. am%: Set to 1 for Amplitude Modulation (tremolo), or 0 for none.
  901.      The default value is 0.
  902. vb%: Set to 1 for Vibrato, or 0 for none.  The default value
  903.      is 0.
  904. sus%: Set to 1 for Note Sustain, or 0 for none.  The default
  905.       is 0 (no sustain, note decays on SR phase).
  906. hm%: Set to 0-15 to control which harmonic the specified channel
  907.      is modulated with.  This controls the overall pitch and
  908.      tinniness of the output for the specified channel.  The
  909.      default for this setting is zero.
  910. Example: call sbfmparms(1,0,1,0,0) 'Set vibrato for channel 1
  911.      sbbeep  'Hear the vibrato
  912. ================================================================================
  913. sub sbfmplay(m$)
  914. Plays music on the Soundblaster - a mini music interpreter, similar
  915. to PB's PLAY command, but works with the soundblaster rather than the
  916. PC speaker, uses different parameters, and is much more flexible.  All
  917. SBFMPLAY commands are 2 characters in length (no exceptions), and these
  918. commands are detailed below.  The string you send is checked for an even
  919. number of characters (as each command is two bytes), and SBFMPLAY terminates
  920. if the string is not an even length.  See the example sound programs
  921. included with POW! for examples of SBFMPLAY syntax.  When building strings
  922. for SBFMPLAY, it is suggested that you do it in layers - add the notes, rests
  923. and octave notations first, then add the chords and other commands later.
  924. m$: Set to a string of characters indicating musical notes and commands
  925.     for SBFMPLAY:
  926. a ,a-,a+,b ,b-,b+,c ,c-,c+,d ,d-,d+,e ,e-,e+,f ,f-,f+,g ,g-,g+
  927. A ,A-,A+,B ,B-,B+,C ,C-,C+,D ,D-,D+,E ,E-,E+,F ,F-,F+,G ,G-,G+
  928. Musical notes in SBFMPLAY are indicated by the note letter (the regular
  929. scale CDEFGAB), followed by a space (regular note), a minus (flat), or
  930. a plus (sharp).  You can substitute the "b" character for the minus and
  931. the "#" for the plus, if desired.  Each note indicated is ALWAYS two
  932. characters long.  Using LOWERCASE letters for notes will produce a delay
  933. between each note, while using UPPERCASE letters will play a note and
  934. proceed immediately to the next note (useful for polyphonic music).  The
  935. note letters are the only place SBFMPLAY is case-sensitive.  The following
  936. are valid strings of notes:
  937. "a a#b b#c c#d d#" <- Notice each note is EXACTLY two characters.  Regular
  938.               notes (not flat or sharp) can be followed by ANY
  939.               character, whereas flats are followed by "-" or
  940.               "b", and sharps are followed by "+" or "#".
  941. "C DbE F#G A#B c d e f#g-a+b-c+" <- the first part will be played without
  942.                     delays between notes.  This string is
  943.                     read C, D flat, E, F sharp, G, A sharp,
  944.                     B, C, D, E, F sharp, G flat, A sharp,
  945.                     B flat, C sharp.
  946. See the "O" (Octave) command for further control of note pitch.
  947.  ------------------------------------------------------------------------------------
  948. h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,ha,hb,hc,
  949. hd,he,hf,hg,hh,hi,hj,hk,hl,hm,hn,ho (upper or lowercase):
  950. The "h" command plays a CHORD.  All standard 3-voice major and minor
  951. sharp and flat chords are supported in SBFMPLAY.  7th chords and others
  952. are not currently supported.  Voices 4-6 of the Soundblaster are used
  953. for chords, so if you use them, v1-3 and v7-9 are free for the melody
  954. (rhythm uses v7-9 - see the "X" command).  The following "h" (the H may
  955. be capitalized) commands correspond to the following chords:
  956. h0: C   h4: G    h8: Dm   hc: Am      hg: F#/Gb     hk: D#m/Ebm
  957. h1: D   h5: A    h9: Em   hd: Bm      hh: G#/Ab     hl: F#m/Gbm
  958. h2: E   h6: B    ha: Fm   he: C#/Db   hi: A#/Bb     hm: G#m/Abm
  959. h3: F   h7: Cm   hb: Gm   hf: D#/Eb   hj: C#m/Dbm   hn: A#m/Bbm
  960.                             ho: silence chord
  961. All chord commands are two characters, as are all note commands.
  962. To cause chords to sustain, rather than play once, use the "N" command.
  963.  ------------------------------------------------------------------------------------
  964. i0,i1,i2,i3 (upper or lowercase):
  965. "I" sets vIbrato (rapid variation of frequency) and tremolo (rapid
  966. variation of volume) on and off.  Use I1 to turn vibrato on for the
  967. current channel (last specified with the V command), I2 to turn
  968. tremolo on, or I3 to turn BOTH vibrato and tremolo on.  I0 will
  969. turn off vibrato and/or tremolo for the current channel.
  970.  ------------------------------------------------------------------------------------
  971. n0,n1,n2,n3,n4,n5,n6,n7,n8,n9 (upper or lowercase):
  972. The "N" command controls the eNvelope of the notes in the SBFMPLAY
  973. string.  A sound's envelope consists of its attack, decay, sustain
  974. and release (ADSR) phases, which have to do with the changes in
  975. volume of a note during its lifetime.  The attack rate is how
  976. quickly the sound rises from zero to full volume.  The decay rate
  977. is how fast the note falls off from the attack peak to the sustain
  978. level.  The sustain level is the volume the note sustains at until
  979. it's released.  The release rate is how quickly the note falls off
  980. from the sustain level to zero volume when released.  If all this
  981. is confusing to you, it doesn't matter - the "N" command in SBFMPLAY
  982. lets you choose from some predefined sound envelopes.  N0 - N5 are
  983. NOTE envelopes (affecting the A-G note commands), while N6 - N9 are
  984. CHORD envelopes (affecting the H0-Ho commands).  The following "N"
  985. commands are predefined:
  986. n0: Note (default) - fast attack, medium release (string sound)
  987. n1: Note - medium attack, slow release (softer sound)
  988. n2: Note - fast attack, fast release (plink sound)
  989. n3: Note - Medium all (ADSR) (medium sound)
  990. n4: Note - Slow attack, slow release ("backward" or "wah wah" sound)
  991. n5: Note - Slow attack, very slow release (soft sustain)
  992. n6: Chord (default) - fast attack, medium release (string sound)
  993. n7: Chord - slow attack, medium release
  994. n8: Chord - slow attack, slow release
  995. n9: Chord - slow attack, no release (sustain chords)
  996. You can use "S" (Sustain notes) in combination with the "N" commands to
  997. fine-tune the envelope of notes.  You can also both N values below 5 and
  998. N values above 5 to set both voice and chord envelopes.  For example,
  999. "n2n8" is a perfectly valid combination.
  1000.  ------------------------------------------------------------------------------------
  1001. o0,o1,o2,o3,o4,o5,o6,o7 (upper or lowercase):
  1002. The "O" command changes octaves.  For example, you would insert
  1003. "o4" in the command string at the right place to change to octave 4.
  1004. All subsequent notes will play in that octave until changed with
  1005. another "O" command.  The octave setting defaults to o5.
  1006.  -------------------------------------------------------------------------------------
  1007. p0,p1,p2,p3,p4,p5,p6,p7,p8,p9 (upper or lowercase):
  1008. "P" controls the overall pace of the music (or tempo).  The number you
  1009. provide is multiplied by 10 and used as a "millisecond base" for delays
  1010. in conjunction with the "W" command (described later).  The "P" command
  1011. controls the actual wait time of the "W" (wait) command.  P1, for example,
  1012. would provide a millisecond delay base of 0,10,20,30,40,50,60,70,80,90
  1013. corresponding to W0 through W9. Contrary to what you might imagine, the
  1014. larger the number given, the SLOWER the actual pace will be.  The lower
  1015. the number, the FASTER the pace.
  1016.  -------------------------------------------------------------------------------------
  1017. q1,q2,q3,q4,q5,q6,q7,q8,q9 (upper or lowercase):
  1018. The "Q" command stands for "quiet," and will silence a voice.  This is
  1019. useful when used with the "S" (sustain) command, to shut off a voice at
  1020. will.  You provide the number of the channel to silence along with the Q.
  1021. For example, "q3" would silence voice (channel) 3.
  1022.  -------------------------------------------------------------------------------------
  1023. r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r. (upper or lowercase):
  1024. The "R" command stands for "Rest."  Placing an R in the music string with
  1025. a number value will pause for the same amount of time as a corresponding
  1026. note would according to the current setting of the "W" command.  R0 will
  1027. pause no time at all, and R. (r followed by a dot) will pause the same
  1028. amount of time as the notes (a normal full rest).  The actual wait time
  1029. of each rest can be controlled by the "P" command the same way the "W"
  1030. command is.  You may have to play around to get a feel for the timing of
  1031. the "R" command.
  1032.  -------------------------------------------------------------------------------------
  1033. s0,s1 (upper or lowercase):
  1034. The "S" command controls note sustain.  When set to one, all voices will
  1035. be sustained after they are played.  When set to 0, the voice will play
  1036. for a second and then be silenced (like a guitar string).  Simply insert
  1037. the Sx command at the desired place in the command string.  Sustain applies
  1038. to "regular" notes only - to set chord sustain, use the "N" command (N9) to
  1039. set an envelope for chords that supports a sustain effect.  Use the "N" and
  1040. the "S" commands together to control the ENVELOPE of the notes played (see
  1041. the "N" command for an explanation).  For those who've already read that
  1042. section, the "S" command sets the SUSTAIN of notes to high and the RELEASE
  1043. value to 0 (no release) if turned on, or 4 (medium release) if turned off.
  1044. Using "S" does not affect the attack/decay portion of the note envelope.
  1045.  -------------------------------------------------------------------------------------
  1046. t0,t1,t2,t3 (upper or lowercase):
  1047. The "T" command controls the TONE of the music playing.  The higher the
  1048. number the "sharper" and more string-instrument like the sound will be.
  1049. Number parameters can range from 0 (very soft) to 3 (very sharp).
  1050.  --------------------------------------------------------------------------------------
  1051. u0,u1,u2 (upper or lowercase):
  1052. The "U" command stands for User, and determines how the user can cancel
  1053. the SBFMPLAY command.  U0 sets SBFMPLAY to cancel when the user presses
  1054. any key (this is the default), U1 sets SBFMPLAY so the user can cancel
  1055. the command only with the ESC key, and U2 sets SBFMPLAY so the user cannot
  1056. cancel it until the string is done playing.  Once again, SBFMPLAY defaults
  1057. to allowing the user to cancel by pressing any key on the keyboard (SBFMPLAY
  1058. will not cancel in the middle of a rest or other delay, only between notes).
  1059.  --------------------------------------------------------------------------------------
  1060. v1,v2,v3,v4,v5,v6,v7,v8,v9 (upper or lowercase):
  1061. "V" controls which voice (channel) of the soundblaster will be used to play
  1062. all notes following the command (until the next V command).  Provide a
  1063. channel number between 1 and 9.  For example, "v1C v2E v3G " will play 3
  1064. notes, each note on a different soundblaster channel (note the required space
  1065. after the final "G" note).
  1066.  ---------------------------------------------------------------------------------------
  1067. w0,w1,w2,w3,w4,w5,w6,w7,w8,w9 (upper or lowercase):
  1068. "W" stands for Wait, and controls how long SBFMPLAY will wait after
  1069. starting to play a note.  If you set the wait value to zero, it will
  1070. immediately continue on to the next note (same as if you used a
  1071. capital letter to represent the next note).  The actual time the "W"
  1072. command waits is determined by the "P" (pace) command.  Use "W" to
  1073. set the overall time between notes, while using "R" to add arbitrary
  1074. rests between notes.  The "W" wait value defaults to 5 if never set
  1075. in the SBFMPLAY string.
  1076.  ----------------------------------------------------------------------------------------
  1077. x0,x1,x2,x3,x4,x5,x6,x7,x8,x9 (upper or lowercase):
  1078. The "X" command plays a drumbeat or rhythm - think of the letter X
  1079. as a pair of crossed drumsticks to help you remember this command.
  1080. Each command (X0 through X9) plays a different rhythm sound.  Please
  1081. listen to these sounds to determine which ones are correct for the
  1082. songs you are playing.
  1083. Example: SBFMPLAY "x3r4x3r4x3r4x3r4" 'Plays 4 drum beats with rests
  1084.                      'between them
  1085. ================================================================================
  1086. sub sbfmportout(rg%,dat%)
  1087. Lets you write directly to the Soundblaster's FM registers,
  1088. should you be so inclined.  A good book on the Soundblaster
  1089. (or the SB Developer's kit) is recommended, as an explanation
  1090. of Soundblaster registers is beyond the scope of POW!'s documentation.
  1091. This command is for the FM music registers only (normally &h388 and &h389);
  1092. it does not work for digitized sound playback.  You do not have to include
  1093. delays, etc. after writing the ports using this command, as they are built
  1094. into the SBFMPORTOUT command.
  1095. rg%: Set to register to write to (01h-F5h)
  1096. dat%: Set to data to write to register (0-255)
  1097. Example: sbfmportout &h60,0 'Set channel 1 Attack/Decay to 0
  1098. ================================================================================
  1099. sub sbfmrhythm(drum%,ad%,sr%,fr%,oc%)
  1100. Play a rhythm sound on the soundblaster.  FM Melody channels 7-9
  1101. are not available when using this command.  You'll have to experiment
  1102. to find the appropriate parameters for the different types of drum
  1103. sounds.
  1104. drum%: Set to drum sound desired:
  1105.        Bit 0 = Hi Hat (add 1)
  1106.        Bit 1 = Snare (add 2)
  1107.        Bit 2 = Tom tom (add 4)
  1108.        Bit 3 = Cymbal (add 8)
  1109.        Bit 4 = Bass (add 16)
  1110. ad%:  Set to Attack/Decay (AD) value:
  1111.       Attack: Bits 4-7 (0=slowest) (0-15)
  1112.       Decay : Bits 0-3 (0=slowest) (0-15)
  1113.       Formula: ad% = 16 * attack + decay
  1114.            attack = ad% \ 16
  1115.            decay  = ad% and 15
  1116. sr%:  Set to Sustain/Release (SR) value:
  1117.       Sustain: Bits 4-7 (0=loudest) (0-15)
  1118.       Release: Bits 0-3 (0=slowest) (0-15)
  1119.       Formula: sr% = 16 * sustain + release
  1120.            sustain = sr% \ 16
  1121.            release = sr% and 15
  1122. fr%: Set to frequency (0-1023)
  1123. oc%: Set to octave (0-7)
  1124. Example: sbfmrhythm 8,240,4,1000,7 'Play a note on the snare drum
  1125. ================================================================================
  1126. sub sbfmsetports(addr%,dat%)
  1127. Sets the soundblaster's Address/Status port and
  1128. Data port locations.  These are the ports for Adlib
  1129. compatible FM Music output.  It's highly unlikely you'll
  1130. need to use this function, as the defaults (&h388
  1131. and &h389) are standard Soundblaster/Adlib ports, but
  1132. it's included for future compatibility, and in case
  1133. an unusual hardware setup presents a problem.  See
  1134. SBSETBASE for a related function to set the SB base
  1135. I/O address for digitized sound output.
  1136. addr%: Set to SB Address/Status port (normally &h388)
  1137. dat%: Set to SB Data port (normally &h389)
  1138. Example: sbfmsetports &h388,&h389 'Set to default values
  1139. ================================================================================
  1140. sub sbfmsound(ch%,fr%,oc%)
  1141. Play a note on the Soundblaster using the specified FM sound
  1142. channel and the specified values.  This is a mid-level function
  1143. that gives you less control over SB FM sound parameters than SBFMNOTE
  1144. does, but makes it easier to play a note.  Routine returns immediately
  1145. (no delay between notes).  Waveform and ADSR values are preset for
  1146. each channel:
  1147. Ch 1: Soft sound, fast attack, slow release
  1148. Ch 2: Medium sound, fast attack, slow release
  1149. Ch 3: Sharp sound, fast attack, slow release
  1150. Ch 4: Soft sound, medium attack, medium release
  1151. Ch 5: Medium sound, medium attack, medium release
  1152. Ch 6: Sharp sound, medium attack, medium release
  1153. Ch 7: Soft sound, slow attack, slow release
  1154. Ch 8: Medium sound, slow attack, slow release
  1155. Ch 9: Sharp sound, slow attack, slow release
  1156. ch%: Set to SB sound channel (1-9)
  1157. fr%:  Set to frequency (pitch value) (0-1023).  The
  1158.       approximate frequency values for a scale are:
  1159.       C:  345    C#: 366         D: 388  D#: 409         E: 431
  1160.       F:  458   F#: 486   G: 515    G#: 545   A: 579
  1161.       A#: 614   B:  650   C: 688
  1162. oc%:  Set to octave (0-7) (Controls pitch)
  1163. Example: sbfmsound 1,409,5  'Play a "D#" on channel 1 in octave 5
  1164. ================================================================================
  1165. function sbgetpow$(f$,sn%,sr%,cm%)
  1166. Retrieves a sample from a .POW library into a string, which you can
  1167. then play back using SBPLAYDMA or save to a file for later use.
  1168. See the SBPLAYPOW command for further details regarding .POW files.
  1169. f$:  Set to the filename of the .POW file
  1170. sn%: Set to the sample number (1-32) to retrieve
  1171. sr%: Returns the sample rate of the .POW sample, which you
  1172.      can use with SBPLAYDMA to play back at the correct rate.
  1173. cm%: Retrieves the compression type byte, which you can use with
  1174.      SBPLAYDMA to play the sample back correctly.
  1175. sbgetpow$: Returns the actual sample data as a string, or a
  1176.        null string if an error is encountered.  Make sure
  1177.        you set the string segment size with $STRING to a large
  1178.        enough value to hold all the sample data ($STRING 32
  1179.        recommended), or only part of the sample will be read in.
  1180. Example: s$=sbgetpow$("test.pow",3,sr%,cm%) 'Retrieves TEST.POW sample 3
  1181. ================================================================================
  1182. function sbmidiread
  1183. Reads a single byte from the Soundblaster MIDI port, and returns
  1184. the resulting value, or -1 if the Soundblaster times out and does
  1185. not return a MIDI value.  It's up to you to interpret and use the
  1186. value returned by this function.
  1187. Example: mb% = sbmidiread
  1188.      if mb%=-1 then print "No MIDI data.":end
  1189.      print "MIDI byte:";mb%
  1190. ================================================================================
  1191. sub sbmidiwrite(b%)
  1192. Writes a byte directly to the Soundblaster's MIDI port.
  1193. b%: Set to byte value (0-255) to write
  1194. Example: sbmidiwrite 128  'Write 128 to MIDI port
  1195. ================================================================================
  1196. sub sbpasystem
  1197. An interesting routine that allows you to use your Soundblaster
  1198. card and computer as a "P.A. System" - included for curiosity's
  1199. sake only.  To terminate SBPASYSTEM, simply press any key on the
  1200. keyboard.  Samples from the Microphone or Line In jacks and plays
  1201. back over the Soundblaster's speakers.  You will probably hear a
  1202. fair amount of background noise while this routine is active,
  1203. depending on your system.
  1204. Example: call sbpasystem
  1205. ================================================================================
  1206. sub sbplaydma(s$,sr%,cm%)
  1207. NOTE: This routine will only function within a standalone .EXE
  1208.       file, and will have no effect when run from a program within
  1209.       the PowerBASIC IDE.
  1210. Plays back digitized data contained in a string in the background,
  1211. using DAC DMA techniques.  See SBPLAYSTRING for more information on
  1212. the differences between this command and SBPLAYSTRING.  You can use this
  1213. command to play back data sampled with SBSAMPLE$, or read out
  1214. of a file. You can also use SBCHECKDMA to check and see if a particular
  1215. sample played with this command is still playing or has finished (see
  1216. SBCHECKDMA).
  1217. s$: Set to digital data to play back.  Data may be in compressed format
  1218.     (4-bit, 2.6-bit or 2-bit compression), which you specify with the cm%
  1219.     parameter.
  1220. sr%: Set to sample rate for playback, in Hertz.
  1221. cm%: Set to compression type: 0=None, 1=4-bit, 2=2.6-bit, 3=2-bit.
  1222.      The string you pass in s$ should, of course, conform to the
  1223.      compression type that you indicate with this parameter.
  1224. Example: sbplaydma s$,8000,0  '8000 Hz., no compression
  1225. ================================================================================
  1226. sub sbplayfile (f$,dly%)
  1227. Plays an uncompressed digitized (raw) sound file through the Soundblaster
  1228. in the foreground (processing will not continue until the file is done
  1229. playing).  A utility is included with POW! to convert .VOC and .WAV files
  1230. to .RAW files that can be played with this routine (MAKERAW.EXE).  Note
  1231. that you can use SBPLAYPOW instead of this routine to play a sample from
  1232. a .POW library (see SBPLAYPOW).  Such a sample will play in the background,
  1233. rather than in the foreground as with this routine, and will play back at
  1234. exactly the original sample rate recorded.  One advantage of this routine,
  1235. however, is that you can play back a digital sample of nearly ANY length.
  1236. Also, this routine may be more compatible with different hardware setups,
  1237. as it doesn't matter what the user has their SB DMA and interrupt settings
  1238. at (they're not used).  It's up to you to choose which of the routines to
  1239. use in your programs.
  1240. NOTE: Use the $STRING metastatement to allocate the maximum size
  1241. string segment possible, as the shorter the string, the less of the
  1242. file can be read in at once, and the more delays you may hear in the
  1243. playback of the file.  $STRING 32 is recommended.
  1244. f$: Set to the path\filename of the file to play.  You should not
  1245.     attempt to play back .VOC and .WAV files directly with this
  1246.     routine (convert them to raw sample data with MAKERAW first).
  1247.     Although it can be done, it will introduce a lot of extra noise
  1248.     into the samples because of the extra information included in .VOC
  1249.     and .WAV files (header, block types, etc).
  1250. dly%: Set to a delay value, which will vary depending on the
  1251.       speed the sound file was originally recorded at.  Experiment
  1252.       with this value to find the optimal delay setting for the file(s)
  1253.       you are playing.  The higher the value given, the slower the file
  1254.       will be played back (the longer the delay).  If you need to play the
  1255.       files back at exactly the original rate, or don't have a good ear for
  1256.       exact playback speed, use SBPLAYPOW along with the MAKEPOW utility
  1257.       instead to convert .VOC and .WAV files to .POW libraries, which will
  1258.       play back at exactly the original speed recorded, without any input
  1259.       from you other than filename and sample number.  See the SBPLAYPOW
  1260.       command for more information.
  1261. Example: sbplayfile "test.raw",60  'Play back a .RAW file with delay of 60.
  1262. ================================================================================
  1263. sub sbplaypow(f$,sn%)
  1264. NOTE: This routine will only function within a standalone .EXE
  1265.       file, and will have no effect when run from a program within
  1266.       the PowerBASIC IDE.
  1267. Plays a digitized sample from a .POW file, which is a proprietary
  1268. POW! Library format for storing digital samples.  Included with POW!
  1269. is MAKEPOW, a utility that allows you to convert and store .VOC and
  1270. .WAV files in the .POW file format.  A .POW file can hold up to 32
  1271. digital samples (V1.0), each with a particular length, compression
  1272. type and sample rate.  To play back a sample in a .POW file, use
  1273. this command with the name of the file and the number of the sample
  1274. you want to play back.  .POW samples play back in the background,
  1275. so control returns to you immediately while your program continues.
  1276. You can use the SBCHECKDMA flag to check if a sample is still playing
  1277. after starting playback (see SBCHECKDMA).
  1278. f$: Set to the filename of the .POW library (.POW extension required)
  1279. sn%: Set to the sample number (1-32) to play back.  Setting a sample
  1280.      number of zero will cancel playback of any sample currently playing.
  1281.      Attempting to play a nonexistent sample will simply have no effect,
  1282.      and control will return to your program immediately.
  1283. Example: sbplaypow "sounds.pow",3  'Play back sample #3 in sounds.pow
  1284. ================================================================================
  1285. sub sbplaystring(s$,rte%)
  1286. Plays back a sample recorded into a string with SBSAMPLE$, and
  1287. can also play any raw sample data contained in a string.  Similar
  1288. to SBPLAYFILE, but plays from a string instead of from a file.
  1289. You can also play back a string of digitized data with the SBPLAYDMA
  1290. command.  To choose which routine to use when playing back a sample
  1291. in a string (or a file), you should understand a little of how the
  1292. Soundblaster works.  There are two methods of playing back digitized
  1293. samples with the SB: the direct method, and the DMA method.  The direct
  1294. method is just what it implies - each byte of the sample data is sent
  1295. to the Soundblaster, one at a time, tying up the processor while the
  1296. sample is playing.  This command (SBPLAYSTRING) uses the direct method.
  1297. The DMA method of sample output uses a special chip in your computer to
  1298. send the sample data to the SB card without CPU intervention.  This means
  1299. that you can play a sample in the background, while your program continues.
  1300. SBPLAYDMA uses the DMA method of Soundblaster digital access.  The DMA
  1301. method also offers hardware decompression of compressed digitized data.
  1302. Although the DMA method would at first seem to always be preferable, it's
  1303. not always so.  The direct method is much simpler to implement, and much
  1304. less hardware-dependent than the DMA method is.  Thus, it will have a
  1305. greater chance of running on any machine it's used on. The DMA method uses
  1306. both the DMA chip (which is set with a jumper on the sound card) and traps
  1307. an interrupt (normally INT 5 or INT 7), and is thus a lot more complicated
  1308. and stands a greater chance of not working on a particular machine,
  1309. especially if you haven't used SBSETINT, SBSETDMA and SBSETBASE to set all
  1310. these addresses.  The direct method needs only the right base port (which
  1311. is normally 0220h and not generally changed).  It's completely up to you to
  1312. weigh the advantages and disadvantages of the direct method of digital
  1313. transfer (used by SBPLAYFILE and SBPLAYSTRING) or the DMA (background)
  1314. method (used by SBPLAYPOW and SBPLAYDMA).
  1315. s$: Set to string containing digitized sample data retrieved with
  1316.     SBSAMPLE$, or from a file containing raw sample data.
  1317. rte%: Set to playback rate (see SBSAMPLE$ and SBPLAYFILE for examples
  1318.       of how the rate value applies to playback speed.
  1319. Example: s$=sbsample$(8000,40)  'Record a sample
  1320.      sbplaystring s$,40     'Play back sample s$ at rate 40
  1321. ================================================================================
  1322. function sbpowname$(f$,sn%)
  1323. Retrieves the name of the specified .POW sample from a .POW library
  1324. and returns it as an 8-character string.  Each sample in a .POW library
  1325. has an 8-character name derived from the original .VOC or .WAV file added
  1326. to the library.
  1327. f$: Set to the filename of the .POW library (.POW extension required)
  1328. sn%: Set to the sample number to retrieve the name of
  1329. sbpowname$: Returns the 8-character name of the specified sample (space-
  1330.         padded)
  1331. Example: print sbpowname$("test.pow",1)  'Prints name of sample 1 in
  1332.                      'TEST.POW.
  1333. ================================================================================
  1334. sub sbpresetmixer <SB-PRO ONLY>
  1335. Resets the onboard mixer to power-up state on the Soundblaster
  1336. Pro card.  Probably won't do any harm using the mixer commands with
  1337. a regular Soundblaster, but the user should be polled in your program
  1338. as to the type of SB card he/she has.  See SBPSETMIXER to set the values
  1339. of the SB Pro's onboard mixer chip.
  1340. Example: call sbpresetmixer
  1341. ================================================================================
  1342. sub sbpsetmixer(ms%,mv%,vfm%,vcd%,vln%,vvc%,vmc%) <SB-PRO ONLY>
  1343. Sets values for the Soundblaster Pro's mixer chip.  Calling this
  1344. routine with a regular Soundblaster probably won't do any harm, but
  1345. the user should be polled in your program as to the type of SB card he
  1346. or she has.  See SBPRESETMIXER to reset the mixer chip to power-up values.
  1347. ms%: Set to 0 for mono or 1 for stereo output.  This also selects
  1348.      filtered output automatically.
  1349. mv%: Set to master volume setting (0-15) for left and right channels.
  1350.      The formula to use is 16 * left channel + right channel.
  1351. vfm%: Set to volume for FM music (0-15) for left and right channels.
  1352.       The formula to use is 16 * left channel + right channel.
  1353. vcd%: Set to volume for CD output for left and right channels.
  1354.       The formula to use is 16 * left channel + right channel.
  1355. vln%: Set to volume for line in, left and right channels.
  1356.       The formula to use is 16 * left channel + right channel.
  1357. vvc%: Set to volume for digitized sound for left and right channels.
  1358.       The formula to use is 16 * left channel + right channel.
  1359. vmc%: Set to volume for microphone input (0-7).
  1360. Example: sbpsetmixer 1,255,255,255,255,255,255 'Stereo, max volume all.
  1361. ================================================================================
  1362. sub sbreset
  1363. Resets the Soundblaster card, preparing it for digitized output.
  1364. This is similar to the SBFMCLEAR command (which applies to FM music),
  1365. but SBRESET should be called before using SBPLAYFILE, SBPLAYSTRING,
  1366. SBPLAYPOW, SBPLAYDMA or SBSAMPLE$ for the first time.  You should
  1367. call it once before outputting digitized sound with any of the above
  1368. mentioned commands, and again if you start using a new command at some
  1369. point in your program.
  1370. Example: call sbreset
  1371. ================================================================================
  1372. function sbsample$(ln%,rte%)
  1373. Reads a digital sample from the Soundblaster's Line In or Microphone
  1374. Input and stores it in a string.  The sample can then be played back with
  1375. SBPLAYSTRING, or stored in a file and played back later with SBPLAYFILE.
  1376. ln%: Set to length of sample to take.  This value should never exceed
  1377. the string segment size set with $STRING (see example below).  The sample
  1378. will be read until the entire sample length you passed in ln% is taken.
  1379. rte%: Set to a RATE value, similar to the dly% parameter in SBPLAYFILE.
  1380. The higher the value of rte% you provide, the more recording time you'll
  1381. get from a given value passed in ln%, but the poorer the sound quality.
  1382. I have gotten good results with rte% values from 10 to 50.  Lower than
  1383. 10 will give you very little recording time with few additional benefits,
  1384. and the accuracy as related to SBPLAYFILE playback decreases as well (if
  1385. you use the same value for rte% in sbsample$ and dly% in sbplayfile).
  1386. Values over 50 usually result in poor sound quality.
  1387. Example: $string 8   'must be 8 or greater for this example
  1388.      call sbreset  'Reset the SB
  1389.      print "Press a key to start recording a sample";
  1390.      while inkey$="":wend
  1391.      s$ = sbsample$(8000,40)  'Take an 8000-byte sample at rate 40
  1392.      open "sample.raw" for output as #1  'Prepare to save the sample
  1393.      print #1,s$;                        'Write sample to file
  1394.      close #1
  1395.      print "Press a key to play the sample back"
  1396.      sleep
  1397.      sbplayfile "sample.raw",40  'Play back the digital sample.
  1398. ================================================================================
  1399. function sbsamplebyte
  1400. Allows you to sample a byte directly from the Soundblaster's Microphone
  1401. or Line Input, allowing you to signal your program via voice or sound
  1402. input.  It also allows experimentation with voice recognition and other
  1403. similar ideas.  You should never use this routine while playing back a
  1404. sample with SBPLAYPOW or SBPLAYDMA, as it will cause interference with
  1405. the sound output from this routine and could conceivably cause a system
  1406. crash as well.
  1407. sbsamplebyte: Returns the value of the byte most recently sampled from the
  1408.           SB's Line In or Mic In.  This will be 128 for no input, and
  1409.           a varying other value depending on the amplitude and the
  1410.           waveform of the input signal.  128 seems to be the median
  1411.           value, with values dropping below and climbing above this
  1412.           number as the waveform of the input signal changes.
  1413. Example:  call sbreset  ;Always recommended before using sbsamplebyte
  1414.       do
  1415.          print sbsamplebyte
  1416.       loop
  1417. ================================================================================
  1418. sub sbsay(s$)
  1419. NOTE: This routine will only function within a standalone .EXE
  1420.       file, and will have no effect when run from a program within
  1421.       the PowerBASIC IDE.
  1422. Speaks a string as synthesized speech if the SB speech
  1423. driver is loaded (check for it with SBSPEECH before calling).
  1424. String should be a maximum of 255 characters in length.
  1425. Note: Calling the sound driver while in the PB IDE (PB.EXE)
  1426.       may cause your computer to crash or reboot.  This routine
  1427.       should be called only from a standalone .EXE file.  I've also
  1428.       noticed that entering and leaving the PB IDE after loading the
  1429.       speech driver, and then using this command, can cause a system
  1430.       crash as well.
  1431. Example: sbsay "Hello there!"
  1432. ================================================================================
  1433. sub sbsetbase(io%)
  1434. Sets the base address for the Soundblaster card
  1435. (normally &h220).  This controls output of digitized
  1436. sounds (SBPLAYFILE/SBPLAYPOW commands).  To set
  1437. the Adlib FM-Music ports, use SBFMSETPORTS instead.
  1438. Note: You can often get this address from the BLASTER environment
  1439.       variable. If you use S$=ENVIRON$("BLASTER"), a string will be
  1440.       returned in S$ of the form "A220 I7 D1 T3".  The A220 indicates
  1441.       the base address (220 hex), the I7 the interrupt number (7), the D1
  1442.       the DMA number (1). The T indicates the type of sound card.  You can
  1443.       parse this string out and use SBSETBASE and SBSETINT to set the SB's
  1444.       base and interrupt addresses for the POW! Toolbox.
  1445. io%: Set to base I/O port address for the Soundblaster card.
  1446. Example: sbsetbase &h220
  1447. ================================================================================
  1448. sub sbsetdma(d%)
  1449. Sets the DMA to be used with the Soundblaster card (defaults to DMA 1).
  1450. This should be set on a jumper on the user's Soundblaster card, and is part
  1451. of the BLASTER environment variable.
  1452. d%: Set to DMA number to use (0, 1 or 3).
  1453. Example: sbsetdma 1  'Sets DMA 1
  1454. ================================================================================
  1455. sub sbsetint(i%)
  1456. Sets the default interrupt for the Soundblaster card, which
  1457. can be inputted by the user or taken from the BLASTER environment
  1458. variable.  If never set, the SB interrupt in POW! defaults to INT 7.
  1459. Example: sbsetint 5  'Set IRQ 5 for Soundblaster
  1460. ================================================================================
  1461. function sbspeech
  1462. NOTE: This routine will only function within a standalone .EXE
  1463.       file, and will have no effect when run from a program within
  1464.       the PowerBASIC IDE.
  1465. Returns -1 if the SB's speech driver is installed,
  1466. or 0 if not.  Use before calling SBSAY to add synthesized
  1467. speech to your programs.
  1468. Example: print spspeech
  1469. Creative Voice File (.VOC) File Format
  1470. --------------------------------------
  1471. HEADER: (bytes &h00-&h19)
  1472. =======
  1473.      byte #           Description
  1474.      ------           -----------
  1475.      &h00-&h12        'Creative Voice File'
  1476.      &h13             &h1A (eof to abort printing of file)
  1477.      &h14-&h15        &h1A &h00  word offset in file of first data block
  1478.      &h16-&h17        Version number              (VOC-HDR puts &h0a &h01)
  1479.      &h18-&h19        2's Comp of Ver. # + &h1234 (VOC-HDR puts &h29 &h11)
  1480. DATA: (bytes &h1a+)    A series of data blocks terminated by &h00
  1481. =====
  1482.    Data Block:  TYPE(1-byte), SIZE(3-bytes), INFO(0+ bytes)
  1483.    -----------
  1484.       TYPE   Description   Size (3-byte int)   info
  1485.       ----   -----------   -----------------   ----
  1486.       00     End Block     1 byte, zero only   none (EOF marker)
  1487.       01     Sound data    2+length of data    *
  1488.       02     Subsq. data   length of data      none
  1489.       03     Silence       3                   **
  1490.       04     Marker        2                   marker #
  1491.       05     Message       length of data      0 byte terminator
  1492.       06     Repeat        2                   # of repetitions
  1493.       07     End repeat    0                   none
  1494.       08+    ????          ???                 ???
  1495. *Sound info format:         **Silence info format:
  1496.  -----------------            --------------------
  1497.  00   Sample rate            00-01  Length of silence
  1498.  01   Compression type       02     Duration
  1499.  02+  Data                   03     Sample rate
  1500. Sample rate       -- SR byte = 256-(1000000\sample_rate) ***
  1501. Length of silence -- (# of .1 seconds encrypted)
  1502. Compression type  -- 8-bits    = 0
  1503.              4-bits    = 1
  1504.              2.6-bits  = 2
  1505.              2-bits    = 3
  1506.              Multi DAC = 3+(# of channels)
  1507. Silence encoding finds quiet places in file, and creates a separate
  1508. block that is of type Silence.
  1509. *** If the file is stored for a sample rate over 22222 then
  1510.     no compression is allowed and the speed is stored as a word
  1511.     given by SR WORD= 65536-(256000000\sample_rate)
  1512. .CMF File Format
  1513. ----------------
  1514. Bytes &h00-&h03: 'CTMF'
  1515. Bytes &h04-&h05: Sub/Main digits of CMF version
  1516. Bytes &h06-&h07: Offset of instrument data (from start of file)
  1517. Bytes &h08-&h09: Offset of music data (from start of file)
  1518. Bytes &h0a-&h0b: Timer ticks per quarter note
  1519. Bytes &h0c-&h0d: Interrupts per second
  1520. Bytes &h0e-&h0f: Offset of title text (from start of file)
  1521. Bytes &h10-&h11: Offset of author's name text (from start of file)
  1522. Bytes &h12-&h13: Offset of comment text (from start of file)
  1523. Bytes &h14-&h23: 16 bytes, either 1 or 0 (MIDI channel used/not used)
  1524. Bytes &h24-&h25: Number of instruments
  1525. Bytes &h26-&h27: Basic tempo of music
  1526. Bytes &h28-    : Data indicated by previous bytes
  1527. Instruments: Each instrument data item consists of 16 bytes.
  1528. Music block: Conforms to standard MIDI specifications
  1529. .POW File Format Info
  1530. ---------------------
  1531. Header:
  1532. (1) 'PBPOWF'    (6 bytes)
  1533. (2) 0 byte      (1 byte)  The value 0 may change in future versions and
  1534.                           if so will be an indicator of .POW file format
  1535.                           version, and also indicate max number of samples
  1536.                           that can be stored in the .POW library.
  1537. (3) 32 * DWORD  (128 bytes consisting of the offsets of each sample
  1538.          within the file.  A value of 0 for any DWORD offset indicates
  1539.            no sample for that particular entry.  Samples correspond to the
  1540.            format given below.)
  1541. Sample Format:
  1542. (1) Name of Sample: 8 bytes, space-padded at the right
  1543. (2) Compression type: 1 byte, same as .VOC
  1544. (3) Sample Rate: 1 byte, same as .VOC
  1545. (4) Size of Sample: 1 word (2 bytes) - size = 0 to 32738 max (based
  1546.                        on max PB string segment size)
  1547. (5) Sample data.. length as indicated in (4)
  1548. POW! Toolbox Trial License
  1549. --------------------------
  1550. The POW! Toolbox is 
  1551. copyrighted, commercial software
  1552. being distributed under the shareware (try before you buy)
  1553. marketing concept.  It is 
  1554. not free software
  1555. , nor is it in
  1556. the public domain.
  1557. You are licensed to try POW! routines in your programs for
  1558. a period of 
  1559. 60 days (two months)
  1560. .  You 
  1561. may not distribute
  1562. programs that include POW! routines, either for pay or for
  1563. free, 
  1564. without first registering POW!
  1565. .  If at the end of 60
  1566. days you decide not to register POW!, you should delete all
  1567. copies of the program, including all executable files that
  1568. contain POW! routines, and discontinue use.
  1569. Registered users of POW! will receive the following
  1570. benefits:
  1571. * The 
  1572. latest version of POW! on floppy disk
  1573.  (specify
  1574.   format, or 3 1/2", 1.44MB HD will be sent).  This
  1575.   includes all files that came with the shareware
  1576.   version, as well as the source code (see below).
  1577. * Complete 
  1578. assembly language source code
  1579.  to POW! routines
  1580.   for ease of making modifications to the software.  This
  1581.   is a major benefit, and one that is not offered with many
  1582.   all assembly-language toolboxes.
  1583. License to use POW! routines
  1584.  in programs intended for
  1585.   distribution and/or sale, 
  1586. without payment of further
  1587. fees or royalties
  1588. .  This is guaranteed in writing along
  1589.   with your registered copy.
  1590. * Prompt notification of and 
  1591. access to major updates
  1592.   POW! for a negligible upgrade fee (currently $10.00 incl.
  1593.   P&H, subject to future change).  Minor updates and bug
  1594.   fixes are always free with a postpaid disk mailer and
  1595.   floppy disk.
  1596. More demonstration programs
  1597. , with tips and techniques on
  1598.   using POW! routines.
  1599. * A collection of 
  1600. .VOC, .WAV and .CMF files
  1601.  for use with
  1602.   POW! or for any other use you wish.
  1603. Technical support by mail
  1604.  and via the PowerBASIC BBS and
  1605.   any other online services frequented by the author (see
  1606.   the Bibliography section for an online reference)
  1607. You may also receive 
  1608. other benefits
  1609.  in addition to those
  1610. stated above (which are guaranteed upon registration.
  1611. Note that this is not a warrantee of any kind, but a
  1612. guarantee of benefits upon payment of the registration fee.
  1613. Commercial users of POW! must register and pay for their
  1614. copies of the program 
  1615. within 10 days
  1616.  of first use or their
  1617. license is withdrawn.  Site-license arrangements may be made
  1618. by contacting the author at the address given below.  Site-
  1619. licensing contracts are negotiated on an individual basis.
  1620. To register POW!, please send a check or money order for
  1621. $29.95, plus $5.00 shipping and handling ($34.95 total)
  1622. , to:
  1623. Tim Gerchmez
  1624. 12648 S.E. 81st Pl.
  1625. Renton, WA  98056-9121
  1626. Use the form included in this package (REGISTER.FRM).  If
  1627. you don't, please don't forget to specify your FULL NAME,
  1628. ADDRESS, TELEPHONE NUMBER, and DISK FORMAT desired.
  1629. Foreign registrants must pay with a check or cashier's check
  1630. DRAWN ON A U.S. BANK, or with U.S. dollars in cash.  Foreign
  1631. users are guaranteed the 
  1632. same registration benefits
  1633.  as domestic
  1634. users, including full technical support by mail.
  1635. Questions or comments may also be directed to the author
  1636. at the above address.  
  1637. Comments and/or questions from
  1638. unregistered users are welcomed.
  1639. DISTRIBUTORS
  1640.  are hereby licensed to distribute POW!
  1641. freely, provided that all files included in the
  1642. shareware package are kept together and unaltered
  1643. (additional files may be added if necessary).  It's
  1644. recommended that you contact the author at the
  1645. address given above, so that program updates and
  1646. bug fixes can be sent to you.  For additional
  1647. details, see the file VENDOR.DOC included with
  1648. this package.
  1649. BBS SYSOPS
  1650.  may distribute POW! freely, provided that
  1651. all files included in the archive package are kept
  1652. together and unaltered (additional files may be added).
  1653. It's recommended that you contact the author at the
  1654. address given above, so that program updates and bug
  1655. fixes can be sent or uploaded to you.  The POW! package
  1656. may be un-archived and re-archived using a different
  1657. archiving technique (suggested filenames are POW!.ZIP
  1658. or POW!.ARJ), and posted freely on any kind of BBS
  1659. system.
  1660.      POW! for PowerBASIC 3.0 Registration Form
  1661.      -----------------------------------------
  1662. ___  
  1663.   I would like to register POW! for
  1664.      PowerBASIC 3.0.  Enclosed is my check or
  1665.      money order for $34.95 ($29.95 + $5 S/H).
  1666.      Please send me the latest version on disk
  1667.      in the format specified below.  I understand
  1668.      that I will receive complete source code for
  1669.      POW! and free technical support by mail.
  1670.      Foreign Users:  Check/M.O. drawn on a U.S. bank
  1671.              or U.S. dollars in cash only please.
  1672. ___  I do not want to register the POW! library,
  1673.      because of the reasons detailed below.  Please
  1674.      make the improvements/bug fixes I have specified
  1675.      and I will reconsider registering.
  1676. Name:  ____________________________  Date:  _________
  1677. Address: ____________________________________________
  1678.      ____________________________________________
  1679. City:    _____________________  State:  _____________
  1680. Zip:     ________-_____  Phone: (_____) ____-________
  1681. Disk Format: ___ 3 1/2" 1.44MB   ___ 5 1/4" 1.2MB
  1682.          ___ Other format not listed: ___________
  1683.           _______________________________________
  1684. Area for      _______________________________________
  1685. Suggestions,  _______________________________________
  1686. Comments,     _______________________________________
  1687. Bug Fixes,    _______________________________________
  1688. Other...      _______________________________________
  1689.           _______________________________________
  1690. Mail to:  
  1691. Tim Gerchmez
  1692. 12648 S.E. 81st Pl.
  1693. Renton, WA  98056-9121
  1694. Thanks for your registration!
  1695. POW! Toolbox Bibliography
  1696. -------------------------
  1697. The following books and other documents were helpful in the
  1698. research, design and creation of the POW! Toolbox.  Thanks
  1699. go to the authors and publishers of all of these excellent
  1700. books and text files.
  1701. * MS-DOS Functions - Programmer's Quick Reference Series
  1702.   ------------------------------------------------------
  1703. (C) Copyright 1988 by Ray Duncan, Microsoft Press
  1704. ISBN 1-55615-128-4
  1705. A useful technical reference to MS-DOS interrupt calls.
  1706. * PowerBASIC 3.0 Programmer's Guide and Reference Guide
  1707.   -----------------------------------------------------
  1708. (C) Copyright 1990, 1992 by Robert S. Zale
  1709. Portions (C) Copyright 1987, 1989 Borland International
  1710. The PowerBASIC Programmer's Guide and Reference Guide are
  1711. of course indispensable references when writing anything for
  1712. PowerBASIC.  The PB online help is also excellent, and served
  1713. as a great resource.
  1714. * Programming the 8086/8088
  1715.   -------------------------
  1716. (C) Copyright 1983, Sybex Inc.
  1717. Written by James W. Coffron
  1718. ISBN 0-89588-120-9
  1719. A reference for 8086/8088 opcodes and operands, and
  1720. a programming guide for these chips.
  1721. * Using Assembly Language, 3rd Edition
  1722.   ------------------------------------
  1723. (C) Copyright 1992 by Que Corporation
  1724.  Written by Allen L. Wyatt, Sr.
  1725. An excellent and very complete reference guide to programming
  1726. the 8086/80286/80386 chips.  Much useful information on just 
  1727. about all aspects of ASM programming.
  1728. * Borland Turbo Assembler User's Guide
  1729.   ------------------------------------
  1730. (C) Copyright 1988- Borland, International
  1731. Borland's excellent documentation for TASM was a great 
  1732. help in writing POW!.  It supplies many useful examples, 
  1733. and goes into great detail about TASM programming.  I'd 
  1734. recommend TASM as an assembler based on the quality of 
  1735. the documentation alone.
  1736. * Writing and Marketing Shareware
  1737.   -------------------------------
  1738. (C) Copyright 1992, Steven C. Hudgik
  1739. ISBN 0-8306-2552-6 (p)
  1740. The definitive work on Shareware, and the best guide I've 
  1741. found to (as the title suggests), writing and marketing 
  1742. Shareware.  All Shareware authors should have a copy of
  1743. this book in their library.
  1744. * Programming the Adlib/Soundblaster FM Music Chips, v2.0
  1745.   -------------------------------------------------------
  1746. (C) Copyright 1991, 1992 Jeffrey S. Lee
  1747. A text file in public circulation detailing the 
  1748. technical aspects of programming the Adlib and 
  1749. Soundblaster cards.
  1750. * The Sound Blaster Book
  1751.   ----------------------
  1752. (C) Copyright 1992, Abacus - A Data Becker Book.
  1753. Written by Axel Stolz.
  1754. The best book I've found on the Soundblaster card.  
  1755. This book was a great resource, and supplied many 
  1756. programming examples and file format details.
  1757. * The Soundblaster Freedom Project
  1758.   --------------------------------
  1759. Jeff Bird, jeff@wench.jcu.edu.au
  1760. A series of Public Domain text files and 'C' programs 
  1761. containing much useful information on programming the 
  1762. Soundblaster card.
  1763. * Ralf Brown's Interrupt List
  1764.   ---------------------------
  1765. (C) Copyright 1989, 1990, 1991, 1992, 1993 Ralf Brown
  1766. This is not a book but a freeware reference guide 
  1767. available on BBS's.  It's an absolutely thorough and 
  1768. indispensable technical reference to PC interrupt calls. 
  1769. Without it, POW!'s speech driver functions would not have 
  1770. been possible.  Special thanks to Ralf Brown for providing
  1771. such a useful resource for PC programmers.
  1772. * Online Resource:
  1773.   ---------------
  1774. Masterpiece BBS
  1775. Kent, Wa
  1776. Running Major BBS software
  1777. (206) 281-3676
  1778. (206) 639-0899
  1779. Masterpiece BBS, with 24 CD-ROMs online, was a great
  1780. resource and help when writing POW!.  One of the best
  1781. BBS's in the Puget Sound area, and possibly in the nation.
  1782. Many incoming phone lines and services offered.  Give them
  1783. a call!  You can leave me (the author of POW!) E-mail under
  1784. the handle "Futureboy."
  1785. I would also like to thank Creative Labs for designing the
  1786. Soundblaster card, and making available to users and programmers
  1787. the many drivers for its different functions.
  1788.