Browse Source

espeak-ng: support specifying the device name from the command line

master
Reece H. Dunn 9 years ago
parent
commit
0d0bb33297
3 changed files with 28 additions and 6 deletions
  1. 7
    2
      CHANGELOG.md
  2. 4
    0
      src/espeak-ng.1.ronn
  3. 17
    4
      src/espeak-ng.c

+ 7
- 2
CHANGELOG.md View File

* Support the `--compile-phonemes` command-line option. * Support the `--compile-phonemes` command-line option.
* Support the `--compile-intonations` command-line option. * Support the `--compile-intonations` command-line option.
* Support SSML <phoneme alphabet="espeak" ph="..."> tags. * Support SSML <phoneme alphabet="espeak" ph="..."> tags.
* Added man files for the `speak-ng` and `espeak-ng` command-line programs.
* Created a companion espeak-ng API to provide more detailed error codes and
provide access to the new espeak-ng functionality.

build:

* Build the code with a C99 compiler, instead of a C++ compiler.
* Use -fPIC to support sparc/sparc64 architectures. * Use -fPIC to support sparc/sparc64 architectures.
* Use the system's portaudio header files. * Use the system's portaudio header files.
* Use the system's sonic library and header files. * Use the system's sonic library and header files.
* Added man files for the `speak-ng` and `espeak-ng` command-line programs.
* Output phoneme compilation errors to stderr. * Output phoneme compilation errors to stderr.
* Generate build failures if building phoneme, intonation or dictionary files * Generate build failures if building phoneme, intonation or dictionary files
contain errors. contain errors.


restructuring: restructuring:


* Build the code with a C99 compiler, instead of a C++ compiler.
* Moved the library code to `src/libespeak-ng`. * Moved the library code to `src/libespeak-ng`.
* Renamed `espeak` to `espeak-ng`. * Renamed `espeak` to `espeak-ng`.
* Renamed `speak` to `speak-ng`. * Renamed `speak` to `speak-ng`.

+ 4
- 0
src/espeak-ng.1.ronn View File

If neither -f nor --stdin are provided, <words> are spoken, or if no If neither -f nor --stdin are provided, <words> are spoken, or if no
words are provided then text is spoken from stdin a line at a time. words are provided then text is spoken from stdin a line at a time.


* `-d <device>`:
Use the specified device to speak the audio on. If not specified, the
default audio device is used.

* `-q`: * `-q`:
Quiet, don't produce any speech (may be useful with -x). Quiet, don't produce any speech (may be useful with -x).



+ 17
- 4
src/espeak-ng.c View File

"is spoken from stdin, each line separately.\n\n" "is spoken from stdin, each line separately.\n\n"
"-a <integer>\n" "-a <integer>\n"
"\t Amplitude, 0 to 200, default is 100\n" "\t Amplitude, 0 to 200, default is 100\n"
"-d <device>\n"
"\t Use the specified device to speak the audio on. If not specified, the\n"
"\t default audio device is used.\n"
"-g <integer>\n" "-g <integer>\n"
"\t Word gap. Pause between words, units of 10mS at the default speed\n" "\t Word gap. Pause between words, units of 10mS at the default speed\n"
"-k <integer>\n" "-k <integer>\n"
}; };
int optind; int optind;
static int optional_argument; static int optional_argument;
static const char *arg_opts = "abfgklpsvw"; // which options have arguments
static const char *arg_opts = "abdfgklpsvw"; // which options have arguments
static char *opt_string = ""; static char *opt_string = "";
#define no_argument 0 #define no_argument 0
#define required_argument 1 #define required_argument 1
espeak_VOICE voice_select; espeak_VOICE voice_select;
char filename[200]; char filename[200];
char voicename[40]; char voicename[40];
char devicename[200];
#define N_PUNCTLIST 100 #define N_PUNCTLIST 100
wchar_t option_punctlist[N_PUNCTLIST]; wchar_t option_punctlist[N_PUNCTLIST];


voicename[0] = 0; voicename[0] = 0;
wavefile[0] = 0; wavefile[0] = 0;
filename[0] = 0; filename[0] = 0;
devicename[0] = 0;
option_punctlist[0] = 0; option_punctlist[0] = 0;


#ifdef NEED_GETOPT #ifdef NEED_GETOPT
} }
#else #else
while (true) { while (true) {
c = getopt_long(argc, argv, "a:b:f:g:hk:l:mp:qs:v:w:xXz",
c = getopt_long(argc, argv, "a:b:d:f:g:hk:l:mp:qs:v:w:xXz",
long_options, &option_index); long_options, &option_index);


// Detect the end of the options. // Detect the end of the options.
else else
synth_flags |= espeakCHARS_8BIT; synth_flags |= espeakCHARS_8BIT;
break; break;
case 'd':
strncpy0(devicename, optarg2, sizeof(devicename));
break;
case 'h': case 'h':
printf("\n"); printf("\n");
PrintVersion(); PrintVersion();


if (option_waveout || quiet) { if (option_waveout || quiet) {
// writing to a file (or no output), we can use synchronous mode // writing to a file (or no output), we can use synchronous mode
espeak_ng_InitializeOutput(ENOUTPUT_MODE_SYNCHRONOUS, 0, NULL);
result = espeak_ng_InitializeOutput(ENOUTPUT_MODE_SYNCHRONOUS, 0, devicename[0] ? devicename : NULL);
samplerate = espeak_ng_GetSampleRate(); samplerate = espeak_ng_GetSampleRate();
samples_split = samplerate * samples_split_seconds; samples_split = samplerate * samples_split_seconds;


} }
} else { } else {
// play the sound output // play the sound output
espeak_ng_InitializeOutput(ENOUTPUT_MODE_SPEAK_AUDIO, 0, NULL);
result = espeak_ng_InitializeOutput(ENOUTPUT_MODE_SPEAK_AUDIO, 0, devicename[0] ? devicename : NULL);
samplerate = espeak_ng_GetSampleRate(); samplerate = espeak_ng_GetSampleRate();
} }


if (result != ENS_OK) {
fprintf(stderr, "Initialization failed.\n");
exit(1);
}

if (voicename[0] == 0) if (voicename[0] == 0)
strcpy(voicename, "default"); strcpy(voicename, "default");



Loading…
Cancel
Save