home *** CD-ROM | disk | FTP | other *** search
-
-
-
- ╓────────────────────────
- ║
- ║ █▀▀▀▀▀▀▀▀ ▀▄ ▄▀
- ║ ▒█ ▒▒▀▄ ▄▀
- ╚══════════════╗ ▒█ ▒▒▀▄ ▄▀
- ║ ▒█▀▀▀▀▀▀▀▀ ▒▒▀▄ ▄▀
- ║ ╓────┐ ╖ ┌ ╓──╖ ╓──┐ ▒▒▀▄▀
- ║ ║ │ ║ │ ║ ║ ║ │ ▄▀ ▀▄
- ═════════════════════╝ ╚════╛ ╚═══╛ ╜ ╙ ╙──┘ ▄▀ ▒▒▀▄
- ▒█ ▄▀ ▒▒▀▄
- ▒█ ▄▀ ▒▒▀▄
- ▒▒ ▒▒
-
-
- library for 486 Systems (Beta Release, June 1993)
-
- David Smith, CompuServe 7141,2723
-
-
-
-
-
-
- Thanks for helping me out with this beta release of SoundFX 486.
- To sample one of the 70 sounds, type: SFX486 and you will pop into a
- menu. Simply highlight the noise you want to hear, and press ENTER.
-
- To exit at anytime, hit Alt-X or ESC several times.
-
- Back in 1990, when I first started SOUNDFX, I used ASM because
- of how quick it was. I usually program in C, but using the function
- call sound() just was not fast enough. The function is useful for a
- blip or boop on an XT or 286, but cannot make high-quality laser
- Star Wars space sounds as well as Assembler (actually, you can address
- PORT 61 through an "asm" declaration or simple port addressing, but
- either way, you are using ASSEMBLER calls).
-
- Today, it's 1993, going on 1994. The Pentium is out, my friend
- just purchased a 486-66, and my old sounds go BLIP instead of
- BLOOOOOOOOOOOIIIIIIIIIIP.
-
- Thus arrives 486SFX, sound effects engineered for a 386-33 and
- above. Unfortunately, I don't own a 486-50, 486-66 or the Pentium.
- My simple little 386-40 will have to suffice. But now, higher level
- languages can be used for sound effects.
- In fact, over 20 registered users of SOUND EFFECTS have complained
- about how the old stuff just doesn't sound good anymore. They purchased
- a new system, and their boot-up effects or cute games are just too "blippy",
- and the sounds only last a millisecond compared to their XT or 286's.
-
- Check it out, and see what you think.
-
-
-
- ===== SOUND EFFECTS 486 LIBRARY FOR PROGRAMMERS OF C =======================
-
- Enclosed is the library of all the sounds. You can use it
- in your own programs to enhance them. Add spacey sounds
- to your games, spreadsheets, or have the introduction of
- your program be outstanding.
-
- They are written in Turbo C++ and can be used in this manner:
-
- extern void fart(void);
-
- main()
- {
- fart();
- exit;
- }
-
- To compile, include SFX486.LIB in your project, or use the
- command line:
-
- TCC myprog.c SFX486.LIB (whereas MYPROG.C is your program,
- and using Turbo C++)
-
- If you are unsure of how to use libraries or functions in your
- programs, please consult your "C" reference manual. Here are
- the possible functions and their usage:
-
- void makesound(int freq, int duration, int nsound)
-
- consists of the lines:
-
- sound(freq);
- delay(duration);
- if(nsound==1) nosound();
-
- Makesound plays freq, then pauses duration,
- then turns off the sound if nsound=1
-
- EXAMPLE: makesound(100, 50, 1);
-
-
- void BIG_COOL(int Time,int Freq1,int Freq2,int Freq3,int Freq4,int D1,int D2,int D3,int D4);
-
- Time is how many loops the sound goes through
- Freq1 - Freq4 are different frequencies you can specify
- D1 - D4 are delays between the sounds
-
- EXAMPLE: BIG_COOL(100,20,4000,48,210,10,50,1,9);
-
-
- void BIG_SWITCH(int First, int Second, int Loops, int Step1, int Step2);
-
- This switches frequencies before it sends them through
- sound(); The effect is a vibration or shrill (really cool
- if you use it right!)
-
- First is the first frequency
- Second is the second frequency
- Loops is how many loops the sound goes through
- Step1 is how much you want to decrease First after each pass
- Step2 is how much you want to increase Second after each pass
-
- EXAMPLE: BIG_SWITCH(2039,41,170,10,20);
-
-
-
-
- The remaining sounds are cool stuff from the demo program: SFX486.EXE
- To hear any of them, just try out the program and listen to your
- favorites, then use them in your own code.
-
- Of course, there's a ShareWare screen attached. But if you like the
- sounds, send $15.00 (plus $2.00 for shipping) to:
-
- David Smith
- 1104 Mason Dr
- Hurst TX 76053
-
- This removes the ShareWare screen, plus gives you some MORE sounds
- that are not included here. That's only 14 cents a piece, which
- is pretty reasonable. Try them out and judge for yourself.
-
- To use them in your programs, take out all the "void"s,
- and simply call the function...
-
-
-
- void delicious(void);
- void affect(void);
- void karate(void);
- void clatter2(void);
- void clatter(void);
- void flanker(void);
- void expire(void);
- void swanson(void);
- void sharkys(void);
- void joseph(void);
- void photons(void);
- void distress(void);
- void bulges(void);
- void tender(void);
- void temper(void);
- void ontimes(void);
- void formats(void);
- void space(void);
- void illume(void);
- void fooling(void);
- void style(void);
- void force(void);
- void expanse(void);
- void direct(void);
- void vapor(void);
- void maligned(void);
- void glimmer(void);
- void plasma(void);
- void cautious(void);
- void tingle(void);
- void compress(void);
- void fervor(void);
- void update(void);
- void beamer(void);
- void harddisk(void);
- void determine(void);
- void settle(void);
- void medley(void);
- void yomomma(void);
- void thrill(void);
- void ditto(void);
- void visual(void);
- void demon(void);
- void error(void);
- void shirk(void);
- void blink(void);
- void chase(void);
- void magical(void);
- void stronger(void);
- void awaken(void);
- void flicker(void);
- void arcade1(void);
- void bees(void);
- void deadbird(void);
- void downup(void);
- void echos(void);
- void fart(void);
- void fire(void);
- void high(void);
- void motors(void);
- void pulse(void);
- void ringing(void);
- void siren(void);
- void wars(void);
- void bomb(void);
- void arcade2(void);
- void bloop(void);
- void Beep(void);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ========= HOW TO MAKE SOUNDS ================================================
-
- Making sound is relatively easy. And there are several ways to
- do it:
-
- 1) Turn on the port in Assembler
- 2) Turn on the port via a higher level language
- like C, PASCAL, or BASIC
-
-
-
-
- ------- What PORT do we use?
-
- Port 61 is the speaker PORT. In assembler, if we want to
- turn on the speaker, we use the following code:
-
- mov bx,1000 ;frequency value
- mov ax,bx ;place it in (ax)
- out 42h,al ;send LSB
- mov al,ah ;place MSB in al
- out 42h,al ;now we send it
- in al,61h ;get value from port
- or al,00000011 ;ORing turns on speaker
- out 61h,al ;send it to port
-
- This turns on the speaker, and sends it the frequency value.
- To turn off the speaker, we would use:
-
- in al,61h ;get value from speaker port
- and al,11111100 ;ANDing turns speaker off
- out 61h,al ;send it
-
-
- Higher level languages use a simpler and much friendlier interface,
- the Sound() and Nosound() functions. This does your port addressing
- for you, and eliminates the necessity of assembly code. The downside
- of this, of course, is higher level languages are slower than
- assembler, and the loops they perform won't be as quick as one in
- ASM code.
-
- Or you can simulate ASM code by the following (in C):
-
- main()
- {
- short value; /* Value received by the port */
- int freq=400; /* Our frequency */
- unsigned i;
-
-
- outportb(0x43, 0xb6); /* Initialize port */
- i = (unsigned)freq%256;
- outportb(0x42, i); /* Send high bit */
- i = (unsigned)freq/256;
- outportb(0x42, i); /* Send low bit */
-
- value = inportb(0x61); /* Get value from port 61 */
- value |= 0x03; /* AND the value */
- outportb(0x61, value); /* Send value to port 61 */
- }
-
-
- Notice the simularity to the above assembler code? Turning on
- the PC speaker involves quite a bit of code (doing it the hard way).
- The easier alternative, of course, is:
-
- in C: sound(400);
- or in Pascal: sound(400); (look real similar, huh?)
-
-
- To enhance the blip sound, we can:
-
- ∙ Loop it several times, changing the frequency each loop
- ∙ While looping, turn sound on and off
- ∙ Send variable frequencies through the sound() function
- ∙ Create multiple loops, each with different frequencies
- ∙ Increment/decrement frequencies once they reach a number
-
- ∙ Use all of the above for an spacey effect
-
-
-
-
- Let's look at an assembler program from Sound Effects 7 called
- ARCADE1:
-
- ------------- ARCADE1.ASM --------------------------------------------------
- cli ;off the interrupts
- mov di,2 ;repeat entire thing twice
- agin1: mov bp,20 ;20 cycles of sound
- mov al,10110110 ;magic number
- out 43h,al ;send it to timer
- mov bx,1000 ;start frequency high
- agin2: mov ax,bx ;place it in (ax)
- out 42h,al ;send LSB
- mov al,ah ;place MSB in al
- out 42h,al ;now we send it
- in al,61h ;get value from port
- or al,00000011 ;ORing turns on speaker
- out 61h,al ;send it to port
- mov cx,35000 ;our delay count
- looperx:loop looperx ;do nothing loop so we can hear sound
- add bx,50 ;lower frequency for next pass
- in al,61h ;get value from speaker port
- and al,11111100 ;ANDing turns speaker off
- out 61h,al ;send it
- dec bp ;decrement cycle count
- jnz agin2 ;if not = 0 do again
- mov cx,60000 ;else load cx for 2nd delay
- looperf:loop looperf ;do nothing loop
- dec di ;decrement repeat count
- jnz agin1 ;do entire thing again if not 0
- sti ;else turn interrupts on and leave
- ----------------------------------------------------------------------------
-
-
- This is basically what you saw above, with alternating frequencies
- and a loop to ensure the sound does not fly by too fast for us
- to hear.
-
- As you can see, the logic is:
-
- MAIN LOOP 2 times
- SECOND LOOP 20 times
- put 1000 through port 61
- delay 35000
- add 50 to frequency
- continue SECOND LOOP
- delay 60000
- continue MAIN LOOP
-
-
- and translating it to C gives us:
-
- -------------- ARCADE1.C ----------------------------------------------------
- {
- int count, count2, freq=1000; /* approximations */
-
- for(count=0; count < 2; count++)
- {
- for(count2=0; count2 < 20; count2++)
- {
- sound(freq);
- delay(350); /* approximations */
- freq+=50; /* approximations */
- }
- delay(800);
- }
- }
- -----------------------------------------------------------------------------
-
-
-
-
- To add cool special effects, we gotta be creative in the loops
- and frequencies:
-
- ------------- GLIMMER.C ----------------------------------------------------
- {
- int a,b;
-
- for(count=1 ;count <6 ;count++)
- {
- a = 10;
- b = 4000;
- for(count2=1 ;count2 <201 ;count2++)
- {
- sound (a);
- delay (2);
- sound (b);
- delay (2);
- a = a + 10;
- b = b - 10; }
- nosound(); }
- }
- ----------------------------------------------------------------------------
-
-
- NOTE: Glimmer is in your runnable code: SFX486.EXE
-
-
- ------------- GLIMMER.PAS --------------------------------------------------
- procedure glimmer;
- begin
- for count := 1 to 5 do
- begin
- a := 10;
- b := 4000;
- for count2 := 1 to 200 do
- begin
- sound (a);
- delay (2);
- sound (b);
- delay (2);
- a := a + 10;
- b := b - 10;
- end;
- nosound;
- end;
- end;
- ----------------------------------------------------------------------------
-
-
- or we can reset the frequencies once they reach a certain
- value (or when one reaches a value):
-
-
- ------------- AWAKEN.C -----------------------------------------------------
- {
- int reverse=0, freqhi, freqlo, i;
-
- freqhi=6000;
- freqlo=90;
-
- for(i=0;i<1400;i++)
- {
- sound(freqhi);
- delay(5);
- sound(freqlo);
- delay(5);
- if(reverse){ freqhi+=30; freqlo-=10; }
- else{ freqhi-=30; freqlo+=10; }
-
- if(freqhi<100) reverse=1;
- if(freqhi>5999) reverse=0;
- }
-
- nosound();
- }
- ----------------------------------------------------------------------------
-
-
- NOTE: Awaken is in your runnable code: SFX486.EXE
-
-
-
-
-
- ============= IDEAS TO PLAY WITH ===========================================
-
- 1. Have two integers with different frequency values,
- send them through the SOUND function, then exchange them
- and run through again.
-
- 2. Have multiple layers of loops, each with their own
- frequency integers. One loop can decrement their
- frequencies dependent upon another loop's frequency
- value, and another one can start/stop their value
- based upon another loop's step value.
-
- 3. Have random values for frequencies (make your own random
- number generator, C's RANDOM function sucks!).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Some of the sounds are not in the library yet (I am still
- working on them!) So if the menu does nothing or simply
- closes up when you choose a sound, don't panic.
- I will fill up the remaining sounds shortly.
-
- Sounds that definitely make a difference.
-
-
-
-
-
-
- Please give me your feedback. How do these sounds play on
- your computer? Are they too fast, too slow, etc...?
-
- Send your comments or suggestions to:
-
- David Smith, CompuServe 71441,2723
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-