Last reviewed: 3/23/2024 10:14:42 AM
Selecting a Synthesizer
Since there may be more than one voice available on the system in which the application runs, you may want to integrate selection into the application.
Applications obtain an enumerated list of available voices and then select the desired voice by Name, ID, or ISO5Language.
for (JChantEngine engine : _Synthesizer.getChantEngines())
{
// Access engine properties
String name = engine.getName();
...
// If this is the desired engine, select it
_Synthesizer.setEngine(name);
break;
}
foreach (NChantEngine chantEngine in _Synthesizer.ChantEngines)
{
// Access engine properties
string name = chantEngine.Name;
...
// If this is the desired engine, select it
_Synthesizer.SetEngine(name);
break;
}
for (int i = 0; i < _Synthesizer->GetChantEngines()->GetCount(); i++)
{
CChantEngine* pChantEngine = _Synthesizer->GetChantEngines()->GetChantEngine(i);
// Access engine properties
wchar_t* engine = pChantEngine->GetName();
...
// If this is the desired engine, select it
_Synthesizer->SetEngine(engine);
break;
}
for (int i = 0; i < _Synthesizer->GetChantEngines()->Count; i++)
{
CChantEngine* pChantEngine = _Synthesizer->GetChantEngines()->GetChantEngine(i);
// Access engine properties
String engine = pChantEngine->GetName();
...
// If this is the desired engine, select it
_Synthesizer->SetEngine(engine);
break;
}
var
chantTTSEngine: TChantEngine;
name: string;
begin
for chantEngine in _Synthesizer.ChantEngines do
begin
// Access engine properties
name := chantTTSEngine.Name;
...
// If this is the desired engine, select it
_Synthesizer.SetEngine(name);
exit;
end;
end;
for (JChantEngine engine : _Synthesizer.getChantEngines())
{
// Access engine properties
String name = engine.getName();
...
// If this is the desired engine, select it
_Synthesizer.setEngine(name);
break;
}
NSArray<CSChantEngine*>* engines = [_synthesizer chantEngines];
if (engines != nil)
{
for (CSChantEngine* ce in engines)
{
// Access engine properties
NSString* name = [ce name];
...
// If this is the desired engine, select it
[_synthesizer setEngine:engine];
break;
}
}
let engines = _Synthesizer!.getChantEngines()
if (engines.count > 0)
{
enginelookup: for ce in engines
{
// Access engine properties
let name = ce.name
...
// If this is the desired engine, select it
_Synthesizer!.setEngine(name: name)
break enginelookup
}
}
Dim chantEngine As NChantEngine
Dim name As String
For Each chantEngine In _Synthesizer.ChantEngines
' Access engine properties
name = chantTTSEngine.Name
...
// If this is the desired engine, select it
_Synthesizer.SetEngine(name)
Exit
Next