Library For Using Computer Keyboard As Midi Keyboard For Tone Generator

Hi there, I am new to both arduino and computer programming in general, though I have been getting my head round it fairly well (i think!). I have been prototyping two interconnected projects using the arduino simulator and am just ordering my first board, so I haven't actually played around with the physical stuff yet, just been testing code.

So my first of many inquiries is about using my computer keyboard to tell the arduino to play a certain note. I'm starting very basic, just using the build in tone gerarator, and I've programed the bottom two rows of letters to play an octave of notes. I have been trying to follow tutorials on how to create a library so I can dump all the keypress code into it, but I really don't understand it all.

So my two questions are this, firstly, has anybody already made a library that allows you to use a computer keyboard to control the frequency of tones produced (like a midi keyboard)?

If not, then can anyone talk me through how to turn my code into a library?

Code attached bellow, and thank you in advance!

Keyboard_Controlled_Tone_1.03_1_octive.ino (3.51 KB)

So my two questions are this, firstly, has anybody already made a library that allows you to use a computer keyboard to control the frequency of tones produced (like a midi keyboard)?

Not that I know of. It is not a MIDI keyboard in any stretch of the imagination by the way.

If not, then can anyone talk me through how to turn my code into a library?

I would get the code working as a normal sketch before you bother getting it into a library.

I am aware it is not a midi keyboard as it is not working with midi data, I just mean using the keys of a computer keyboard so the arduino responds as if it were responding to a midi keyboard or similar, ie z = C, s = C#, x = D, d = D#, c = E etc...

I have already got a sketch in which the keyboard does respond to it, in a very very simple fassion which i intend to improve, but I could do this after turning it into a library if i manage it.

Have you read this:-

and this:-

http://playground.arduino.cc/Code/Library

The first one I had, and couldn't work out how to translate that to the library I'm trying to create, hadn't found that second link though, that looks like it's well more in depth. I'll give that a good read and see how I get on.

Thanks very much!