Solved

sound in delphi

Posted on 1998-02-16
3
356 Views
Last Modified: 2010-04-04
Is there a way to program sound in Delphi in a manner similar to the Pascal line: "sound(frequency)" followed by
"nosound"  ?? I do not want to use *.wav type files.
0
Comment
Question by:casal
[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
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 50 total points
ID: 1359383
Yep, there is :

Found them some time ago on the net,

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
 

Author Comment

by:casal
ID: 1359384
Thanks!
ZifNab saved my life.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1359385
Woow, saved your life? Was it so badly needed?

Pitty, I don't live in Zurich.

c.u. Zif.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
find a node in VST 2 92
enhance the following code 3 53
Firemonkey allowing RTL on android 6 77
With Delphi XE10, how to use .Manifest file on WIndows 10 Machines 3 62
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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

738 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