本文整理汇总了Java中marytts.exceptions.MaryConfigurationException类的典型用法代码示例。如果您正苦于以下问题:Java MaryConfigurationException类的具体用法?Java MaryConfigurationException怎么用?Java MaryConfigurationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MaryConfigurationException类属于marytts.exceptions包,在下文中一共展示了MaryConfigurationException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: say
import marytts.exceptions.MaryConfigurationException; //导入依赖的package包/类
public static void say(String comment) {
if (isSilenced) {
System.out.println(comment);
return;
}
try {
if (!inited) {
init();
}
if (comment.isEmpty()) return;
final AudioInputStream audio = marytts.generateAudio(comment);
final AudioPlayer player = new AudioPlayer(audio);
player.start();
} catch (MaryConfigurationException | SynthesisException e) {
logger.error("Error sythesizing text to voice", e);
}
}
示例2: openMaryTTS
import marytts.exceptions.MaryConfigurationException; //导入依赖的package包/类
/**
* Creates the connection to a Mary-TTS server or starts a local instantiation
* if no host is set
*/
void openMaryTTS()
{
if (serverHost.length()>0) // use a server or instantiate a local interface
{
try // server
{
marytts= new RemoteMaryInterface(serverHost, serverPort);
}
catch(IOException ioe) { Log.print(Log.ERROR, ioe.getMessage()); }
}else{
try // local
{
marytts = new LocalMaryInterface();
}
catch(MaryConfigurationException mce) { Log.print(mce); }
}
}
示例3: init
import marytts.exceptions.MaryConfigurationException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void init() {
for (Logger l : Collections.<Logger> list(LogManager.getCurrentLoggers())) {
l.setLevel(Level.OFF);
}
LogManager.getRootLogger().setLevel(Level.OFF);
try {
marytts = new LocalMaryInterface();
} catch (MaryConfigurationException e) {
e.printStackTrace();
}
Set<String> voices = marytts.getAvailableVoices();
System.out.println(voices);
marytts.setVoice(voice);
}
示例4: TextToSpeech
import marytts.exceptions.MaryConfigurationException; //导入依赖的package包/类
/**
* Constructor
*/
public TextToSpeech() {
try {
marytts = new LocalMaryInterface();
} catch (MaryConfigurationException ex) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex);
}
}
示例5: initMaryTTS
import marytts.exceptions.MaryConfigurationException; //导入依赖的package包/类
public void initMaryTTS() throws MaryConfigurationException {
log.debug("Initialiazing MaryTTS");
marytts = new LocalMaryInterface();
String voice = PROPERTIES.getVoice();
log.debug("Setting voice to: " + voice);
marytts.setVoice(voice);
String effects = SoundEffect.toMaryTTSString();
log.debug("Setting effects to: " + effects);
marytts.setAudioEffects(effects);
}
示例6: initSpeeker
import marytts.exceptions.MaryConfigurationException; //导入依赖的package包/类
private void initSpeeker() {
try {
speeker = new Speeker();
} catch (MaryConfigurationException e) {
log.error("Unable to start configure popular phrases dialog", e);
JOptionPane.showMessageDialog(PopularPhrasesConfigDialog.this, MESSAGES.get("init_marytts_error"),
MESSAGES.get("error"), JOptionPane.ERROR_MESSAGE);
}
}
示例7: initMaryTts
import marytts.exceptions.MaryConfigurationException; //导入依赖的package包/类
private void initMaryTts() {
try {
marytts = new LocalMaryInterface();
} catch (MaryConfigurationException e) {
JOptionPane.showMessageDialog(VoiceConfigurationDialog.this, MESSAGES.get("init_marytts_error"),
MESSAGES.get("error"), JOptionPane.ERROR_MESSAGE);
log.error("Unable to start marytts", e);
}
}
示例8: ApplicationWindow
import marytts.exceptions.MaryConfigurationException; //导入依赖的package包/类
public ApplicationWindow(Speeker speeker) throws MaryConfigurationException {
super(MESSAGES.get("client_window_title"));
this.speeker = speeker;
speeker.addEndOfSpeechListener(this);
speeker.addSpeechListener(this);
setDefaultCloseOperation(EXIT_ON_CLOSE);
if (PROPERTIES.isNativeHookEnabled()) {
initNativeHook();
}
initGui();
addWindowListener(new WindowOpenedListener());
}
示例9: initMaryTTS
import marytts.exceptions.MaryConfigurationException; //导入依赖的package包/类
public void initMaryTTS() throws MaryConfigurationException {
log.debug("Initialiazing MaryTTS");
marytts = new LocalMaryInterface();
String voice = Voice.getSelectedVoice().getName();
log.debug("Setting voice to: " + voice);
marytts.setVoice(voice);
String effects = SoundEffect.toMaryTTSString();
log.debug("Setting effects to: " + effects);
marytts.setAudioEffects(effects);
}
示例10: main
import marytts.exceptions.MaryConfigurationException; //导入依赖的package包/类
public static void main(String[] args) {
loadLaf(args);
setLocale();
SplashScreen splashScreen = new SplashScreen();
ScreenPositioner.centerOnScreen(splashScreen);
splashScreen.setVisible(PROPERTIES.isSplashScreenEnabled());
try {
Speeker speeker = new Speeker();
Runtime.getRuntime().addShutdownHook(new ShutdownHook(speeker));
ClientWindow clientWindow = new ClientWindow(speeker);
splashScreen.setVisible(false);
splashScreen.dispose();
if (PROPERTIES.isWelcomeScreenEnabled()) {
WelcomeScreen welcomeScreen = new WelcomeScreen();
ScreenPositioner.centerOnScreen(welcomeScreen);
welcomeScreen.setVisible(true);
}
clientWindow.setVisible(true);
if (PROPERTIES.isStartMinimized()) {
clientWindow.setExtendedState(Frame.ICONIFIED);
}
} catch (MaryConfigurationException e) {
log.error("Unable to start Speeker", e);
splashScreen.setMessage(MESSAGES.get("initialization_error"));
try {
Thread.sleep(5000);
} catch (InterruptedException e1) {
log.error(e.getMessage(), e);
}
System.exit(0);
}
}
示例11: ClientWindow
import marytts.exceptions.MaryConfigurationException; //导入依赖的package包/类
public ClientWindow(Speeker speeker) throws MaryConfigurationException {
super(MESSAGES.get("client_window_title"));
this.speeker = speeker;
speeker.addEndOfSpeechListener(this);
initGui();
if (PROPERTIES.isNativeHookEnabled()) {
initNativeHook();
}
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
示例12: MaryTTS
import marytts.exceptions.MaryConfigurationException; //导入依赖的package包/类
public MaryTTS(String voiceName)
{
try
{
System.setProperty("log4j.logger.marytts", "OFF"); //default is INFO, to log/server.log
System.setProperty("de.phonemiser.logunknown", "false");
maryTTS = new LocalMaryInterface();
maryTTS.setVoice(voiceName);
}
catch (MaryConfigurationException mce)
{
logger.log(Level.SEVERE, "Can't initialize LocalMaryInterface", mce);
}
}
示例13: activate
import marytts.exceptions.MaryConfigurationException; //导入依赖的package包/类
public void activate() {
try {
marytts = new LocalMaryInterface();
Locale systemLocale = Locale.getDefault();
if (marytts.getAvailableLocales().contains(systemLocale)) {
defaultVoice = Voice.getDefaultVoice(systemLocale);
}
if (defaultVoice==null) {
// Fallback
defaultVoice = Voice.getVoice(marytts.getAvailableVoices().iterator().next());
}
} catch (MaryConfigurationException e) {
logger.error("Error connecting to Mary TTS: " + e.getLocalizedMessage(), e);
}
}
示例14: getMaryInterface
import marytts.exceptions.MaryConfigurationException; //导入依赖的package包/类
/**
* Create the MaryInterface
*
* @return The MaryInterface
*/
private static final MaryInterface getMaryInterface() {
MaryInterface maryInterface = null;
try {
maryInterface = new LocalMaryInterface();
} catch (MaryConfigurationException e) {
throw new RuntimeException("Error creating MaryInterface", e);
}
return maryInterface;
}
示例15: activate
import marytts.exceptions.MaryConfigurationException; //导入依赖的package包/类
public void activate() {
try {
marytts = new LocalMaryInterface();
Locale systemLocale = Locale.getDefault();
if (marytts.getAvailableLocales().contains(systemLocale)) {
defaultVoice = Voice.getDefaultVoice(systemLocale);
}
if (defaultVoice == null) {
// Fallback
defaultVoice = Voice.getVoice(marytts.getAvailableVoices().iterator().next());
}
} catch (MaryConfigurationException e) {
logger.error("Error connecting to Mary TTS: " + e.getLocalizedMessage(), e);
}
}