public class Polly extends AbstractSpeechSynthesis implements AudioListener
Modifier and Type | Field and Description |
---|---|
boolean |
credentialsError |
static org.slf4j.Logger |
log |
cfgDir, dnaPool, MESSAGE_RECORDING_FORMAT_BINARY, MESSAGE_RECORDING_FORMAT_XML
Constructor and Description |
---|
Polly(java.lang.String n) |
Modifier and Type | Method and Description |
---|---|
void |
addEar(SpeechRecognizer ear) |
byte[] |
cacheFile(java.lang.String toSpeak,
com.amazonaws.services.polly.model.OutputFormat format) |
java.lang.String |
getLanguage() |
java.util.List<java.lang.String> |
getLanguages() |
java.lang.String |
getLocalFileName(SpeechSynthesis provider,
java.lang.String toSpeak,
java.lang.String audioFileType) |
static ServiceType |
getMetaData()
This static method returns all the details of the class without it having
to be constructed.
|
java.lang.String |
getVoice() |
java.util.List<java.lang.String> |
getVoices() |
float |
getVolume() |
void |
interrupt()
Interrupt the current speaking.
|
static void |
main(java.lang.String[] args) |
void |
onAudioEnd(AudioData data) |
void |
onAudioStart(AudioData data) |
void |
onRequestConfirmation(java.lang.String text) |
java.lang.String |
publishEndSpeaking(java.lang.String utterance)
stop callback for speech synth.
|
java.lang.String |
publishStartSpeaking(java.lang.String utterance)
start callback for speech synth.
|
void |
setKey(java.lang.String keyId,
java.lang.String keyIdSecret) |
void |
setLanguage(java.lang.String l) |
boolean |
setVoice(java.lang.String voice) |
void |
setVolume(float volume) |
AudioData |
speak(java.lang.String toSpeak)
Begin speaking something and return immediately
|
boolean |
speakBlocking(java.lang.String toSpeak)
Begin speaking and wait until all speech has been played back/
|
void |
startService() |
attach, attachTextPublisher, detach, detachTextPublisher
addListener, addListener, addTask, addTask, addTask, addTaskOneShot, allowDisplay, allowDisplay, attach, broadcastState, buildDna, buildDna, buildDnaKeys, buildDnaNames, clearLastError, close, containsTask, copyShallowFrom, createPeer, createPeer, createRootReserved, detach, detach, echoHeartbeat, error, error, error, getAttached, getCfgDir, getComm, getDeclaredMethodNames, getDeclaredMethods, getDescription, getDna, getDnaString, getHostName, getInbox, getInstanceId, getIntanceName, getInterfaceSet, getLastError, getMessageSet, getMetaData, getMethodMap, getMethodNames, getMethods, getMethodToolTip, getMsg, getName, getNotifyList, getNotifyListKeySet, getOutbox, getPeerKey, getPeerName, getServiceResourceFile, getSimpleName, getTasks, getThisThread, getType, hasError, hasPeers, help, help, in, info, info, invoke, invoke, invoke, invokeOn, isAttached, isAttached, isLocal, isReady, isRunning, isRuntime, isVirtual, load, load, logTimeEnable, mergeDna, mergeDna, mergePeerDna, movePeerDna, out, out, preProcessHook, preRoutingHook, publishError, publishQueueStats, publishState, publishStats, publishStatus, purgeTask, purgeTasks, releasePeers, releaseService, removeAllListeners, removeListener, requiresSecurity, reserve, reserve, reserveRoot, reserveRoot, reserveRootAs, run, save, save, save, send, send, send, send, sendBlocking, sendBlocking, sendBlocking, sendBlocking, sendPeer, setInstanceId, setName, setPeer, setSecurityProvider, setState, setThisThread, setVirtual, sleep, stackToString, startHeartbeat, startPeer, startPeer, startRecording, stopHeartbeat, stopMsgRecording, stopService, subscribe, subscribe, subscribe, toString, unsubscribe, unsubscribe, unsubscribe, updateStats, warn, warn
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getName
public static final org.slf4j.Logger log
public boolean credentialsError
public void setKey(java.lang.String keyId, java.lang.String keyIdSecret)
public java.util.List<java.lang.String> getVoices()
getVoices
in interface SpeechSynthesis
public boolean setVoice(java.lang.String voice)
setVoice
in interface SpeechSynthesis
public void setLanguage(java.lang.String l)
setLanguage
in interface SpeechSynthesis
public java.lang.String getLanguage()
getLanguage
in interface SpeechSynthesis
public java.util.List<java.lang.String> getLanguages()
getLanguages
in interface SpeechSynthesis
public byte[] cacheFile(java.lang.String toSpeak, com.amazonaws.services.polly.model.OutputFormat format) throws java.io.IOException
java.io.IOException
public AudioData speak(java.lang.String toSpeak) throws java.lang.Exception
SpeechSynthesis
speak
in interface SpeechSynthesis
toSpeak
- - the string of text to speak.java.lang.Exception
- epublic java.lang.String publishStartSpeaking(java.lang.String utterance)
AbstractSpeechSynthesis
publishStartSpeaking
in interface SpeechSynthesis
publishStartSpeaking
in class AbstractSpeechSynthesis
utterance
- textpublic java.lang.String publishEndSpeaking(java.lang.String utterance)
AbstractSpeechSynthesis
publishEndSpeaking
in interface SpeechSynthesis
publishEndSpeaking
in class AbstractSpeechSynthesis
utterance
- textpublic void onAudioStart(AudioData data)
onAudioStart
in interface AudioListener
public void onAudioEnd(AudioData data)
onAudioEnd
in interface AudioListener
public boolean speakBlocking(java.lang.String toSpeak) throws java.lang.Exception
SpeechSynthesis
speakBlocking
in interface SpeechSynthesis
toSpeak
- - the string of text to speak.java.lang.Exception
- epublic void setVolume(float volume)
setVolume
in interface SpeechSynthesis
public float getVolume()
getVolume
in interface SpeechSynthesis
public void interrupt()
SpeechSynthesis
interrupt
in interface SpeechSynthesis
public java.lang.String getVoice()
getVoice
in interface SpeechSynthesis
public java.lang.String getLocalFileName(SpeechSynthesis provider, java.lang.String toSpeak, java.lang.String audioFileType) throws java.io.UnsupportedEncodingException
getLocalFileName
in interface SpeechSynthesis
java.io.UnsupportedEncodingException
public void addEar(SpeechRecognizer ear)
addEar
in interface SpeechSynthesis
public void onRequestConfirmation(java.lang.String text)
onRequestConfirmation
in interface SpeechSynthesis
public static ServiceType getMetaData()
public void startService()
startService
in interface ServiceInterface
startService
in class Service
public static void main(java.lang.String[] args)