
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
How to play Beep sound through Console in C#?
To play beep sound through Console, the code is as follows −
Example
using System; public class Demo { public static void Main(String[] args){ Console.WriteLine("Displaying standard output stream..."); Console.WriteLine("Standard Output Stream = "+Console.Out); Console.WriteLine("Beep sound through Console"); Console.Beep(); } }
Output
This will produce the following output −
Displaying standard output stream... Standard Output Stream = System.IO.TextWriter+SyncTextWriter Beep sound through Console
Example
Let us now see another example −
using System; public class Demo { public static void Main(String[] args){ Console.WriteLine("Displaying standard output stream..."); Console.WriteLine("Standard Output Stream = "+Console.Out); Console.WriteLine("Beep sound through Console"); Console.Beep(); Console.WriteLine("Beep sound through Console with frequence 1000 hertz and duration 500 milliseconds"); Console.Beep(1000, 500); } }
Output
This will produce the following output −
Displaying standard output stream... Standard Output Stream = System.IO.TextWriter+SyncTextWriter Beep sound through Console Beep sound through Console with frequence 1000 hertz and duration 500 milliseconds
- Related Articles
- How to play user modified Beep sound through Console in C#?
- How to play sound using SoundPool in Kotlin?
- How to play an android notification sound?
- How to play a sound using Swift?
- How to play ringtone/alarm/notification sound in Android?
- How to play a notification sound on websites?
- How to get the Standard Input and Output Stream through Console in C#?
- How to play a custom ringtone/alarm sound in Android?
- How to play a custom sound on receiving notification in Android?
- How to play sound file in a web-page in the background?
- How to clear console in C?
- How to play sound even when an Android phone is in silent mode ?
- Getting the Standard Output and Standard Error Output Stream through Console in C#
- How to change BufferWidth of the Console in C#?
- How to change BufferHeight of the Console in C#?

Advertisements