An ambitious project involving wireless transmission and music


I've recently finished working my way through the Arduino starter kit's project book and am looking to embark on my first big project which would involve 2 things that i'm interested in and am looking to explore further, namely wireless transmission(wi-fi/bluetooth and music/audio).

I'm currently thinking of a making my Arduino Uno a wireless keyboard with keys(buttons) that play a musical note that corresponds to the key currently pressed. After doing some googling with regards to the project's requirements, i've concluded that i will need a means of wireless communication( xBee / Wireless SD Shield?) to communicate with my computer, and a MP3 musical library containing the musical notes.

From my googling, i found some tables containing the specific frequencies corresponding to musical notes, so all i need now is a method of producing the frequencies via speakers. Assuming that my speakers are connected to my laptop, or are wireless speakers(which i hope to eventually use) , how would i go about generating the frequencies for the musical notes, the highest of which go up to the range of 8000Hz?

Any opinions and/or advice would be GREATLY appreciated!


Ok, first, use the Arduino as input only. Don't do any sound generating or anything else from the Arduino. It's goal is soley to take the key inputs and transmit them. I'm assuming you want to be able to handle polyphonic inputs (multiple keys pressed at the same time), so you'll need to transmit key down and key up for each of your instrument keys.

On the receiving end, either using a module that connects directly to the computer or another Arduino connected to the computer, you receive the key down and key up events and you send them to the computer via serial (USB cable). You will need to write a software program on the computer to process the serial messages. You will want to keep your serial protocol SMALL so that it can process quickly without having to read a lot of data. This is probably overkill, but you could get away with using a single byte of data to indicate which key you are sending and whether the key is pressed or released. Since a byte can handle 256 values, you can split this in half. 0-127 = key down, 128 - 255 = key up. So if you see byte 0x00, this means key 0 has been pressed. If you see byte 0x80 (128 in decimal), this means key 0 has been released. If you see 0x01, this means key 1 was pressed. If you see 0x81 (129 in decimal), this means key 1 was released.

Now your software will can start and stop the different sounds based on the data coming in. Not sure MP3 is the right technology to use, by the way. The issue will be trying to decode and play multiple MP3 files simultaneously. An MP3 has to be decoded as it is read, and there's some overhead to this. What is more common is using .WAV files which are not compressed. It's also much easier to change the pitch of a .WAV file than it is to change the pitch of a MP3 file. I would recommend maybe checking out the DirectSound library from Microsoft's DirectX, or maybe try using the OpenAL audio library.

From what I know of mp3, I don't think that it defines music by notes like a musicalscore and what it does do is likely to take a lot more memiry than is present on any of the arduinos. Try looking up "midi".