Speech synthesis: Difference between revisions
Added Kotlin
m (Added AutoIt Code) |
(Added Kotlin) |
||
Line 189:
<lang javascript>var voice = new ActiveXObject("SAPI.SpVoice");
voice.speak("This is an example of speech synthesis.");</lang>
=={{header|Kotlin}}==
{{trans|C}}
<lang scala>// Kotlin Native v0.6.2
import kotlinx.cinterop.*
import platform.posix.*
fun talk(s: String) {
val pid = fork()
if (pid < 0) {
perror("fork")
exit(1)
}
if (pid == 0) {
execlp("espeak", "espeak", s, null)
perror("espeak")
_exit(1)
}
memScoped {
val status = alloc<IntVar>()
waitpid(pid, status.ptr, 0)
if (status.value > 0) println("Exit status was ${status.value}")
}
}
fun main(args: Array<String>) {
talk("This is an example of speech synthesis.")
}</lang>
=={{header|Liberty BASIC}}==
|