"Keyboard" is a simple project made using computer programming language. I have integrated every components of the code inside the main function. The bad part of this project is that the time of sound that is played is constant to it is obvious that there will be defect in timing. As I have used delay(250); for determination of time of play, sound is produced for one fourth of a second. The good part is that you can change 250 to any time you think is suitable. Remember the time placed inside delay function is in millisecond not in second.
This code is compatible with TURBO C++ compiler only.
How to download the source code?
- Click here for source code.
- New window will open where there is a source code of this project. You can download that code.
- Remember to run this code in Turbo C++ compiler.
Demo of the project
Check out the following video for the demo of this project.
Development platform
Computer programming language has been used to develop this project.
Compiler
Turbo C has been used as compiler. The compiler version for Turbo C that is used is 3.7.8.9 which is also the latest one.
Header files used
The header files used in this project are as follows :
- Conio
- Dos
- Graphics
- Stdio
- Stdlib
Library functions used
The following library functions has been used
- Under conio header file
- Clrscr
- Getch
- Under dos header file
- Delay
- Nosound
- Sound
- Under graphics header file
- Closegraph
- Floodfill
- Initgraph
- Line
- Outtextxy
- Rectangle
- Setfillstyle
- Setcolor
- Under stdio header file
- Library function 1
- Under stdlib header file
- Exit
Concepts used
Topics/ concepts of this language that you need to know for making this type of game :
- For loop looping statement
- Graphics
- Switch case statement
Code logic
The duration time of sound that is played is constant which is the bad part of this project. Hence, it is obvious that there will be defect in timing. As 250 millisecond has been used for determination of duration of playtime of each note, sound is produced for one fourth of a second. The pros part is that you can change 250 to any time value you think is suitable. Remember the time placed inside delay function is in millisecond not in second.
The most important task in this project was to produce musical notes. I used following frequencies as parameter for sound function in this project.
Musical Note | Frequency | Frequency |
C | 523.3 | 1047 |
C# | 554.4 | 1109 |
D | 587.3 | 1175 |
D# | 622.3 | 1245 |
E | 659.3 | 1319 |
F | 698.5 | 1397 |
F# | 740.0 | 1480 |
G | 784.0 | 1568 |
G# | 830.6 | 1661 |
A | 880.6 | 1760 |
A# | 932.3 | 1865 |
B | 987.8 | 1976 |
No comments:
Post a Comment