Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PC Speakers

Posted on 1998-06-08
8
Medium Priority
?
530 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 60 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

661 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