Skip to content

Commit

Permalink
works for me
Browse files Browse the repository at this point in the history
  • Loading branch information
pkrumins committed Apr 2, 2012
0 parents commit 524a172
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
74 changes: 74 additions & 0 deletions TextToWav.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#include <stdio.h>
#include "loqtts.h"

int main(int argc, char **argv)
{
ttsHandleType hReader;
ttsResultType r;

char *voice, *inputTextFile, *outputWavFile;

if (argc < 4) {
fprintf(stderr, "Usage: %s <VoiceName> <InputTextFile> <OutputWavFile>\n", argv[0]);
return 1;
}

voice = argv[1];
inputTextFile = argv[2];
outputWavFile = argv[3];

r = ttsNewReader(&hReader, NULL);
if (r != tts_OK) {
fprintf(stderr, "%s\n", ttsGetErrorMessage(r));
ttsDeleteSession(NULL);
return r;
}

r = ttsLoadPersona(hReader, voice, NULL, NULL);
if (r != tts_OK) {
fprintf(stderr, "%s\n", ttsGetErrorMessage(r));
ttsDeleteSession(NULL);
return r;
}

r = ttsSetSpeed(hReader, 40);
if (r != tts_OK) {
fprintf(stderr, "%s\n", ttsGetErrorMessage(r));
ttsDeleteSession(NULL);
return r;
}

r = ttsSetAudio(
hReader,
"LTTS7AudioFile",
outputWavFile,
32000,
tts_LINEAR,
tts_STEREO,
NULL
);

if (r != tts_OK) {
fprintf(stderr, "%s\n", ttsGetErrorMessage(r));
ttsDeleteSession(NULL);
return r;
}

r = ttsRead(
hReader,
inputTextFile,
ttsFALSE, /* bAsync */
ttsTRUE, /* bFromFile */
NULL
);

if (r != tts_OK) {
fprintf(stderr, "%s\n", ttsGetErrorMessage(r));
ttsDeleteSession(NULL);
return 1;
}

ttsDeleteSession(NULL);
return 0;
}

7 changes: 7 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# Peteris Krumins (peteris.krumins@gmail.com, twitter: @pkrumins)
# http://www.catonmat.net -- good coders code, great coders reuse
#

./TextToWav <VoiceName> <InputTextFile> <OutputWavFile>

0 comments on commit 524a172

Please sign in to comment.