Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
more optimized build, plus some debug info in demo.html
  • Loading branch information
kripken committed Jan 13, 2012
1 parent 6625dc5 commit 904faf2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion demo.html
Expand Up @@ -10,7 +10,7 @@
<body>
<h1>speak.js</h1>
<h2>Text-To-Speech on the Web</h2>
<form onsubmit="speak(text.value, { amplitude: amplitude.value, wordgap: workdgap.value, pitch: pitch.value, speed: speed.value }); return false">
<form onsubmit="speak(text.value, { amplitude: amplitude.value, wordgap: workdgap.value, pitch: pitch.value, speed: speed.value, debug: true }); return false">
Text: <input type="text" name="text" size=50 value="Never gonna give, you, up.">
Amplitude: <input type="text" name="amplitude" size=5 value="100">
Pitch: <input type="text" name="pitch" size=5 value="50">
Expand Down
5 changes: 5 additions & 0 deletions speakClient.js
Expand Up @@ -69,10 +69,15 @@ function speak(text, args) {
}
}

var startTime = Date.now();

var wav = generateSpeech(text, args);
var data = parseWav(wav); // validate the data and parse it

// TODO: try playAudioDataAPI(data), and fallback if failed
playHTMLAudioElement(wav);

var endTime = Date.now();
if (args && args.debug) console.log('speak.js: took ' + (endTime - startTime) + ' ms.');
}

2 changes: 1 addition & 1 deletion speakGenerator.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/emscripten.sh
Expand Up @@ -10,16 +10,16 @@ make clean
rm libespeak.*
rm speak speak.bc speak.o
CXXFLAGS="-DNEED_WCHAR_FUNCTIONS" $EMSCRIPTEN/emmake make -j 4
mv speak speak.bc

echo "dis"
~/Dev/llvm/cbuild/bin/llvm-dis -show-annotations speak -o=speak.ll

#echo "dis"
#~/Dev/llvm/cbuild/bin/llvm-dis -show-annotations speak -o=speak.ll
#echo "autodebug"
#mv speak.ll speak.orig.ll
#python ~/Dev/emscripten/tools/autodebugger.py speak.orig.ll speak.ll

echo "emscripten"
$EMSCRIPTEN/emcc -O2 --js-transform "python bundle.py" speak.ll -o speak.raw.js
$EMSCRIPTEN/emcc -O3 -s CORRECT_SIGNS=1 --js-transform "python bundle.py" speak.bc -o speak.raw.js
cat shell_pre.js > ../speakGenerator.js
cat speak.raw.js >> ../speakGenerator.js
cat shell_post.js >> ../speakGenerator.js
Expand Down

0 comments on commit 904faf2

Please sign in to comment.