phonemes_name is only initialized when V_LANGUAGE is met. This is not
necessarily the case, notably with
testing espeak_SetVoiceByName("!v/Annie") (language variant; intonation)
Cannot set intonation: language not set, or is invalid.
Uninitialized bytes in __interceptor_strcmp at offset 0 inside [0x7fff8a875e30, 1)
==4169902==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x4c6a49 in LookupPhonemeTable /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/synthdata.c:363:7
#1 0x4c6a49 in SelectPhonemeTableName /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/synthdata.c:380:12
#2 0x5098a9 in LoadVoice /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/voices.c:950:34
#3 0x50edcf in espeak_ng_SetVoiceByName /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/voices.c:1585:7
#4 0x4aad63 in espeak_SetVoiceByName /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/espeak_api.c:125:32
#5 0x4a3fe1 in test_espeak_set_voice_by_name_language_variant_intonation_parameter /home/samy/brl/speech/espeak-ng-git/tests/api.c:356:2
#6 0x4a3fe1 in main /home/samy/brl/speech/espeak-ng-git/tests/api.c:567:2
#7 0x7f26e88cb7fc in __libc_start_main csu/../csu/libc-start.c:332:16
#8 0x4213a9 in _start (/home/samy/ens/projet/1/speech/espeak-ng-git/tests/api.test+0x4213a9)
Uninitialized value was created by an allocation of 'phonemes_name' in the stack frame of function 'LoadVoice'
#0 0x504290 in LoadVoice /home/samy/brl/speech/espeak-ng-git/src/libespeak-ng/voices.c:519
so better catch it properly rather than relying on uninitialized data.
Use ESPEAKNG_DEFAULT_VOICE instead of hard coded "en".
This will make it easier to set a default voice other than
English. This is important for cases when a language will fall back to
the default voice.
Some references to L('e', 'n') still need to be changed.
code cleanup: don't add a \0 to voices_language in LoadVoice().
This is unnecessary since the string is already null terminated in the
V_LANGUAGE switch case. sscanf creates a null terminated string in
language_name, which is then copied to voice_language by strcpy (keeping
the \0).
It's probably unnecessary code and could be removed. However, it would
break tests. This is a temporary solution.
The solution is to do it once in VoiceReset() and then if the "formant"
keyword changes voice->width.
When a language or voice file in espeak-ng-data is loaded the keyword
"translator" must be set so that other language options can modify the
values in struct Translator.
CheckTranslator() provides standardized error for all switch cases that
modify a value in struct Translator.
code cleanup: move stressLength, stressAdd and stressAmp handling in LoadVoice()
From now on, stressLength must be set before stressAdd because
stressLength will overwrite any previous value. Usually stressLength is
set in a language file and stressAdd in a voice file.
Previously the order of the two commands didn't matter.
code cleanup: remove unnecessary new_translator in LoadVoice()
It looks like this was used in situations where both "language" and
"translator" voice options were found. Since bda8b6f76a "translator"
hasn't been supported.
espeak-ng --compile-phonemes generates phontab, but during the
generation it starts by reading the old phontab. If works just fine,
apart from an error message, if this doesn't exist but if it does exist
it is not clear whether it might end up using old or bad data (e.g.
possibly crashing if phontab is corrupted making it very non-obvious how
to fix the problem...)
The same applies to en_dict as a result of espeak-ng defaulting to the
voice 'en'; again the phontab build works if en_dict is absent but a
spurious message is output. It's not clear what would happen if someone
tried to build a reduced espeak-ng configuration with just one (non
'en') language.
The fix is to change espeak_ng_CompilePhonemeDataPath to call LoadVoice
with a new flag to indicate the voice structure is just required to
compile phoneme data (I changed the error message as well to make it
clear where it comes from - there are two identical error messages, the
other one is in voices.c)
Within LoadVoice the flag causes LoadVoice to not set a default language
or voicename and to skip loading the old phontab or dictionary (both of
which fail in a git clean -dfx build).
I checked the result by doing a compile from-scratch build sequence with
and without the patch, i.e. I did:
git clean -dfx
./autogen.sh
./configure --prefix=a-test-directory
make
make install
Then I compared the two copies of "a-test-directory" as well as the log
file output:
$ diff -r logs/*
diff -r logs/original/make.log logs/patched/make.log
175,176d174
< Unknown phoneme table: 'en'
< Can't read dictionary file:
'/home/jbowler/src/espeak-ng/master/espeak-ng-data/en_dict'
$ diff --no-dereference -r local.original local.patched
Binary files local.original/bin/speak-ng and local.patched/bin/speak-ng differ
Binary files local.original/lib/libespeak-ng.a and local.patched/lib/libespeak-ng.a differ
Binary files local.original/lib/libespeak-ng.so.1.1.51 and local.patched/lib/libespeak-ng.so.1.1.51 differ
So the change has not altered phontab or any of the other generated
files, only the binaries as would be expected. (Note that I am
comparing truely clean builds; what you get if you download the source
and build from scratch. This is the standard approach for people who
build for distribution.)
Signed-off-by: John Bowler <[email protected]>
The only way (in Dec. 2019) to get espeak_ListVoices to actually list
all the voices, including variants and mbrola voices used to be to pass
a non-null voice selector with a null language pointer. This still
seems to be supported in SetVoiceScores, which still checks for a null
language (see the check right at the top), however new code has been added
for a pseudo voice "all" lower down which seems to do the same thing but
crashes with null. This change allows "old" code to continue working.
Signed-off-by: John Bowler <[email protected]>
speed.fast_settings[] was introduced in 7b2eecc724 to be used with
Sonic. Looks like after 7b2eecc724 the code related to everything
except fast_settings[0] was removed.
Might be that speed.fast_settings[0] is also irrelevant and could be
removed.
See commit message for 23a4d88f.
This commit fixes cmn and yue.
CalcPitches_Tone() now accepts cmn for translator_name.
SelectTranslator() now has a case for yue instead of zhy.
Option "language <name>"already causes SelectTranslator(<name>) to be
called. Having two options to do almost the same thing is unnecessary
and confusing.
In the long term, all options from SelectTranslator() should have a
switch case in LoadVoice() so they are user configurable (see #218). If
needed, a new option (maybe called "LoadOptions") could be added to load
an existing voice or language file.
Changes language configuration files for: hak, cmn, yue, ltg, ms, mb-ma1.
No changes to users.
Code cleanup: remove param2 from langopts and rename keyword option in language files.
- param2[] is only used to set a second value to LOPT_BRACKET_PAUSE. It is simpler
to have two values in param[] instead. This simplifies the codebase.
- Instead of setting "option bracket X Y" in language files, use
keywords "brackets X" and "bracketsAnnounced Y" instead to follow the
naming convention of other keywords.
- Add missing documentation to docs/voices.md.
code cleanup: Check all local includes with include-what-you-use
Going through files in src/libespeak-ng/, include-what-you-use removed a
few unnecessary includes and included explanations on why a certain
header should be included. This makes tracking globals and dependencies easier.
Running the codebase through IWYU should be repeated after each major
code restIncludes to standard c library weren't checked to avoid
breaking builds with other platforms.
See https://github.com/include-what-you-use/include-what-you-use
Option --load makes espeak-ng consider the voice name provided a name of
a file relative to the current directory.
Signed-off-by: golubovsky <[email protected]>
It is set in voices.c but never used. docs/voices.md indicates that the keyword intonation only takes one parameter, confirming that option_tone2 is unused.