QBasic Background Sound - Alternate found
Hi Guys,
Hmmm very quite over this side of the forum :)
Anyways, I have created a QBasic front end app that runs under DOS (Win98SE).
It works well, has animated stary background etc. I now want to add SOUND :)
I dont want to use the PC Speaker (Play/Sound is out), and want to use the
external speakers via my SoundCard (16bit ISA SoundBlaster - it works).
I have sucessfully used a 3rd party app - SBPlay.exe but of course it runs, then returns process to my app.
In short, I need a method of playing background sound - prefferably .WAV format.
I have tried various QBasic .WAV code to no avail.
So - Ideas time.
How are you guys implimenting background sound (MOD, WAV, etc)???
Cheers 'n' many beers,
Bruce.
Re: QBasic Background Sound
Here is what I do for sound.
This does not work for .WAV, .MID, ect. It only puts notes and QBASIC created sounds.
Notes / Melody
PLAY "e8 d8 g8 a#4 T180 b2"
T180 is the tempo
e8 ect are the notes followed by how they are played (eighth, half, quarter)
Sound Created by: Pitch, Length
SOUND 1000, 18
1000 is the pitch, 18 is the length
Here is a bomb dropping:
FOR I = 4000 TO 1000 STEP -5
SOUND I, .1
NEXT I
And for a "beep" (MS "Ding")
BEEP
You can use MB for background music... (check QBASIC help)
Hope this is what you were looking for...
-- pSY cO.
Re: QBasic Background Sound
Beyond what pSY have suggested, I dont think QB supports sound card based file formats. If my memory serves me right, QB was created way ahead of any sound cards being used today.
I have seen however, sample programs that shows QB can execute machine language instructions using Read/Data functions. But that was a very complex series of codes.
Re: QBasic Background Sound
Quote:
Originally Posted by AioDCS
I have seen however, sample programs that shows QB can execute machine language instructions using Read/Data functions. But that was a very complex series of codes.
Quite common in those days. Just a string composed of all the machine language code bytes, VarPtr used to find the address of the first byte and Call to execute it. Using Read/Data to poke the bytes into RAM was okay for 8 bit single-processing computers, but got a bit hairy under Windows (and you can't easily execute data space or write to executable space). Most computers (PC, Apple II, Commodore, etc.) had some implementation that allowed it.
All you need is an assembler to assemble the code.
Re: QBasic Background Sound
Hi Guys,
I realised that QB was unable to do what I wanted as far as playing background WAVs go. I was aware of the composed string, but I needed something dynamic.
I rewrote the app in C++ and used Allegro to handle the images and concurrent sounds - works well.
I must admit, It was great getting back to the early days of BASIC. It is humbling to revisit how powerful it actualy was (for it's time of course).
Cheers. :)
Re: QBasic Background Sound - Alternate found
Greetings,
It IS possible to utilize background sound in QB, however it was to my understanding a bit of a hack and of course required Windows for such a task to be accomplished. To my understanding as well it was a add-on library specificly designed for QB, and most notabily the most popular method of sound (as well as background sound). Now the details are vague, as I've never personally used the library and only seen it in action (a friend of mine was one of those fanatics)a couple years ago, but I do know it is possible.
I thought I would enlighten you on this and tell you to search for the QB community sites for such a library.
Even then I don't know how mant of those sites still exist because several who was actively still writing those libraries have finally gave QB it's final farewell and joined/started the FreeBasic project, but there still resides a number of them who simply refused to switch even that so... =P
So if you don't mind alittle research, and don't mind having Windows running in the background then to let you know there is a sound card functionality available for QB, you just gotta be willing to look. (...and I'm not. lol)
Re: QBasic Background Sound - Alternate found
Quote:
Originally Posted by KrisKhaos
Greetings,
It IS possible to utilize background sound in QB, however it was to my understanding a bit of a hack and of course required Windows for such a task to be accomplished. ......
I thought I would enlighten you on this and tell you to search for the QB community sites for such a library.
Hi, as I mentioned in my original post.......... it's DOS! :)
( I have no problem doing it in Windows. I have successfully done it in DOS using C++)
Re: QBasic Background Sound - Alternate found
Quote:
Originally Posted by Bruce Fox
Anyways, I have created a QBasic front end app that runs under DOS (Win98SE).
My Bad, the Win98SE made me think that is was running. :)
Re: QBasic Background Sound - Alternate found
No probs, thanks for the reply anyways :)
It may help someone else in any event.
Cheers.
Re: QBasic Background Sound - Alternate found