This is very simple example code that shows how to send MSP messages in Java (the concept is nearly the epitome of portable). It is a static class w/static methods which you import and then call the appropriate methods and simply send the returned string straight to the client via whatever the server's method is of writing to the client. This does not account for telnet negotiation or a server's settings, it simply generates the string based on the input to the functions.
Mud Sound Protocol (MSP) spec - http://www.zuggsoft.com/zmud/msp.htm
*This method works, duh, with the MUSHClient msp plugin which simply triggers on the '!!SOUND' bit and parses the string, and plays the sound.