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...

Saturday, 20 May 2017

How to configure graphics.h header file in codeblocks IDE within few steps

How to configure graphics.h header file in codeblocks IDE within few steps

I have searched a lot on internet and gone through a lots of tutorials and posts but neither of them was working correctly  even if on youtube one can file a lots of videos about how to configure and add graphics.h header file in codeblocks but they are not working in most of the cases.The reason was buggy graphics.h header file.So searching on the internet I succeeded to find out the buggy graphics.h header file and got success in configuring the graphics.h header file successfully with codeblocks.
So its good to go with the steps.

Step-1.Download the file from here and extract it.
                                                           Download now

Step-2.copy graphics.h and winbgim.h and paste it in the include folder  where your codeblocks is installed.
for example: (C:\Program Files (x86)\CodeBlocks\MinGW\include).

Step-3.Now copy the libbgi.a file to the lib folder near to the include folder
for example: (C:\Program Files (x86)\CodeBlocks\MinGW\lib).

step-4:The second last step is to go to Setting->compiler then linker setting.
You can find two boxes named Link Libraries and Other Linker Options.
Then you can find and add button in Link Libraries Just click on add and brows and select the file libbgi.a that we have pasted in lib folder in step 3.

step-5 :The last and important step is the linker command that we have to write in the linker box which is in the right side of Linker Libraries .
Paste these commands in that box as it is.

-lbgi

-lgdi32

-lcomdlg32

-luuid

-loleaut32

-lole32

 Thats it we have successfully configured the codeblock with graphics.h.
Now enjoy coding..........

Insert image in c using codeblocks

WhatsApp will give Rs 1.8 crores to new Indian startups, Here is all you need to know

The "Startup India WhatsApp Grand Challenge" has been appraise growth in the entrepreneurial sector. Total prize money of Rs 1.8...