Probably a loose halyard (line used for raising a sail) banging against the mast. I've been awakened late at night and forced to go out on deck in the rain to fix that myself.