Jump to content

Mapping a sound to a keypress


mmcdermott18

Recommended Posts

I would like to create a website that functions in one of two ways. 1. If you press a given key a sound plays. So pressing 'a' would play one sound and 't' would play another and so on. Sort of like some instruments are played on the computer. 2. There is an input box that you can type numbers and letters and once enter is pressed that string is translated into a string of sounds. Typing 'abtdescn' would give one combination of sounds while pressing '3fws9fs' would give you a different one but each character is a specific sound. I have searched around and found a few things that seem to be in the direction I want to go but nothing explicit enough for me to follow. Something like this although I think this was built in flash? http://www.virtualmusicalinstruments.com/piano Thanks.

Link to comment
Share on other sites

Yes, that's Flash. Doing it in Javascript would require a whole lot of <audio> elements to be created, each with a different sound file. Then you'd need a system of timing and events. It's pretty complicated to build.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...