simulstream.server.speech_processors.remote.http_proxy_speech_processor

Classes

HttpProxySpeechProcessor(config)

HTTP-based proxy implementation of SpeechProcessor.

class simulstream.server.speech_processors.remote.http_proxy_speech_processor.HttpProxySpeechProcessor(config)

HTTP-based proxy implementation of SpeechProcessor.

This class does not perform speech processing locally. Instead, it forwards all method calls to a remote speech processor exposed via HTTP, maintaining a dedicated session on the server side.

Each instance of this class corresponds to exactly one remote session.

clear()

Clear internal states, such as history of cached audio and/or tokens, in preparation for a new stream or conversation.

end_of_stream() IncrementalOutput

This method is called at the end of audio chunk processing. It can be used to emit hypotheses at the end of the speech to conclude the output.

Returns:

The incremental output (new and deleted tokens/strings).

Return type:

IncrementalOutput

classmethod load_model(config)

Load and initialize the underlying speech model.

Parameters:

config (SimpleNamespace) – Configuration of the speech processor.

process_chunk(waveform: float32) IncrementalOutput

Process a chunk of waveform and produce incremental output.

Parameters:

waveform (np.float32) – A 1D NumPy array of the audio chunk. The array is PCM audio normalized to the range [-1.0, 1.0] sampled at simulstream.server.speech_processors.SAMPLE_RATE.

Returns:

The incremental output (new and deleted tokens/strings).

Return type:

IncrementalOutput

set_source_language(language)

Set the source language for the speech processor.

Parameters:

language (str) – Language code (e.g., "en", "it").

set_target_language(language)

Set the target language for the speech processor (for translation).

Parameters:

language (str) – Language code (e.g., "en", "it").

property speech_chunk_size: float

Return the size of the speech chunks to be processed (in seconds).

tokens_to_string(tokens: List[str]) str

Converts token sequences into human-readable strings.

Returns:

The textual representation of the tokens.

Return type:

str