No sound from QB45 running under WinXp

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
User avatar
Stevo22
Coder
Posts: 10
Joined: Wed Oct 15, 2008 6:38 am
Location: Melbourne, Australia

No sound from QB45 running under WinXp

Post by Stevo22 »

Hi Guys,

My first post - Nice to see that qbasic is still in use.

I've recently got back into programming and have loaded up my old version of Quickbasic 4.5 on my Laptop running Windows XP.

Everything seems to be running fine except I can't get any sound out of the laptop's internal speakers. Even with the basic BEEP statement.

I can live without it - but it's quite annoying.

I have old pc at a different location running dos 6.22 and as you would expect, all is well but I need to do edits off-site.

Any help would be appreciated.

Steve.
rishu
Newbie
Posts: 7
Joined: Thu Jul 17, 2008 4:48 am
Location: indyeah

Post by rishu »

As far as i know Qbasic uses internal buzzer to generate sound. So it may be possible that ur laptop doesn't have that buzzer.
I encountered the same problem with my COMPAQ machine.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Some motherboards can be adapted to use a PC speaker. You may be able to add that speaker.

Laptops can often use the stereo sound card instead. QB64 will allow QB programs to use the sound card too.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
sid6.7
Veteran
Posts: 318
Joined: Tue Jun 21, 2005 8:51 am
Location: west USA
Contact:

Post by sid6.7 »

try running it under DOSBOX and see if that helps...
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Here's an idea. Try making a program in a windowed Screen 0 (default)mode.

Add a beep and see if windows gives you a "thunk". It should.

By the way, many users are not very happy with QB sounds as some PC's are louder than others. Keep that in mind and perhaps offer an option to not use sound in your programs. I have had some complaints about it.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Ralph
Veteran
Posts: 148
Joined: Fri Feb 09, 2007 3:10 pm
Location: Katy, Texas

Post by Ralph »

Good idea, Ted, I tried it, butn no rsponse with BEEP! so, I used SOUND instead. This little program lets you hear it, at least on my VAIO, and for my ears, from 40 up to around 4000.

Code: Select all

FOR i = 40 TO 10000 step 10
  SOUND i, 2
  PRINT i;
NEXT i
Last edited by Ralph on Wed Oct 15, 2008 5:02 pm, edited 1 time in total.
Ralph, with QuickBASIC 4.5, operating under Windows XP, wiht anHP LaserJet 4L Printer. Bilingual in English/Spanish
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Do you have a DOG? Crank SOUND up to over 10,000 and watch him cringe or bark LOL.

Humans can hear close to 8000 or more if their hearing is good.

The interval of 2 is too small. 18 = about 1 second. So you had 1/9th of a second per loop. Also ANY sound or PLAY routine delays the program execution somewhat. Some programmers use that for delays alone.

Ted
Last edited by burger2227 on Fri Oct 17, 2008 12:34 am, edited 2 times in total.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
User avatar
Stevo22
Coder
Posts: 10
Joined: Wed Oct 15, 2008 6:38 am
Location: Melbourne, Australia

Post by Stevo22 »

Thanks everyone for your prompt replies.

I tried Ralph's SOUND with the 1sec. mod - still no sound.
burger2227's suggestion didn't work either.

I can live without it. I only wanted to use it for debugging purposes anyway, just as an audial cue.

The program I'm developing is for my own use, so there won't be any issues with other users.

My program is in it's early development and it's been some 15yrs or so since I've used QB4.5!! I've used VB3 in the past and recently stepped up to VisualStudio.NET but have not used it productively yet as I found it too much mucking around just to do something simple. I've also written some useful solutions with FileMaker.

I have a good understanding of programming, but I'm certainly no expert, so I will probably be asking lots of questions here.

The reason I've gone back to QB is the program runs a stepper motor (via the parallel port) connected through gearing to the polar axis of a 6inch reflector telescope and I don't want windows messing with it as timing is important.

My bro and I are involved in the project - he's on the electronics side.
We'll be doing some long exposure images of stars, galaxies using a decent digital camera.

We grabbed an old pentium that someone had thrown out, loaded up Dos 6.22, loaded up qbasic and stood back and marveled at it's simplicity! (a bit of a nostalgic moment)

Why? - Just for the hell of it! Keeps the old grey matter ticking over. Yeah, I know there is software out there already, but that's no fun!

Steve.
Ralph
Veteran
Posts: 148
Joined: Fri Feb 09, 2007 3:10 pm
Location: Katy, Texas

Post by Ralph »

Hi, steve. If Burger2227, who signs himself as Ted, is the same Clippy, who also signs himself as Ted, you will find he not only is a darn good programmer, but also very knowledgeable in the electronics and harware of using the computer to control and run electrical equipment and motors, So, I do believe you are in the right place for your needs. Good luck with your proyect, it sounds interesting!
Ralph, with QuickBASIC 4.5, operating under Windows XP, wiht anHP LaserJet 4L Printer. Bilingual in English/Spanish
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Hello Ralphy boy.............

Post by burger2227 »

Jeesh Ralph, you found me out! Did the avatar of Clippy give it away, LOL?

I have some interesting port routines in my Q-Basics.zip Demo at QbasicStation.com Member files, chapter 11.

BTW, VB and NET can also be used to run a port using INPOUT32.DLL for INP and OUT functions (free).

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Ralph
Veteran
Posts: 148
Joined: Fri Feb 09, 2007 3:10 pm
Location: Katy, Texas

Post by Ralph »

Just something in your style is what made me think that both Clippy and Burger2227 were the same Ted, ha, ha.
Ralph, with QuickBASIC 4.5, operating under Windows XP, wiht anHP LaserJet 4L Printer. Bilingual in English/Spanish
Nodtveidt
Veteran
Posts: 826
Joined: Sun Jul 25, 2004 4:24 am
Location: Quebradillas, PR
Contact:

Post by Nodtveidt »

Ralph wrote:Just something in your style is what made me think that both Clippy and Burger2227 were the same Ted, ha, ha.
Most of us already knew this. :P

Stevo22, I don't know if this will help or not, but if you install VDMsound onto your XP machine, and run QB through that, you might be able to get the desired results. Worth the install anyways, since it helps a lot of older MSDOS programs run better (and sometimes, run at all).
User avatar
Stevo22
Coder
Posts: 10
Joined: Wed Oct 15, 2008 6:38 am
Location: Melbourne, Australia

Post by Stevo22 »

Thanks again for the responses.

I'm not going to worry about the sound, and I am aware that what I want to do can be achieved with vb using INPOUT32.DLL for INP and OUT functions. I prefer not to have those overheads though and will be sticking with qb.

The stepper motor and controller came with some basic software that I have been able to modify - sending pin 6 high (then low) which gives the stepper 1 pulse at predetermined intervals - All works fine, but I will read up on the port access info that I have downloaded as suggested to better understand that part of it.

The program will use the left and right arrow keys to position the telescope, this will require the stepper ramping up to top speed, then decelerating before going into tracking mode. I think I should be ok with this part.

The main issue with the program so far has been coming up with a formula or method to accelerate and decelerate the stepper smoothly to overcome any sudden shocks therefore stressing the sensitive gearing mechanism.

We have actually achieved this accel/decel curve using a rather unconventional "clever but lazy" method. We used Audio editing software and created a square wave from aprox. 2Hz to 2kHz - saved the file as raw data and imported it into a simple qb program that detects the leading edge of each square wave. This data is then used as reference to how many clock cycles the computer will do before giving the stepper a pulse - Works absolutely perfectly.

We would rather do this in a more elegant and mathematical way. There must be a formula that is used. I have googled but am unsure exactly what formula I am looking for. One thing I do know is that it's NOT the formula for constant acceleration.

I have attached (I think) the shape of the curve as my avatar - I think it's part of a parabola? Time is on the x axis and y is the cycles/pulses.

If anyone has some ideas I would appreciate it.

Steve
Ralph
Veteran
Posts: 148
Joined: Fri Feb 09, 2007 3:10 pm
Location: Katy, Texas

Post by Ralph »

We are all very glad that you havae found a working solutioin to your problem. But, you are a "perfectionist", and want a mathematical solution to your acceleration problem, for which you are now showing us a curve.
Perhaps you could use that curve to do a chartt in Excel, then use the Trend facility there to obtain a best fit curve and its equation. That would be my way of approaching the problem, but your avatar is too small for me to think I could do the job right; it would require a much larger picture, and a lot of messing around to obtain a reasonably-similar curve.
Ralph, with QuickBASIC 4.5, operating under Windows XP, wiht anHP LaserJet 4L Printer. Bilingual in English/Spanish
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Unfortunately digital cannot do curves the same way as analog. All that you can do is turn on a port bit for different amounts of time. Ports always send the same voltage from the pins.

An excellent way to generate square waves is to use a 555 timer and a logic gate on your motor board driven by the port. An AND gate could work.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
User avatar
Stevo22
Coder
Posts: 10
Joined: Wed Oct 15, 2008 6:38 am
Location: Melbourne, Australia

Post by Stevo22 »

Ok thanks Ted & Ralph,

I'm not going to worry about this for now. What I have got is fine. I was hoping that I could use a formula, that way I could easily change the length of time that the accel/decel goes for. At the moment it is 12 seconds which is fine.

I have some other questions more on the programming side, so I will post them as new topics.

Steve.
Ralph
Veteran
Posts: 148
Joined: Fri Feb 09, 2007 3:10 pm
Location: Katy, Texas

Post by Ralph »

Say, Ted, I think I could come up with a resistor-capacitor circit to take the square waves as input and produce a reasonably smoot output curve. I know that you certainly would have no trouble doing it!
Ralph, with QuickBASIC 4.5, operating under Windows XP, wiht anHP LaserJet 4L Printer. Bilingual in English/Spanish
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

A stepper motor can use square wave pulses, but the number of pulses determines the location of the shaft. It could be determined using a port program or through an independant Timer circuit. No need for a sine wave.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
User avatar
Morpheus
Newbie
Posts: 8
Joined: Sun Dec 30, 2007 3:14 pm
Location: USA

Sounds like a neat project.

Post by Morpheus »

Stevo22 wrote:Thanks everyone for your prompt replies.

I tried Ralph's SOUND with the 1sec. mod - still no sound.
burger2227's suggestion didn't work either.

I can live without it. I only wanted to use it for debugging purposes anyway, just as an audial cue.

The program I'm developing is for my own use, so there won't be any issues with other users.

My program is in it's early development and it's been some 15yrs or so since I've used QB4.5!! I've used VB3 in the past and recently stepped up to VisualStudio.NET but have not used it productively yet as I found it too much mucking around just to do something simple. I've also written some useful solutions with FileMaker.

I have a good understanding of programming, but I'm certainly no expert, so I will probably be asking lots of questions here.

The reason I've gone back to QB is the program runs a stepper motor (via the parallel port) connected through gearing to the polar axis of a 6inch reflector telescope and I don't want windows messing with it as timing is important.

My bro and I are involved in the project - he's on the electronics side.
We'll be doing some long exposure images of stars, galaxies using a decent digital camera.

We grabbed an old pentium that someone had thrown out, loaded up Dos 6.22, loaded up qbasic and stood back and marveled at it's simplicity! (a bit of a nostalgic moment)

Why? - Just for the hell of it! Keeps the old grey matter ticking over. Yeah, I know there is software out there already, but that's no fun!

Steve.
8)I too have an old pentium that i am pushing the hell out of. Your project sounds reaaly interesting and cool. Are you taking photographs? What are you looking for or what area? Good luck and enjoy!
iamdenteddisk
Veteran
Posts: 185
Joined: Mon Jun 30, 2008 4:10 pm

I had this problem with my dell it is the code page

Post by iamdenteddisk »

you will have to adjust the codepage for qb to connect to the correct addresses ,atleast that is what fixed mine.

for some reason I could only get sound from precompiled programs and no sound from my programs or example code after adjusting the code page it give a popup something to the effect now I could use library's or the library was working "something to that effect" but it was the code page fix that done it... good luck!
Post Reply