Uses 13052K of libraries. Click here for Pure Java version (62L/1K/3K).
!636 (modern) // speech libraries! !1000722 1000723 1000724 !1000730 1000731 1000732 !1000726 1000727 import javax.speech.*; import javax.speech.synthesis.*; main { psvm { speech("Hello Java X!"); } public static void speech(String text) { if (text == null || text.trim().isEmpty()) return; String voiceName = "kevin16"; try { System.setProperty("FreeTTSSynthEngineCentral", "com.sun.speech.freetts.jsapi.FreeTTSEngineCentral"); System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory"); Central.registerEngineCentral("com.sun.speech.freetts.jsapi.FreeTTSEngineCentral"); SynthesizerModeDesc desc = new SynthesizerModeDesc(null, "general", Locale.US, null, null); Synthesizer synth = Central.createSynthesizer(desc); synth.allocate(); desc = (SynthesizerModeDesc) synth.getEngineModeDesc(); Voice[] voices = desc.getVoices(); Voice voice = null; for (Voice entry : voices) { if(entry.getName().equals(voiceName)) { voice = entry; break; } } synth.getSynthesizerProperties().setVoice(voice); synth.resume(); synth.speakPlainText(text, null); synth.waitEngineState(Synthesizer.QUEUE_EMPTY); synth.deallocate(); } catch(Exception ex) { String message = " missing speech.properties in " + System.getProperty("user.home") + "\n"; System.out.println("" + ex); System.out.println(message); ex.printStackTrace(); } } }
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1000721 |
Snippet name: | Say "Hello JavaX" using software speech synthesizer |
Eternal ID of this version: | #1000721/1 |
Text MD5: | 355a898b9935860edcb56c44052c4b5e |
Transpilation MD5: | d0ea814cb70d0321fdbacd58ac1a4714 |
Author: | stefan |
Category: | |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-08-24 01:59:58 |
Source code size: | 1612 bytes / 52 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 787 / 773 |
Referenced in: | [show references] |