Skip to content

API Doc

Ulysses Wu edited this page Jul 16, 2021 · 4 revisions

The term "App" is used to represent VOICEROID2 or A.I.VOICE.

TtsControl

Methods

public string[] GetAvailableHostNames()

Get all available service names - that is, your installed VOICEROID2 products.

return: Ususally, it returns VOICEROID2 (x64) VOICEROID2, sometimes with A.I.VOICE.

public void Initialize(string serviceName)

Call before any methods below to initialize.

serviceName: can be one of VOICEROID2 (x64) VOICEROID2 A.I.VOICE.

  • Currently VOICEROID2 is not tested.

public void StartHost()

Launch App (x64 or x86, depend on serviceName you specified in Initialize).

  • A.I.VOICE can not be launched with this method. Just launch by yourself.

public void TerminateHost()

Terminate App you launched with StartHost.

public void Connect()

Connect to App instance (x64 or x86, depend on serviceName you specified in Initialize).

public void Disconnect()

Disconnect. You can then Connect again.

public long GetPlayTime()

Estimate the time for current text in Textbox.

return: estimated time (ms).

see: (Property) Text

public void Play()

Synthesize and play the text in Textbox.

Can not be called when Busy.

see: (Property) Status; Text

public void Stop()

Stop play immediately.

Can not be called when Busy (Synthesizing).

see: (Property) Status

public void WriteWaveToFile(string path)

Write WAV file to the path.

The Text will also be written to a txt file if you have set output text setting.

Can not be called when Busy.

path: where to save the WAV file. The output text will be in the same position but with .txt extension.

see: (Property) Status

public void ReloadVoicePresets()

Reload Voice Presets. Useful if you want to set emotion parameters (manually) and call this later.

public void ReloadPhraseDictionary()

Reload Phrase Dictionary.

public void ReloadSymbolDictionary()

Reload Symbol Dictionary.

public void ReloadWordDictionary()

Reload Word Dictionary.

Properties

public HostStatus Status {get;}

Get current App status.

return: HostStatus, can be one of NotRunning NotConnected Idle Busy.

  • Many APIs are not callable when Status is Busy NotRunning NotConnected.

public bool IsInitialized {get;}

Get whether you have called Initialize successfully.

return: bool

public string Text {get; set;}

Get/Set current text in Textbox.

public int TextPosition {get; set;}

Get/Set caret (text cursor) position.

public int TextLength {get; set;}

Get/Set text length (to be played).

example: If you set TextLength to 1 and TextPosition to 2, when you call Play, it will play from the third character, and read just that character.

public string Version {get;}

Get App version.

return: version string, like 2.1.1.0

public string[] VoiceNames {get;}

Get all voice names.

return: voice names, like 結月ゆかり

public string[] VoicePresetNames {get;}

Get all voice preset names. Including voice names and your user-defined presets with custom parameters.

return: voice preset names, like 結月ゆかり, My Custom Yukari with 100% Sad

public string CurrentVoicePresetName {get; set;}

Get/Set current voice preset used.

When set, the voice is switched immediately. Can not be set when Busy.

return: current voice preset name

public MasterControl MasterControl {get; set;}

Used to control the Master settings, like Speed, Volume etc.

Do not try to set the properties by something like ttsControl.MasterControl.Volume = 1.1;. The correct way to do this is:

var control = ttsControl.MasterControl;
control.Volume = 1.1;
tts.MasterControl = control;

return: a MasterControl object