<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate(self, chars):
 """Generate audio CAPTCHA data. The return data is a bytearray. :param chars: text to be generated. """

        if not self._cache:
            self.load()
        body = self.create_wave_body(chars)
        return patch_wave_header(body)