472,347 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,347 software developers and data experts.

C# ...1 beep 1 second silence

I need to write a C# program that asks for a pattern and for each pattern beeps one and goes silence for 1 second.
This is my code:
for (int i=0;i< pattern; i++)
{
Console.Beep();
***************** //I have no idea what to put for 1 sec of silence


}

any suggestions???
Feb 19 '09 #1
3 4093
Plater
7,872 Expert 4TB
Try using Thread.Sleep()
Feb 19 '09 #2
tlhintoq
3,525 Expert 2GB
Be honest... This is a programming class homework assignment, right?
I'm going to guess the next step to the ambulance siren assignment

Posting guidelines about homework

How much looking around the internet have you done on this? How many different methods have you tried, before asking for help? Have you tried a google search for 'time delay' or 'wait loop' or 'time check' or 'time compare' etc.?

By the way a for loop counting the way you have won't get you 1 second of beeping. It will get you beeping for however long it takes that particular PC to count to your supplied number ("pattern"). A 1 GHz computer will beep 3 times longer than a 3 GHz computer, since it will take longer for it to count to the same maximum number.

You might want to look at DateTime objects. This way you can check the DateTime before you go into the loop, keep checking it while in the loop, and then break out of the loop when the current time is greater than the start time plus 1 second.

TIP: If you read the above paragraph like a word problem, it heavily hints at the code you would write to do it.
Feb 19 '09 #3
vekipeki
229 Expert 100+
@tlhintoq
I wouldn't say too much, since there is a sample in MSDN for Console.Beep that does the same thing:

http://msdn.microsoft.com/en-us/library/4fe3hdb1.aspx
Feb 20 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Leo | last post by:
hi there i want python to do a beep. in the docu i found in tkinter the method bell() but the script: import Tkinter Tkinter.bell() gives...
3
by: #Hai | last post by:
Hi, I want to throw out a series of 'beep..beep..beep' to the speaker. How to do that ? Thanks
5
by: Ike | last post by:
Is there wa way to make the system beep (ascii 007...bell) via javascript (or any other simple notification sound)? Thanks, Ike
4
by: Birchy | last post by:
Great quotes from the Roman playwright Terence... http://www.fallingskyhazard.com/catalog.htm As a person is so must you humor them. He...
2
by: Ferhat Akcin via .NET 247 | last post by:
Hi all, I have a picture box which blinking each quarter a second. Iwant to Beep() whenever it blinks. I tried the PInvoked Beepfunction, but it...
1
by: Sakharam Phapale | last post by:
Hi All, I am developing an application like sound recorder. While recording if there is a silence for more than given time (say 5...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
When I press the Enter key in a Textbox I get a beep sound. But when I press the Enter key in a combobox, I don't get the beep sound. Is there a...
3
by: carthia | last post by:
Hello All, I need to determine speaking time, but without pressing any button (such as start speaking/stop speaking), e.g. how long each...
6
by: Anz | last post by:
Is there any JavaScript function to generate a Beep sound from system ?, is it possible to make system Beep using JavaScript function ?
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.