def send_audio_packet(self, data, *, encode=True):
self.checked_add('<STR_LIT>', <NUM_LIT:1>, <NUM_LIT>)<EOL>if encode:<EOL><INDENT>encoded_data = self.encoder.encode(data, self.encoder.SAMPLES_PER_FRAME)<EOL><DEDENT>else:<EOL><INDENT>encoded_data = data<EOL><DEDENT>packet = self._get_voice_packet(encoded_data)<EOL>try:<EOL><INDENT>self.socket.sendto(packet, (self.endpoint_ip, self.voice_port))<EOL><DEDENT>except BlockingIOError:<EOL><INDENT>log.warning('<STR_LIT>', self.sequence, self.timestamp)<EOL><DEDENT>self.checked_add('<STR_LIT>', self.encoder.SAMPLES_PER_FRAME, <NUM_LIT>)<EOL>
Sends an audio packet composed of the data.

        You must be connected to play audio.

        Parameters
        ----------
        data: bytes
            The :term:`py:bytes-like object` denoting PCM or Opus voice data.
        encode: bool
            Indicates if ``data`` should be encoded into Opus.

        Raises
        -------
        ClientException
            You are not connected.
        OpusError
            Encoding the data failed.