update to 1.51.1+20240504git.f57b594 [release 1.51.1+20240504git.f57b594-1mamba;Fri Jun 07 2024]

This commit is contained in:
Silvan Calarco 2024-11-07 21:34:08 +01:00
parent 36d4701874
commit da87e85042
2 changed files with 133 additions and 11 deletions

View File

@ -0,0 +1,120 @@
From ba13f633722bac14cf7240f2de3222ac2ea5ece1 Mon Sep 17 00:00:00 2001
From: Michael Hansen <mike@rhasspy.org>
Date: Wed, 24 May 2023 14:05:13 -0500
Subject: [PATCH] Add espeak_TextToPhonemesWithTerminator
---
src/include/espeak-ng/speak_lib.h | 6 ++++++
src/libespeak-ng/speech.c | 36 ++++++++++++++++++++++---------
src/libespeak-ng/translate.c | 13 ++++++++++-
3 files changed, 44 insertions(+), 11 deletions(-)
diff --git a/src/include/espeak-ng/speak_lib.h b/src/include/espeak-ng/speak_lib.h
index f060bd04c7..c15d140965 100644
--- a/src/include/espeak-ng/speak_lib.h
+++ b/src/include/espeak-ng/speak_lib.h
@@ -541,6 +541,12 @@ ESPEAK_API const char *espeak_TextToPhonemes(const void **textptr, int textmode,
*/
+#ifdef __cplusplus
+extern "C"
+#endif
+ESPEAK_API const char *espeak_TextToPhonemesWithTerminator(const void **textptr, int textmode, int phonememode, int *terminator);
+/* Version of espeak_TextToPhonemes that also returns the clause terminator (e.g., CLAUSE_INTONATION_FULL_STOP) */
+
#ifdef __cplusplus
extern "C"
#endif
diff --git a/src/libespeak-ng/speech.c b/src/libespeak-ng/speech.c
index 9f90d10543..eb3b0f0b34 100644
--- a/src/libespeak-ng/speech.c
+++ b/src/libespeak-ng/speech.c
@@ -850,6 +850,31 @@ ESPEAK_API void espeak_SetPhonemeTrace(int phonememode, FILE *stream)
f_trans = stderr;
}
+// Same as espeak_TextToPhonemes except we also get the clause terminator used (full stop, comma, etc.).
+// Depends on the added TranslateClauseWithTerminator in
+ESPEAK_API const char* espeak_TextToPhonemesWithTerminator(const void** textptr, int textmode, int phonememode, int* terminator)
+{
+ /* phoneme_mode
+ bit 1: 0=eSpeak's ascii phoneme names, 1= International Phonetic
+ Alphabet (as UTF-8 characters). bit 7: use (bits 8-23) as a tie within
+ multi-letter phonemes names bits 8-23: separator character, between
+ phoneme names
+ */
+
+ if (p_decoder == NULL)
+ p_decoder = create_text_decoder();
+
+ if (text_decoder_decode_string_multibyte(
+ p_decoder, *textptr, translator->encoding, textmode)
+ != ENS_OK)
+ return NULL;
+
+ TranslateClauseWithTerminator(translator, NULL, NULL, terminator);
+ *textptr = text_decoder_get_buffer(p_decoder);
+
+ return GetTranslatedPhonemeString(phonememode);
+}
+
ESPEAK_API const char *espeak_TextToPhonemes(const void **textptr, int textmode, int phonememode)
{
/* phoneme_mode
@@ -858,16 +883,7 @@ ESPEAK_API const char *espeak_TextToPhonemes(const void **textptr, int textmode,
bits 8-23: separator character, between phoneme names
*/
- if (p_decoder == NULL)
- p_decoder = create_text_decoder();
-
- if (text_decoder_decode_string_multibyte(p_decoder, *textptr, translator->encoding, textmode) != ENS_OK)
- return NULL;
-
- TranslateClause(translator, NULL, NULL);
- *textptr = text_decoder_get_buffer(p_decoder);
-
- return GetTranslatedPhonemeString(phonememode);
+ return espeak_TextToPhonemesWithTerminator(textptr, textmode, phonememode, NULL);
}
ESPEAK_NG_API espeak_ng_STATUS espeak_ng_Cancel(void)
diff --git a/src/libespeak-ng/translate.c b/src/libespeak-ng/translate.c
index 6e1860e020..2b04fdd7ff 100644
--- a/src/libespeak-ng/translate.c
+++ b/src/libespeak-ng/translate.c
@@ -919,7 +919,9 @@ static int UpperCaseInWord(Translator *tr, char *word, int c)
return 0;
}
-void TranslateClause(Translator *tr, int *tone_out, char **voice_change)
+// Same as TranslateClause except we also get the clause terminator used (full stop, comma, etc.).
+// Used by espeak_TextToPhonemesWithTerminator.
+void TranslateClauseWithTerminator(Translator *tr, int *tone_out, char **voice_change, int *terminator_out)
{
int ix;
int c;
@@ -983,6 +985,10 @@ void TranslateClause(Translator *tr, int *tone_out, char **voice_change)
MAKE_MEM_UNDEFINED(&source, sizeof(source));
terminator = ReadClause(tr, source, charix, &charix_top, N_TR_SOURCE, &tone, voice_change_name);
+ if (terminator_out != NULL) {
+ *terminator_out = terminator;
+ }
+
if (tone_out != NULL) {
if (tone == 0)
*tone_out = (terminator & CLAUSE_INTONATION_TYPE) >> 12; // tone type not overridden in ReadClause, use default
@@ -1668,6 +1674,11 @@ void TranslateClause(Translator *tr, int *tone_out, char **voice_change)
}
}
+void TranslateClause(Translator *tr, int *tone_out, char **voice_change)
+{
+ TranslateClauseWithTerminator(tr, tone_out, voice_change, NULL);
+}
+
static int CalcWordLength(int source_index, int charix_top, short int *charix, WORD_TAB *words, int word_count) {
int j;
int k;

View File

@ -1,5 +1,6 @@
%define gitcommit %(echo %version | cut -d+ -f2 | cut -d. -f2)
Name: espeak-ng Name: espeak-ng
Version: 1.51.1 Version: 1.51.1+20240504git.f57b594
Release: 1mamba Release: 1mamba
Summary: eSpeak NG is an open source speech synthesizer that supports 108 languages and accents Summary: eSpeak NG is an open source speech synthesizer that supports 108 languages and accents
Group: System/Multimedia Group: System/Multimedia
@ -7,13 +8,16 @@ Vendor: openmamba
Distribution: openmamba Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it> Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://github.com/espeak-ng/espeak-ng URL: https://github.com/espeak-ng/espeak-ng
Source: https://github.com/espeak-ng/espeak-ng.git/%{version}/espeak-ng-%{version}.tar.bz2 Source: https://github.com/espeak-ng/espeak-ng.git/master@%{gitcommit}/espeak-ng-%{version}.tar.bz2
# Taken from fork used by piper-phonemized
Patch0: espeak-ng-1.51.1+20240504git.f57b594-add-espeak_TextToPhonemesWithTerminator.patch
License: GPL License: GPL
## AUTOBUILDREQ-BEGIN ## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel BuildRequires: glibc-devel
BuildRequires: libgcc BuildRequires: libgcc
BuildRequires: libstdc++6-devel BuildRequires: libstdc++6-devel
## AUTOBUILDREQ-END ## AUTOBUILDREQ-END
BuildRequires: ruby-ronn-ng
Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release} Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release}
Provides: espeak Provides: espeak
Obsoletes: espeak < 1.50 Obsoletes: espeak < 1.50
@ -43,6 +47,7 @@ This package contains libraries and header files for developing applications tha
%prep %prep
%setup -q %setup -q
%patch 0 -p1 -b .add-espeak_TextToPhonemesWithTerminator
./autogen.sh ./autogen.sh
%build %build
@ -55,6 +60,8 @@ This package contains libraries and header files for developing applications tha
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" [ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeinstall %makeinstall
rm -f %{buildroot}%{_libdir}/libespeak.la
%clean %clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" [ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
@ -87,33 +94,28 @@ This package contains libraries and header files for developing applications tha
%{_datadir}/vim/addons/syntax/espeaklist.vim %{_datadir}/vim/addons/syntax/espeaklist.vim
%{_datadir}/vim/addons/syntax/espeakrules.vim %{_datadir}/vim/addons/syntax/espeakrules.vim
%{_datadir}/vim/registry/espeak.yaml %{_datadir}/vim/registry/espeak.yaml
%ifnarch arm %{ix86}
%{_mandir}/man1/espeak-ng.1* %{_mandir}/man1/espeak-ng.1*
%{_mandir}/man1/speak-ng.1* %{_mandir}/man1/speak-ng.1*
%endif
%doc COPYING
%files -n lib%{name} %files -n lib%{name}
%defattr(-,root,root) %defattr(-,root,root)
#%{_libdir}/libespeak-ng-test.so.*
%{_libdir}/libespeak-ng.so.* %{_libdir}/libespeak-ng.so.*
%doc COPYING
%files -n lib%{name}-devel %files -n lib%{name}-devel
%defattr(-,root,root) %defattr(-,root,root)
%dir %{_includedir}/espeak-ng %dir %{_includedir}/espeak-ng
%{_includedir}/espeak-ng/*.h %{_includedir}/espeak-ng/*.h
%{_includedir}/espeak/speak_lib.h %{_includedir}/espeak/speak_lib.h
#%{_libdir}/libespeak-ng-test.a
#%{_libdir}/libespeak-ng-test.la
#%{_libdir}/libespeak-ng-test.so
%{_libdir}/libespeak-ng.a %{_libdir}/libespeak-ng.a
%{_libdir}/libespeak-ng.la
%{_libdir}/libespeak-ng.so %{_libdir}/libespeak-ng.so
%{_libdir}/libespeak.la
%{_libdir}/pkgconfig/espeak-ng.pc %{_libdir}/pkgconfig/espeak-ng.pc
%doc README.md %doc README.md
%changelog %changelog
* Fri Jun 07 2024 Silvan Calarco <silvan.calarco@mambasoft.it> 1.51.1+20240504git.f57b594-1mamba
- update to 1.51.1+20240504git.f57b594
* Wed Jun 22 2022 Automatic Build System <autodist@mambasoft.it> 1.51.1-1mamba * Wed Jun 22 2022 Automatic Build System <autodist@mambasoft.it> 1.51.1-1mamba
- automatic version update by autodist - automatic version update by autodist