TsgcAIOpenAITranslatorMethods › Stop

Stop Method

Stops the audio recorder and triggers the translation of the captured audio through the OpenAI Whisper API.

Syntax

procedure Stop;

Remarks

Invokes AudioRecorder.Stop to finalize the audio file. The recorder's stop notification fires OnAudioStop and then, inside the translator pipeline, the captured file is sent to the OpenAI Whisper endpoint using the model specified by TranslatorOptions.Translation.Model. When the API returns the translation, OnTranslation fires with the translated text and a variable Accept flag; if Accept remains True and a TextToSpeech component is assigned, the text is spoken aloud. Calling Stop without a prior Start is safe — the assigned recorder simply ignores the request.

Example

sgcTranslator.Start;
// ... user finishes speaking
sgcTranslator.Stop;
// OnTranslation will fire with the translated text

Back to Methods