Speech synthesis: Difference between revisions

m
m (syntax highlighting fixup automation)
m (→‎{{header|Wren}}: Minor tidy)
 
(3 intermediate revisions by 2 users not shown)
Line 180:
Sleep</syntaxhighlight>
 
 
=={{header|FutureBasic}}==
FB offers easy access to excellent quality native synthesized voices in a variety of accents and languages available on Macs as demonstrated here. For a more comprehensive demonstration of speech synthesis, see the FutureBasic Rosetta Code task solution to: [[https://rosettacode.org/wiki/Old_lady_swallowed_a_fly#FutureBasic|FB's Old Laday Swallowed a Fly.]]
<syntaxhighlight lang="futurebasic">
 
SpeechSynthesizerRef ref
ref = fn SpeechSynthesizerWithVoice( @"com.apple.speech.synthesis.voice.daniel.premium" )
fn SpeechSynthesizerStartSpeakingString( ref, @"This is an example of speech synthesis." )
 
HandleEvents
</syntaxhighlight>
 
=={{header|GlovePIE}}==
Line 642 ⟶ 653:
engine.runAndWait()
</syntaxhighlight>
 
=={{header|Quackery}}==
 
Mac specific.
 
<syntaxhighlight lang="Quackery"> [ $ /
import subprocess
subprocess.run(["say",
string_from_stack()])
/ python ] is speak ( $ --> )
 
$ "This is an example of speech synthesis" speak</syntaxhighlight>
 
=={{header|Racket}}==
Line 932 ⟶ 955:
=={{header|Wren}}==
The ability to call external processes such as ''espeak'' is expected to be added to Wren-cli in the next release. In the meantime, we embed the following Wren script in a minimal C host (no error checking) to complete this task.
<syntaxhighlight lang="ecmascriptwren">/* speech_synthesisSpeech_synthesis.wren */
 
class C {
Line 945 ⟶ 968:
<br>
We now embed this in the following C program, compile and run it.
<syntaxhighlight lang="c">#include/* <stdiogcc Speech_synthesis.h>c -o Speech_synthesis -lwren -lm */
 
#include <stdio.h>
#include <stdio_ext.h>
#include <stdlib.h>
Line 1,007 ⟶ 1,032:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "speech_synthesisSpeech_synthesis.wren";
char *script = readFile(fileName);
wrenInterpret(vm, module, script);
9,488

edits