push_red_to_talk.py
def gen_converse_requests(self):
        """Yields: ConverseRequest messages to send to the API."""

        converse_state = None
        if self.conversation_state:
            logging.debug('Sending converse_state: %s',
                          self.conversation_state)
            converse_state = embedded_assistant_pb2.ConverseState(
                conversation_state=self.conversation_state,
            )
        config = embedded_assistant_pb2.ConverseConfig(
            audio_in_config=embedded_assistant_pb2.AudioInConfig(
                encoding='LINEAR16',
                sample_rate_hertz=self.conversation_stream.sample_rate,
            ),
            audio_out_config=embedded_assistant_pb2.AudioOutConfig(
                encoding='LINEAR16',
                sample_rate_hertz=self.conversation_stream.sample_rate,
                volume_percentage=self.conversation_stream.volume_percentage,
            ),
            converse_state=converse_state
        )
        # The first ConverseRequest must contain the ConverseConfig
        # and no audio data.
        yield embedded_assistant_pb2.ConverseRequest(config=config)
        for data in self.conversation_stream:
            # Subsequent requests need audio data, but not config.
            yield embedded_assistant_pb2.ConverseRequest(audio_in=data)
Yields: ConverseRequest messages to send to the API.
ConverseRequest messages to send to the API.
ConverseRequest messages to send to the API .
def gen_converse_requests(self):
        converse_state = None
        if self.conversation_state:
            logging.debug('Sending converse_state: %s',
                          self.conversation_state)
            converse_state = embedded_assistant_pb2.ConverseState(
                conversation_state=self.conversation_state,
            )
        config = embedded_assistant_pb2.ConverseConfig(
            audio_in_config=embedded_assistant_pb2.AudioInConfig(
                encoding='LINEAR16',
                sample_rate_hertz=self.conversation_stream.sample_rate,
            ),
            audio_out_config=embedded_assistant_pb2.AudioOutConfig(
                encoding='LINEAR16',
                sample_rate_hertz=self.conversation_stream.sample_rate,
                volume_percentage=self.conversation_stream.volume_percentage,
            ),
            converse_state=converse_state
        )
        yield embedded_assistant_pb2.ConverseRequest(config=config)
        for data in self.conversation_stream:
            yield embedded_assistant_pb2.ConverseRequest(audio_in=data)
def gen_converse_requests ( self ) : converse_state = None if self . conversation_state : logging . debug ( 'Sending converse_state: %s' , self . conversation_state ) converse_state = embedded_assistant_pb2 . ConverseState ( conversation_state = self . conversation_state , ) config = embedded_assistant_pb2 . ConverseConfig ( audio_in_config = embedded_assistant_pb2 . AudioInConfig ( encoding = 'LINEAR16' , sample_rate_hertz = self . conversation_stream . sample_rate , ) , audio_out_config = embedded_assistant_pb2 . AudioOutConfig ( encoding = 'LINEAR16' , sample_rate_hertz = self . conversation_stream . sample_rate , volume_percentage = self . conversation_stream . volume_percentage , ) , converse_state = converse_state ) yield embedded_assistant_pb2 . ConverseRequest ( config = config ) for data in self . conversation_stream : yield embedded_assistant_pb2 . ConverseRequest ( audio_in = data )
Yields: ConverseRequest messages to send to the API.
Yields : ConverseRequest messages to send to the API .
"""Yields: ConverseRequest messages to send to the API.""" # The first ConverseRequest must contain the ConverseConfig # and no audio data. # Subsequent requests need audio data, but not config.
self