Copied from https://code.google.com/p/oscpack/ (by Ross Bencina)