Speech synthesis: Difference between revisions
Content added Content deleted
(Added zkl) |
|||
Line 242: | Line 242: | ||
{{libheader|FreeTTS|1.2}} |
{{libheader|FreeTTS|1.2}} |
||
<lang scala>import java.util.Locale |
<lang scala>import java.util.Locale |
||
import com.sun.speech.freetts._ |
|||
import javax.speech.Central |
import javax.speech.Central |
||
import javax.speech.synthesis.{ Synthesizer, SynthesizerModeDesc } |
import javax.speech.synthesis.{ Synthesizer, SynthesizerModeDesc } |
||
Line 249: | Line 251: | ||
def speech(text: String) = { |
def speech(text: String) = { |
||
if (!text.trim.isEmpty()) { |
if (!text.trim.isEmpty()) { |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
val synth = Central.createSynthesizer(new SynthesizerModeDesc(Locale.US)) |
|||
System.setProperty("freetts.voices", |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
case g2: SynthesizerModeDesc => g2 |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
case g2: SynthesizerModeDesc => g2 |
|||
⚫ | |||
case _ => throw new ClassCastException |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
} |
} |
||
⚫ | |||
⚫ | |||
speech("If it ain't Dutch, It ain't much.") |
speech("If it ain't Dutch, It ain't much.") |
||
⚫ | |||
}</lang> |
}</lang> |
||