mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-16 18:22:37 +00:00
espeak-ng: support specifying the device name from the command line
This commit is contained in:
+7
-2
@@ -6,17 +6,22 @@
|
||||
* Support the `--compile-phonemes` command-line option.
|
||||
* Support the `--compile-intonations` command-line option.
|
||||
* 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 the system's portaudio 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.
|
||||
* Generate build failures if building phoneme, intonation or dictionary files
|
||||
contain errors.
|
||||
|
||||
restructuring:
|
||||
|
||||
* Build the code with a C99 compiler, instead of a C++ compiler.
|
||||
* Moved the library code to `src/libespeak-ng`.
|
||||
* Renamed `espeak` to `espeak-ng`.
|
||||
* Renamed `speak` to `speak-ng`.
|
||||
|
||||
@@ -27,6 +27,10 @@ languages.
|
||||
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.
|
||||
|
||||
* `-d <device>`:
|
||||
Use the specified device to speak the audio on. If not specified, the
|
||||
default audio device is used.
|
||||
|
||||
* `-q`:
|
||||
Quiet, don't produce any speech (may be useful with -x).
|
||||
|
||||
|
||||
+17
-4
@@ -46,6 +46,9 @@ static const char *help_text =
|
||||
"is spoken from stdin, each line separately.\n\n"
|
||||
"-a <integer>\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"
|
||||
"\t Word gap. Pause between words, units of 10mS at the default speed\n"
|
||||
"-k <integer>\n"
|
||||
@@ -299,7 +302,7 @@ struct option {
|
||||
};
|
||||
int optind;
|
||||
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 = "";
|
||||
#define no_argument 0
|
||||
#define required_argument 1
|
||||
@@ -361,12 +364,14 @@ int main(int argc, char **argv)
|
||||
espeak_VOICE voice_select;
|
||||
char filename[200];
|
||||
char voicename[40];
|
||||
char devicename[200];
|
||||
#define N_PUNCTLIST 100
|
||||
wchar_t option_punctlist[N_PUNCTLIST];
|
||||
|
||||
voicename[0] = 0;
|
||||
wavefile[0] = 0;
|
||||
filename[0] = 0;
|
||||
devicename[0] = 0;
|
||||
option_punctlist[0] = 0;
|
||||
|
||||
#ifdef NEED_GETOPT
|
||||
@@ -415,7 +420,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
#else
|
||||
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);
|
||||
|
||||
// Detect the end of the options.
|
||||
@@ -433,6 +438,9 @@ int main(int argc, char **argv)
|
||||
else
|
||||
synth_flags |= espeakCHARS_8BIT;
|
||||
break;
|
||||
case 'd':
|
||||
strncpy0(devicename, optarg2, sizeof(devicename));
|
||||
break;
|
||||
case 'h':
|
||||
printf("\n");
|
||||
PrintVersion();
|
||||
@@ -591,7 +599,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (option_waveout || quiet) {
|
||||
// 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();
|
||||
samples_split = samplerate * samples_split_seconds;
|
||||
|
||||
@@ -606,10 +614,15 @@ int main(int argc, char **argv)
|
||||
}
|
||||
} else {
|
||||
// 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();
|
||||
}
|
||||
|
||||
if (result != ENS_OK) {
|
||||
fprintf(stderr, "Initialization failed.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (voicename[0] == 0)
|
||||
strcpy(voicename, "default");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user