SmartAudioTTSAdapter
Wisej.AI.Adapters.SmartAudioTTSAdapter
Namespace: Wisej.AI.Adapters
Assembly: Wisej.AI (3.5.0.0)
Converts the Text of the associated Audio control into lifelike speech.
public class SmartAudioTTSAdapter : SmartAdapter
This class works with the OpenAI TTS platform to generate audio from text. To use this adapter, set the Text property of the Audio control to the desired text. If AutoRun is true, the audio is generated automatically when the text changes. The input text is limited to 4096 characters. If AutoRun is false, call RunAsync with the Audio control to generate the audio. The generated audio file is saved in the AudioFilesPath directory at the root of the project. The file name is a combination of the Audio control's Name and a unique hash code, with the extension specified by AudioFormat.
Constructors
SmartAudioTTSAdapter()

Initializes a new instance of SmartAudioTTSAdapter.
Properties
AudioFilesPath

String: Gets or sets the path where audio files are stored. (Default: "~AI\AudioFiles"
)
The path should be relative to the application's root folder to allow the audio control to download the audio as a regular URL.
AudioFormat

String: Gets or sets the audio format for the generated speech. (Default: "mp3"
)
The default format is "mp3". Other available formats include "opus", "aac", "flac", and "pcm".
Speed

Single: Gets or sets the speed of the generated audio. (Default: 1
)
The speed can range from 0.25 to 4.0, with 1.0 as the default value.
Voice

String: Gets or sets the voice to use for speech synthesis. (Default: "Alloy"
)
The available voices are optimized for English. Supported voices include: Alloy (default), Echo, Fable, Onyx, Nova, and Shimmer. New voices can be used as they become available.
Methods
OnControlCreated(control)

OnControlDisposed(control)

RunAsyncCore(control)

Asynchronously generates audio from the text of the specified control.
Returns: Task<Message>. A task representing the asynchronous operation, with a Message result containing the response.
Throws:
ArgumentNullException Thrown if AudioFormat or Voice is null or empty.
Implements
Represents a provider that supplies tools.
Last updated