Play midi file from arduino web page.

I have created a web server that turns a table lamp on and off using a "hacked" wireless remote attached to a Uno running IDE 1.0.1. It has a feedback loop that uses a LDR to tell the user whether the lamp is on or off. I also have a LM35 sensor feeding temperature back to the web page. All of this is functioning as it should.

What I can't seem to do (and I didn't think that is would be such a problem) is have an html button that would play a small midi file (about 15k) when pressed. I would like to read the file from the ethernet shield's sd card and send it to the client. I have a basic understanding of switching from ethernet to sd function through control of pins 4 and 10 but can't seem to put all of the mechanics together so that it works.

Any help would be appreciated.

I would like to read the file from the ethernet shield's sd card and send it to the client.

Is the client going to know what to do with the data?

I have a basic understanding of switching from ethernet to sd function through control of pins 4 and 10 but can't seem to put all of the mechanics together so that it works.

Generally, the libraries handle making the appropriate SPI device active, so this should not be necessary. What have you written, so far? What does that code do that you don't want? What does it not do that you want?

Thanks PaulS...
I only want the midi tune to play on the client's device (pc, phone, etc) when they press the button on the web page.

I origianally tried to embed a mime copy of the tune in the sketch so that it would play when called by a button on the web page but couldn't get that to work. I then tried to call it from the sd card in its original ".mid" format. Things got too muddy and I deleted that section. I'm going to start fresh today and try to develop the "enable sd, read file, enable ethernet, send to client upon request" sections one-at-a-time and watch my progress with serial messages.

I spent a lot of time looking for an example of this code and have so far turned up nothing. Does anyone have an example of the above?

What you need is a simple webserver on your Arduino, that serves what's on the SD card. Here is a project doing that:

http://code.google.com/p/webduino/