To send binary data, you will use the sendBin method, instead of send:
client->sendBin(soundData, soundDataSize,
"speaker = BIN %d raw 2 16000 16 1;",
soundDataSize);
The first two parameters are the binary data itself and the size. Then, the header, with optional parameters using a printf like syntax.
To send a sound, there is specialized method called sendSound, which is more convenient and also more efficient:
client->sendSound(sound, "endsound");
The first parameter is a USound structure, describing the sound to send. The second is an optional tag that will be used by the server to issue a "stop" system message when the sound has finished playing.
The function convert described in the documentation can be used to convert between various sound formats.
With sendSound, there is no limit to the size of the sound buffer, since it will be automatically cut into small chunks by the library. Since the data is copied by liburbi, the USound parameter and its associated data can be safely freed as soon as the function returns.