simulstream.server.message_processor
Classes
|
This class is responsible for processing the messages incoming from a client, which include control messages (e.g., configurations about languages to use, or signal that the stream is over). |
- class simulstream.server.message_processor.MessageProcessor(client_id: int, speech_processor: SpeechProcessor)
This class is responsible for processing the messages incoming from a client, which include control messages (e.g., configurations about languages to use, or signal that the stream is over).
- clear()
Clear the internal states to be ready for a new input stream.
- end_of_stream() IncrementalOutput
Performs the last operations to conclude the processing of the stream of audio by the speech processor and cleans up everything to be ready for the next stream.
- Returns:
last output at the end of the stream.
- Return type:
- process_metadata(metadata: dict)
Takes a dictionary of metadata regarding the incoming speech and desired output, and interacts with the configured speech_processor to set it up accordingly.
- Parameters:
metadata (dict) – Dictionary of metadata regarding the incoming speech.
- process_speech(speech_data: bytes) IncrementalOutput | None
Process an audio chunk and return incremental transcription/translation. Namely, it receives and buffers raw audio chunks (
bytes) and processes audio audio incrementally with the configuredSpeechProcessor.- Parameters:
speech_data (bytes) – Raw PCM audio bytes (16-bit little endian).
- Returns:
incremental processing results, if any. None otherwise.
- Return type: