PDA

Click to See Complete Forum and Search --> : wow! sound! look at this!


Bob Baddeley
Nov 3rd, 1999, 11:26 AM
A lot of people have been wondering how to make a sound in VB like QBasic does. I found a pseudo-solution. It is kind of cheating, but maybe somebody could look at this and improve on it.
I wanted a scrollbar that as you slide, it makes a different frequency. In QBasic 7.1 I wrote a program that looks like this:

Open "c:\freq.bob" For Random As #1
Get #1, 1, A%
SOUND A%, 5
Close #1
SLEEP 1

and made it into an .EXE using that awesome feature of QBasic 7.1. Then I wrote another QBasic program that went like:

SOUND 37, 0

and made it into a program as well. Finally, I went to VB and put a scroll bar on a form. The scroll bar has to have values between 37 and 32,767. Then put in the code:

Private Sub Form_Unload(Cancel As Integer)
BOBSTOP = Shell("C:\freqstop.exe", vbHide)
End Sub

Private Sub HScroll1_Change()
Open "C:\freq.bob" For Random As #1
Put #1, 1, HScroll1.Value
Close #1
BOB = Shell("C:\freq.exe", vbHide)
End Sub

This allows you to move the bar to set the frequency. The bar value goes to a file (freq.bob) that the QBasic program reads to get the frequency. It's kind of clunky because it isn't a smooth slide, but it accomplishes the purpose. The freqstop.exe is pretty important because for some reason the sound won't stop playing until you run it. Oh well. If you have any suggestions for improvement, or need help getting this to run, or can't make the .EXEs in QB 7.1, don't hesitate to email or post. :)

SteveS
Nov 3rd, 1999, 11:37 AM
QBasic,

I have looked all around and can't find a download site for it. Also I don't think you can buy it any more either.

Where did you get your copy.

Steve.

Bob Baddeley
Nov 3rd, 1999, 12:05 PM
Here's the best site for getting it; one I just found. I'm not sure if this is where I originally got it, but this is what you want.
http://gameprog.ampleworks.com/qbasic/files/Compilers/

SteveS
Nov 3rd, 1999, 03:00 PM
Thanks,

Steve.

Gimpster
Feb 4th, 2000, 04:51 AM
Gee, does this sound like Free Advertising to anyone else??? We get bombarded by enough ads as we use this site (see rotating banner ads at the top of the screen). However, if it wasn't for those ads, this wonderful site wouldn't be here. But your ads are not paying for this site, so please, don't put them on the bulletin board.

Originally posted by neogeo:
FANTASTIC SOUND GENERATION WITHOUT THE WAV'S

If you would like an easy way to play sounds in vb, goto the vbGo Developer Site which is fantastic. Once there look for an ActiveX control called 'Liquid Wave V2' this allows you to write music tracks, sound files and sound effects for your programs all at runtime!!! This means that you dop not need any .WAV files, which use up disk space!!!

This control is fantastic! Visit vbGo Today!
http://www.geocities.com/vbgo2



------------------
Ryan