Friday 26 May 2017

C program to create music like sa re ga ma pa

C program to create music like sa re ga ma pa 

Hello friends its very interesting to produce sound in a programming language like c language .
While playing with C language programs and some function and also frequencies i found some  unique things .I learnt how to produce sounds of some known frequencies and then I succeeded in producing the music sa re ga ma pa .To produce this music it requires a little bit knowledge of some functions for example delay()  and beep() .
First of all we learn about these two functions ..
1.Delay -This function is used to stop execution of the program for some time .

Declaration- void delay(unsigned miliseconds);

we provide the argument as integer in the term of milisecond to just stop the execution of the program for the time.

We will use this function and another two sound () and nosound() while working with Turbo C++ IDE .

2.Beep() - This function is provided by the headerfile windows.h ,so this is frequently used by the latest working IDEs with mingw compilers.

It takes two arguments the first one is frequency and the second one is duration to produce the sound.

Now we are good go to the source code to create a music like saa re ga ma pa

 #include<stdio.h>
#include<windows.h>
int main()
{
    Beep(314,1500);
    Beep(350,1500);
    Beep(390,1500);
    Beep(467,1500);
    Beep(526,1500);
    Beep(624,1500);
    Beep(314,2000);

     Beep(314,500);
    Beep(350,500);
    Beep(390,500);
    Beep(467,500);
    Beep(526,500);
    Beep(624,500);
    Beep(314,500);

    return 0;

}

These are the frequencies that produce sa re ga ma pa music ...
So, I hope you enjoyed this post .
Feel free to comment  ,share and and like...

11 comments:

  1. Thank you for this wonderful post. It is very impressive.

    C C++ Training in Chennai | C Language Training in Chennai

    ReplyDelete
  2. I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing. Latest naija songs

    ReplyDelete
  3. In reality, very few professional musicians have music degrees because they simply never needed them. buyrealplays

    ReplyDelete
  4. I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... Young Artist

    ReplyDelete
  5. You guardians do an astounding web diary, and have some unfathomable substance. Continue doing extraordinary. Bollywood Song Lyrics

    ReplyDelete
  6. We have sell some products of different custom boxes.it is very useful and very low price please visits this site thanks and please share this post with your friends. Niaja Gist

    ReplyDelete
  7. There is definately a great deal to know about this subject. I like all of the points you've made. www.tiktokfansguide.com

    ReplyDelete
  8. I respect this article for the very much investigated substance and magnificent wording. I got so included in this material that I couldn't quit perusing. I am awed with your work and aptitude. Much obliged to you to such an extent. www.slickpizza.com

    ReplyDelete

How to implement Facebook audience network banner ad in android app using Android Studio

Its very simple to implement Facebook audience network banner ad in android app using Android Studio. We will complete it in 4 Steps. 1. ...