Solved

PC Speakers

Posted on 1998-06-08
8
525 Views
Last Modified: 2010-04-04
When I use the Beep procedure, it hardly gives a beep at all. How do I get a decent and loud BUZZ or BEEP from the PC Speakers?

(I am using the MessageBeep if the user's computer has a multimedia card, otherwise I have to use the PC speakers...)

Thanks in advance...

Keith
0
Comment
Question by:keithcsl
  • 4
  • 3
8 Comments
 
LVL 2

Expert Comment

by:kjteng
ID: 1351516
You may try the obsolete setSound API. eg
  i:=openSound;
  if i>0 then
    setVoiceSound( 1, iFrequency, iDuration));
  startSound;
  closeSound;

You must set the device= sound.drv in config.sys
0
 
LVL 1

Author Comment

by:keithcsl
ID: 1351517
kjteng

i am soryy but i should have mentioned that i am using Delphi 3. The procedures that you have given are not available anymore. Is there any other way to get a loud beep?

Keith
0
 
LVL 2

Expert Comment

by:kjteng
ID: 1351518
What about playing a wav file to speaker?
0
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
LVL 1

Author Comment

by:keithcsl
ID: 1351519
kjteng

well, that's is what i am doing now (playing a wave file), but it is only for users with sound card. i just wanted to add another feature in my software for those without sound card, that is beeping the pc speakers...

Keith
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1351520
Hi keithcsl, try out these functions which I got from the web a long time ago :

Making PC Speaker Sound


    Below are the procedures Sound, NoSound, and Delay. They are called in
    the same way that Turbo Pascal's Sound, NoSound, and Delay procedures are
    called. For example, to produce a 600 Hz tone for 200 milliseconds, you
    would call the procedures as follows:

       Sound(600);
       Delay(200);
       NoSound;

    procedure TForm1.NoSound;
    begin
       Port[$61] := Port[$61] and $FC;
    end;


    procedure TForm1.Sound(Freq : Word);
    var
       B : Byte;
    begin
       if Freq > 18 then
          begin
             Freq := Word(1193181 div LongInt(Freq));

             B := Port[$61];

             if (B and 3) = 0 then
                begin
                   Port[$61] := B or 3;
                   Port[$43] := $B6;
                end;

             Port[$42] := Byte(Freq);
             Port[$42] := Byte(Freq shr 8);
          end;
    end;


    procedure TForm1.Delay(MSecs : Integer);
    var
       FirstTickCount : LongInt;
    begin
       FirstTickCount:=GetTickCount;
       repeat
          Application.ProcessMessages; {allowing access to other controls,
                                        etc.}
       until ((GetTickCount-FirstTickCount) >= LongInt(MSecs));
    end;

    Author: Thomas Foster

    Regards, Zif.
0
 
LVL 2

Expert Comment

by:kjteng
ID: 1351521
Just for discussion purpose:
You still can play wav to pc speaker eventhough there is no soundcard: Just install a small speaker driver to the pc. That way, you do not need to have separate code for those user who has no sound card.

0
 
LVL 1

Author Comment

by:keithcsl
ID: 1351522
ZifNab

Delphi 3 does not allow me to access the ports directly, not like in Delphi 2...

kjTeng

Could you elaborate more on the speaker driver, ie hardware/software requirements?

Keith
0
 
LVL 2

Accepted Solution

by:
kjteng earned 30 total points
ID: 1351523
Frist: Install speaker Driver
==============================
1. Make sure that there is a speaker.drv file {some oem may have named it as speakr.drv, speaker.exe etc .. or may even supply you an installation disk with inf files}

2. Add the following to your system.ini file:
[boot]
sound.drv=mmsound.drv
[drivers]
wave=speaker.drv

3. Restart your windows.

4. Goto control panel - multimedia to set the speaker   volume,    Goto contol panel - sound to test the speaker sound.

5. If your speaker driver is installed correctly, the pc will play wav file through the speaker.


Second: play sound in delphi
=============================
Add "mmsystem" to the uses clause of your program file.
Call the API sndPlaySound to play wave, eg sndPlaySound('filename.wav', snd_NoDefault)  That's it!
(For more info on the sndPlaySound function, please check: delphi1:  mmsystem.hlp file in you delphi\bin directory.
delphi3:  mm.hlp file in you delphi3\help directory.
)

P/S If the above works but the sound is still no loud enough then I think you should change the pc speaker :-)

kjteng
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question