SOUND FUNCTIONS in C

Sathya Priya N
2 min readJul 14, 2021

--

Hi everyone;

In this article, we are going to learn about the sound functions in C program and how we can use them with the help of our pre-defined functions — dos.h header file.

Sound() and nosound() function:

The sound() is very useful function as it can create very nice music with the help of programming and our user can enjoy music during working in out the program.Our system can create various sounds on different frequencies.

Syntax: Sound ( );

The delay function has been used in this function to delay for the next sound.

Syntax: delay ( );

The Second thing is the nosound function, which simply silent the system.

Syntax: nosound( );

These functions are from file dos.h, which should be included in the program.

Beep Function:

The Beep function in C is used to make a Beep sound. It generates a tone on the speaker. The function is synchronous.

syntax:

Beep(x,y);

Parameters: This method accepts two parameters:

  • x: which is the frequency of sound
  • y: which is the duration in ms till sound is ON.

The header file for this is #include <windows.h>

Sleep function:

The function sleep gives a simple way to make the program wait for a short interval.

Syntax:

Sleep();

The sleep, it is declared as <unistd. h> in UNIX & for windows #include<windows.h> ,is a non-standard function.

Thank you,

Sathya Priya N

--

--

Sathya Priya N
Sathya Priya N

Written by Sathya Priya N

Embedded Engineer| Electronics| Embedded systems| PCB| Hardware|

No responses yet