473,387 Members | 1,290 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 4191
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 the error:
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 makes a great mistake... who supposes that authority...
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 blocks the thread. I am sure it is prettysimple, but...
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 seconds), Recording should be paused.
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 way to suppress the beep? How to do this? ...
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 person(microphone) was speaking during one meeting, and...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.