Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I am an Engineering student.I ought to do a project using c programming language.I have chosen to create a virtual piano . But I do not have a clear idea about coding.Can you please help me out? I would like to add a picture of piano on the keyboard and want to see the corressponding keys being pressed .I want to do it as an app.It should be colourful and attractive.

What I have tried:

Surfed in the Internet but could not find any code in C language.Also the cords which I got in other languages are full of errors.I discussed with my friends but unfortunately they are helpless in this concern.
Posted
Updated 14-Feb-18 0:45am
Comments
F-ES Sitecore 14-Feb-18 8:44am    
Wanting other people to do your work for you doesn't make you a student, it makes you a plagiarist.
Rick York 14-Feb-18 10:34am    
I have seen programs that work with MIDI on this site and part of what they do is display the keyboard. One of those will probably help you get started but I don't think they were written in C. I believe they were in C++.

Even without knowing your actual target OS, I guess the C programming language it is not the best choice for the job you depicted (for instance, on Windows, writing a full-fledged, attractive GUI, would be clumsy with C).
I suggest you to either change the development programming language (on Windows, I would consider C#) or the project.
 
Share this answer
 
You won't find any code that fits exactly what you want: and even if you could, that would be plagiarism, not "doing a project" - and most tutors are wise to that!.

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!

But ... You don't sound like you have much development experience here, and this isn't a job for a complete beginner: you are going to have to learn to code in C for a graphics environment (in order to draw the pictures) which in C probably means learning how to code in Windows - which is decidedly non-trivial!
If you can, find a simpler project, or change languages: C# would be a load easier to do this in as the initial learning curve is a lot less "brick wall" like than coding in C for Windows.
 
Share this answer
 
So if you really want to do the work of a seasoned programmer you need to learn programming. This needs some weeks of intensive learning to acquire the basic skills. You also should consider a higher level language like C# or Java - depending on your target platfrom.

For showing something on the screen normally is the use of bitmaps the best and easiest way. In your app: a "non pressed key bitmap, and when pressed than exchanged with a "pressed key" bitmap. Like bricks in a wall you show an array of these elements.

When I search with Google I had found this simple but good keyboard example in some seconds. (You only need to set suitable bitmaps on the buttons) Shame on you...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900