Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
2.00/5 (3 votes)
See more:
how to generate an alarm in C# where frequence varied between 800hz/970hz and where the cycle is repeated 2 times every second
Posted
Comments
walterhevedeich 4-Aug-11 3:58am    
Care to expand your scenario?
[no name] 4-Aug-11 4:08am    
Explain more
OriginalGriff 4-Aug-11 4:19am    
How is your alarm connected? What kind of indication are you trying to give?
Smithers-Jones 4-Aug-11 12:35pm    
Repost!
Sergey Alexandrovich Kryukov 7-Aug-11 4:19am    
My fault (see my comment below) -- I already answered (second time) before I notices it is a re-post. Shame on naima naima -- the answers do solve the problem.

Thank you for this note and reporting.
--SA

I know much simpler way:

C#
for (int index=0; index<repetitions; ++index)
{
    System.Console.Beep(800, 250);
    System.Console.Beep(970, 250);
    //frequency (first parameter) and timing (second parameter) may vary :-)
}


Notes:

You did not explain the profile of frequency modulation; this is one of the simplest variants.

You may want to run it in a separate thread — it will work.

You don't need to make you application a console application. This code will run in any application.

—SA
 
Share this answer
 
v2
Comments
Espen Harlinn 7-Aug-11 11:19am    
Nice, small and elegant - my 5
Sergey Alexandrovich Kryukov 7-Aug-11 11:47am    
Thank you, Espen.
--SA
Kim Togo 8-Aug-11 8:10am    
Nice example. My 5.
Sergey Alexandrovich Kryukov 8-Aug-11 8:30am    
Thank you, Kim.
--SA
 
Share this answer
 
Has been discussed in this Question

Use of sampling frequency in C#[^]

might be helpful :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900