public class SpeechSynthesis extends Object implements Synthesizer
MediaPlayer
.Modifier and Type | Method and Description |
---|---|
void |
addMarkerCallback(MarkerCallback mc) |
void |
addMeta(MetaType type,
String value)
Add meta value to synthesizer
|
void |
addOptionalCommand(String command,
String parameter)
Specify additional parameters to send to the server.
|
void |
addVisemeCallback(VisemeCallback mc) |
void |
cancel() |
void |
clearOptionalCommand()
Clears optional parameters.
|
byte[] |
downloadByteArray(String text) |
int |
getCurrentPosition() |
static SpeechSynthesis |
getInstance(Activity callingActivity) |
static SpeechSynthesis |
getInstance(Context context,
Activity callingActivity)
Gets an instance of the iSpeech Speech Synthesis class.
|
MarkerHolder |
getMarkerHolder() |
boolean |
getMarkerHolderReady() |
MarkerHolder |
getMarkerInfo(String text,
String voice,
String speed,
String format) |
org.ispeech.core.TTSEngine |
getTTSEngine() |
VisemeHolder |
getVisemeInfo(String text,
String voice,
String speed,
String format)
Returns a VisemeHolder Object that contains all the information for a viseme animation for a given text.
|
void |
setConnectionTimeout(int timeout)
Set connection timeout in milliseconds for HTTP connections
|
void |
setSpeakWhenSilent(boolean alwaysSpeak)
Sets SDK so that TTS will always speak, regardless of whether the user has device on silent or not.
|
void |
setSpeechSynthesisEvent(SpeechSynthesisEvent speechSynthesisEvent)
TODO :: this method needs to be renamed to registerSpeechSynthesisEventListener (or addSpeechSynthesisEventListener) has to correspond with
unregisterSpeechSynthesisEventListener(SpeechSynthesisEvent)
See SpeechSynthesisEvent |
void |
setStreamType(int streamType)
Sets streamType to be used by SDK.
|
void |
setUpMarkers(String ttsText) |
void |
setUpVisemes(String ttsText) |
void |
setVoiceType(String voiceType)
Set the voice type
|
void |
speak(String text)
Converts text to speech and begins playing it as soon as it is ready,
method does not block.
|
void |
stop()
Stops the currently playing audio.
|
void |
toDisableTheDialogContact_salesATiSpeechDOTorg()
To disable loading dialogs and prompts please contact sales@iSpeech.org
|
void |
unregisterSpeechSynthesisEventListener(SpeechSynthesisEvent speechSynthesisEvent) |
public org.ispeech.core.TTSEngine getTTSEngine()
public static SpeechSynthesis getInstance(Context context, Activity callingActivity) throws InvalidApiKeyException
context
- Context objectcallingActivity
- isProduction
- Set to true to specify that this application is in production mode. Set to false to use the sandbox servers. Your key must be provisioned for production use in order to deploy your application.InvalidApiKeyException
- If the key is null or invalid.public VisemeHolder getVisemeInfo(String text, String voice, String speed, String format) throws InvalidApiKeyException
text
- text for viseme informationvoice
- voice to be used for viseme information, ie usenglishfemalespeed
- speed to be used for viseme information ie 3format
- format that speech spoken is downloaded as (mp3 or wav)InvalidApiKeyException
public MarkerHolder getMarkerInfo(String text, String voice, String speed, String format) throws InvalidApiKeyException
InvalidApiKeyException
public static SpeechSynthesis getInstance(Activity callingActivity) throws InvalidApiKeyException
InvalidApiKeyException
public void toDisableTheDialogContact_salesATiSpeechDOTorg()
public void setStreamType(int streamType)
streamType
- sets stream type ie. AudioManager.STREAM_SYSTEM (int value 1) or AudioManager.STREAM_MUSIC (int value 3)public void setSpeakWhenSilent(boolean alwaysSpeak)
alwaysSpeak
- set to TRUE to have SDK always speak. set to FALSE to have SDK stay silent if device is silent.public byte[] downloadByteArray(String text) throws BusyException, NoNetworkException
BusyException
NoNetworkException
public void speak(String text) throws BusyException, NoNetworkException
speak
in interface Synthesizer
text
- The text to convert into audio.BusyException
NoNetworkException
public void setSpeechSynthesisEvent(SpeechSynthesisEvent speechSynthesisEvent)
unregisterSpeechSynthesisEventListener(SpeechSynthesisEvent)
See SpeechSynthesisEvent
public void unregisterSpeechSynthesisEventListener(SpeechSynthesisEvent speechSynthesisEvent)
public void setVoiceType(String voiceType)
voiceType
- public int getCurrentPosition()
public void stop()
stop
in interface Synthesizer
Synthesizer.stop()
public void cancel()
public void setConnectionTimeout(int timeout)
timeout
- public void addMeta(MetaType type, String value)
addMeta
in interface Synthesizer
type
- value
- public void addOptionalCommand(String command, String parameter)
Synthesizer
addOptionalCommand
in interface Synthesizer
public void clearOptionalCommand()
Synthesizer
clearOptionalCommand
in interface Synthesizer
public void addMarkerCallback(MarkerCallback mc)
public void addVisemeCallback(VisemeCallback mc)
public void setUpMarkers(String ttsText)
public void setUpVisemes(String ttsText)
public boolean getMarkerHolderReady()
public MarkerHolder getMarkerHolder()