mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-12-01 22:36:14 +00:00
[1.30.15] lang=es,pt: Fix bug where accented vowels cause intonation to go low pitch for the rest of the clause.
git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@127 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+5
-20
@@ -3,7 +3,7 @@ INCDIR=/usr/include/espeak
|
||||
LIBDIR=/usr/lib
|
||||
DATADIR=/usr/share/espeak-data
|
||||
|
||||
RELEASE = 1.29
|
||||
RELEASE = 1.30
|
||||
BIN_NAME = speak
|
||||
BIN2_NAME = espeak
|
||||
LIB_NAME = libespeak.so
|
||||
@@ -15,20 +15,6 @@ INSTALL = /usr/bin/install
|
||||
LN_SF = /bin/ln -sf
|
||||
MKDIR = mkdir -p
|
||||
|
||||
#AUDIO = portaudio
|
||||
AUDIO = pulseaudio
|
||||
|
||||
ifeq ($(AUDIO),pulseaudio)
|
||||
WAVE=wave_pulse.cpp
|
||||
LIB_AUDIO=pulse
|
||||
USE_AUDIO=USE_PULSEAUDIO
|
||||
else
|
||||
#portaudio
|
||||
WAVE=wave.cpp
|
||||
LIB_AUDIO=portaudio
|
||||
USE_AUDIO=USE_PORTAUDIO
|
||||
endif
|
||||
|
||||
speak_SOURCES = speak.cpp compiledict.cpp dictionary.cpp intonation.cpp \
|
||||
readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \
|
||||
synthdata.cpp synthesize.cpp translate.cpp tr_english.cpp \
|
||||
@@ -38,23 +24,22 @@ libespeak_SOURCES = speak_lib.cpp compiledict.cpp dictionary.cpp intonation.cpp
|
||||
readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \
|
||||
synthdata.cpp synthesize.cpp translate.cpp tr_english.cpp \
|
||||
tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp \
|
||||
espeak_command.cpp event.cpp fifo.cpp $(WAVE) debug.cpp
|
||||
espeak_command.cpp event.cpp fifo.cpp wave.cpp debug.cpp
|
||||
|
||||
|
||||
SRCS1=$(speak_SOURCES)
|
||||
OBJS1=$(patsubst %.cpp,%.o,$(SRCS1))
|
||||
LIBS1=-lstdc++ -l$(LIB_AUDIO) -lpthread
|
||||
LIBS1=-lstdc++ -lportaudio -lpthread
|
||||
|
||||
SRCS2=$(libespeak_SOURCES)
|
||||
OBJS2=$(patsubst %.cpp,x_%.o,$(SRCS2))
|
||||
LIBS2=-lstdc++ -l$(LIB_AUDIO) -lpthread
|
||||
LIBS2=-lstdc++ -lportaudio -lpthread
|
||||
|
||||
SRCS3 = espeak.cpp
|
||||
OBJS3=$(patsubst %.cpp,%.o,$(SRCS3))
|
||||
LIBS3=-lstdc++ ./libespeak.so
|
||||
|
||||
CXXFLAGS=-O2 -D$(USE_AUDIO)
|
||||
#CXXFLAGS=-D$(USE_AUDIO) -ggdb -DDEBUG_ENABLED
|
||||
CXXFLAGS=-O2
|
||||
|
||||
|
||||
all: $(BIN_NAME) $(LIB_NAME) $(STATIC_LIB_NAME) $(BIN2_NAME)
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
BINDIR=/usr/bin
|
||||
INCDIR=/usr/include/espeak
|
||||
LIBDIR=/usr/lib
|
||||
DATADIR=/usr/share/espeak-data
|
||||
|
||||
RELEASE = 1.30
|
||||
BIN2_NAME = espeak
|
||||
LIB_NAME = libespeak.so
|
||||
STATIC_LIB_NAME = libespeak.a
|
||||
LIB_VERSION = 1
|
||||
LIBTAG = $(LIB_VERSION).$(RELEASE)
|
||||
|
||||
INSTALL = /usr/bin/install
|
||||
LN_SF = /bin/ln -sf
|
||||
MKDIR = mkdir -p
|
||||
|
||||
#AUDIO = portaudio
|
||||
AUDIO = pulseaudio
|
||||
|
||||
BIN_NAME = speak
|
||||
|
||||
ifeq ($(AUDIO),pulseaudio)
|
||||
WAVE=wave_pulse.cpp
|
||||
LIB_AUDIO=pulse
|
||||
USE_AUDIO=USE_PULSEAUDIO
|
||||
# the speak executable is not yet compliant with PulseAudio,
|
||||
# speak_SOURCES defined for avoiding compilation errors.
|
||||
speak_SOURCES = speak.cpp compiledict.cpp dictionary.cpp intonation.cpp \
|
||||
readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \
|
||||
synthdata.cpp synthesize.cpp translate.cpp tr_english.cpp \
|
||||
tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp \
|
||||
espeak_command.cpp event.cpp fifo.cpp $(WAVE) debug.cpp
|
||||
else
|
||||
#portaudio
|
||||
WAVE=wave.cpp
|
||||
LIB_AUDIO=portaudio
|
||||
USE_AUDIO=USE_PORTAUDIO
|
||||
speak_SOURCES = speak.cpp compiledict.cpp dictionary.cpp intonation.cpp \
|
||||
readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \
|
||||
synthdata.cpp synthesize.cpp translate.cpp tr_english.cpp \
|
||||
tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp
|
||||
|
||||
endif
|
||||
|
||||
speak_SOURCES = speak.cpp compiledict.cpp dictionary.cpp intonation.cpp \
|
||||
readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \
|
||||
synthdata.cpp synthesize.cpp translate.cpp tr_english.cpp \
|
||||
tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp
|
||||
|
||||
libespeak_SOURCES = speak_lib.cpp compiledict.cpp dictionary.cpp intonation.cpp \
|
||||
readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \
|
||||
synthdata.cpp synthesize.cpp translate.cpp tr_english.cpp \
|
||||
tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp \
|
||||
espeak_command.cpp event.cpp fifo.cpp $(WAVE) debug.cpp
|
||||
|
||||
|
||||
SRCS1=$(speak_SOURCES)
|
||||
OBJS1=$(patsubst %.cpp,%.o,$(SRCS1))
|
||||
LIBS1=-lstdc++ -l$(LIB_AUDIO) -lpthread
|
||||
|
||||
SRCS2=$(libespeak_SOURCES)
|
||||
OBJS2=$(patsubst %.cpp,x_%.o,$(SRCS2))
|
||||
LIBS2=-lstdc++ -l$(LIB_AUDIO) -lpthread
|
||||
|
||||
SRCS3 = espeak.cpp
|
||||
OBJS3=$(patsubst %.cpp,%.o,$(SRCS3))
|
||||
LIBS3=-lstdc++ ./libespeak.so
|
||||
|
||||
#CXXFLAGS=-O2 -D$(USE_AUDIO)
|
||||
CXXFLAGS=-D$(USE_AUDIO) -ggdb -DDEBUG_ENABLED
|
||||
|
||||
|
||||
all: $(BIN_NAME) $(LIB_NAME) $(STATIC_LIB_NAME) $(BIN2_NAME)
|
||||
mv $(LIB_NAME) $(LIB_NAME).$(LIBTAG)
|
||||
|
||||
.cpp.o:
|
||||
$(CXX) $(CXXFLAGS) -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -Wall -pedantic -I. -c -fno-exceptions $<
|
||||
|
||||
$(BIN_NAME): $(OBJS1)
|
||||
$(CXX) -o $@ $(OBJS1) $(LIBS1)
|
||||
|
||||
$(BIN2_NAME): $(OBJS3) $(LIB_NAME)
|
||||
$(CXX) -o $@ $(OBJS3) $(LIBS3)
|
||||
|
||||
|
||||
|
||||
x_%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -Wall -fpic -fvisibility=hidden -pedantic \
|
||||
-I. -D LIBRARY -c -fno-exceptions $< -o x_$*.o
|
||||
|
||||
$(LIB_NAME): $(OBJS2)
|
||||
$(CXX) -shared -Wl,-soname,$(LIB_NAME).$(LIB_VERSION) -o $@ $(OBJS2) $(LIBS2)
|
||||
|
||||
$(STATIC_LIB_NAME): $(OBJS2)
|
||||
$(AR) cqs $(STATIC_LIB_NAME) $(OBJS2)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a *~
|
||||
|
||||
distclean: clean
|
||||
rm -f $(BIN_NAME)
|
||||
rm -f $(BIN2_NAME)
|
||||
rm -f $(LIB_NAME)*
|
||||
|
||||
install: all
|
||||
# Create directories
|
||||
rm -rf $(DESTDIR)$(DATADIR)
|
||||
$(MKDIR) $(DESTDIR)$(BINDIR)
|
||||
$(MKDIR) $(DESTDIR)$(LIBDIR)
|
||||
$(MKDIR) $(DESTDIR)$(INCDIR)
|
||||
$(MKDIR) $(DESTDIR)$(DATADIR)
|
||||
# Install espeak executable
|
||||
$(INSTALL) -m 755 $(BIN2_NAME) $(DESTDIR)$(BINDIR)
|
||||
# Install shared library
|
||||
$(INSTALL) -m 755 $(LIB_NAME).$(LIBTAG) $(DESTDIR)$(LIBDIR)
|
||||
# Install static library
|
||||
$(INSTALL) -m 755 $(STATIC_LIB_NAME) $(DESTDIR)$(LIBDIR)
|
||||
$(LN_SF) $(LIB_NAME).$(LIBTAG) $(DESTDIR)$(LIBDIR)/$(LIB_NAME).$(LIB_VERSION)
|
||||
$(LN_SF) $(LIB_NAME).$(LIB_VERSION) $(DESTDIR)$(LIBDIR)/$(LIB_NAME)
|
||||
# Install development headers
|
||||
$(INSTALL) -pm 644 speak_lib.h $(DESTDIR)$(INCDIR)
|
||||
# Install data files
|
||||
cp -prf ../espeak-data/* $(DESTDIR)$(DATADIR)
|
||||
|
||||
+1
-1
@@ -886,7 +886,7 @@ static int GetVowelStress(Translator *tr, unsigned char *phonemes, unsigned char
|
||||
|
||||
|
||||
static char stress_phonemes[] = {phonSTRESS_U, phonSTRESS_D, phonSTRESS_2, phonSTRESS_3,
|
||||
phonSTRESS_P, phonSTRESS_TONIC, phonSTRESS_TONIC};
|
||||
phonSTRESS_P, phonSTRESS_P2, phonSTRESS_TONIC};
|
||||
|
||||
|
||||
void ChangeWordStress(Translator *tr, char *word, int new_stress)
|
||||
|
||||
+24
-21
@@ -39,6 +39,7 @@ typedef struct {
|
||||
char stress;
|
||||
char env;
|
||||
char flags; //bit 0=pitch rising, bit1=emnphasized
|
||||
char nextph_type;
|
||||
short pitch1;
|
||||
short pitch2;
|
||||
} SYLLABLE;
|
||||
@@ -901,6 +902,28 @@ void Translator::CalcPitches(int clause_type)
|
||||
SYLLABLE syllable_tab2[N_PHONEME_LIST];
|
||||
|
||||
syllable_tab = syllable_tab2; // don't use permanent storage. it's only needed during the call of CalcPitches()
|
||||
n_st = 0;
|
||||
n_primary = 0;
|
||||
for(ix=0; ix<(n_phoneme_list-1); ix++)
|
||||
{
|
||||
p = &phoneme_list[ix];
|
||||
if(p->synthflags & SFLAG_SYLLABLE)
|
||||
{
|
||||
syllable_tab[n_st].flags = 0;
|
||||
syllable_tab[n_st].env = PITCHfall;
|
||||
syllable_tab[n_st].nextph_type = phoneme_list[ix+1].type;
|
||||
syllable_tab[n_st++].stress = p->tone; // stress level
|
||||
|
||||
if(p->tone >= 4)
|
||||
n_primary++;
|
||||
}
|
||||
}
|
||||
syllable_tab[n_st].stress = 0; // extra 0 entry at the end
|
||||
|
||||
if(n_st == 0)
|
||||
return; // nothing to do
|
||||
|
||||
|
||||
|
||||
if(langopts.tone_language == 1)
|
||||
{
|
||||
@@ -921,26 +944,6 @@ void Translator::CalcPitches(int clause_type)
|
||||
else
|
||||
no_tonic = 0;
|
||||
|
||||
n_st = 0;
|
||||
n_primary = 0;
|
||||
for(ix=0; ix<n_phoneme_list; ix++)
|
||||
{
|
||||
p = &phoneme_list[ix];
|
||||
if(p->synthflags & SFLAG_SYLLABLE)
|
||||
{
|
||||
syllable_tab[n_st].flags = 0;
|
||||
syllable_tab[n_st].env = PITCHfall;
|
||||
syllable_tab[n_st++].stress = p->tone; // stress level
|
||||
|
||||
if(p->tone >= 4)
|
||||
n_primary++;
|
||||
}
|
||||
}
|
||||
syllable_tab[n_st].stress = 0; // extra 0 entry at the end
|
||||
|
||||
if(n_st == 0)
|
||||
return; // nothing to do
|
||||
|
||||
st_start = 0;
|
||||
count_primary=0;
|
||||
for(st_ix=0; st_ix<n_st; st_ix++)
|
||||
@@ -952,7 +955,7 @@ void Translator::CalcPitches(int clause_type)
|
||||
|
||||
if(syl->stress == 6)
|
||||
{
|
||||
// reduce the stress of the previous stressed syllable
|
||||
// reduce the stress of the previous stressed syllable (review only the previous few syllables)
|
||||
for(ix=st_ix-1; ix>=st_start && ix>=(st_ix-3); ix--)
|
||||
{
|
||||
if(syllable_tab[ix].stress == 6)
|
||||
|
||||
+2
-1
@@ -65,7 +65,7 @@
|
||||
#define phonSTRESS_2 4
|
||||
#define phonSTRESS_3 5
|
||||
#define phonSTRESS_P 6
|
||||
#define phonSTRESS_TONIC 7
|
||||
#define phonSTRESS_P2 7 // priority stress within a word
|
||||
#define phonSTRESS_PREV 8
|
||||
#define phonPAUSE 9
|
||||
#define phonPAUSE_SHORT 10
|
||||
@@ -84,6 +84,7 @@
|
||||
#define phonPAUSE_VSHORT 23
|
||||
#define phonPAUSE_LONG 24
|
||||
#define phonT_REDUCED 25
|
||||
#define phonSTRESS_TONIC 26
|
||||
extern const unsigned char pause_phonemes[8]; // 0, vshort, short, pause, long, glottalstop
|
||||
|
||||
// place of articulation
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.30.14 15.Jan.08";
|
||||
const char *version_string = "1.30.15 17.Jan.08";
|
||||
const int version_phdata = 0x013010;
|
||||
|
||||
int option_device_number = -1;
|
||||
|
||||
@@ -487,7 +487,7 @@ SetLengthMods(tr,3); // all equal
|
||||
case L('n','o'): // Norwegian
|
||||
{
|
||||
static const unsigned char stress_amps_no[] = {16,16, 20,20, 20,24, 24,22 };
|
||||
static const short stress_lengths_no[8] = {160,140, 200,190, 0,0, 220,210};
|
||||
static const short stress_lengths_no[8] = {160,140, 200,200, 0,0, 220,210};
|
||||
tr = new Translator();
|
||||
SetupTranslator(tr,stress_lengths_no,stress_amps_no);
|
||||
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ static char translator2_language[20] = {0};
|
||||
FILE *f_trans = NULL; // phoneme output text
|
||||
int option_tone1 = 0;
|
||||
int option_tone2 = 0;
|
||||
int option_tone_flags = 0; // bit 8=emphasize allcaps, bit 9=emphasize penultimate stress
|
||||
int option_tone_flags = 0x100; // bit 8=emphasize allcaps, bit 9=emphasize penultimate stress
|
||||
int option_phonemes = 0;
|
||||
int option_phoneme_events = 0;
|
||||
int option_quiet = 0;
|
||||
|
||||
+20
-35
@@ -50,17 +50,17 @@ enum {ONE_BILLION=1000000000};
|
||||
|
||||
#ifdef USE_PULSEAUDIO
|
||||
|
||||
|
||||
static t_wave_callback* my_callback_is_output_enabled=NULL;
|
||||
|
||||
#define SAMPLE_RATE 22050
|
||||
#define FRAMES_PER_BUFFER 512
|
||||
#define BUFFER_LENGTH (SAMPLE_RATE*2*sizeof(uint16_t))
|
||||
#define THRESHOLD (BUFFER_LENGTH/5)
|
||||
|
||||
#define ESPEAK_FORMAT PA_SAMPLE_S16LE
|
||||
#define ESPEAK_CHANNEL 1
|
||||
|
||||
#define MAXLENGTH 132300
|
||||
#define TLENGTH 4410
|
||||
#define PREBUF 2200
|
||||
#define MINREQ 880
|
||||
#define FRAGSIZE 0
|
||||
|
||||
static pa_context *context = NULL;
|
||||
static pa_stream *stream = NULL;
|
||||
@@ -514,15 +514,11 @@ static int pulse_open()
|
||||
|
||||
pa_buffer_attr a_attr;
|
||||
|
||||
// TBD
|
||||
a_attr.maxlength=132300;
|
||||
a_attr.tlength=8820; //88200
|
||||
// a_attr.tlength=10000; //88200
|
||||
a_attr.prebuf=2200;
|
||||
a_attr.minreq=880;
|
||||
a_attr.fragsize=882;
|
||||
|
||||
|
||||
a_attr.maxlength = MAXLENGTH;
|
||||
a_attr.tlength = TLENGTH;
|
||||
a_attr.prebuf = PREBUF;
|
||||
a_attr.minreq = MINREQ;
|
||||
a_attr.fragsize = 0;
|
||||
|
||||
SHOW_TIME("pa_connect_playback");
|
||||
if (pa_stream_connect_playback(stream, NULL, &a_attr, (pa_stream_flags_t)(PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE), &volume, NULL) < 0) {
|
||||
@@ -634,21 +630,6 @@ void wave_set_callback_is_output_enabled(t_wave_callback* cb)
|
||||
//>
|
||||
//<wave_init
|
||||
|
||||
void display_buffer()
|
||||
{
|
||||
|
||||
const pa_buffer_attr *a_attr = pa_stream_get_buffer_attr (stream);
|
||||
|
||||
if (a_attr)
|
||||
{
|
||||
SHOW("attr> maxlength=%ld\n",a_attr->maxlength);
|
||||
SHOW("attr> tlength=%ld\n",a_attr->tlength);
|
||||
SHOW("attr> prebuf=%ld\n",a_attr->prebuf);
|
||||
SHOW("attr> minreq=%ld\n",a_attr->minreq);
|
||||
SHOW("attr> fragsize=%ld\n",a_attr->fragsize);
|
||||
}
|
||||
}
|
||||
|
||||
void wave_init()
|
||||
{
|
||||
ENTER("wave_init");
|
||||
@@ -656,15 +637,12 @@ void wave_init()
|
||||
stream = NULL;
|
||||
|
||||
pulse_open();
|
||||
|
||||
display_buffer();
|
||||
|
||||
}
|
||||
|
||||
//>
|
||||
//<wave_open
|
||||
|
||||
void* wave_open(char* the_api)
|
||||
void* wave_open(const char* the_api)
|
||||
{
|
||||
ENTER("wave_open");
|
||||
return((void*)1);
|
||||
@@ -698,9 +676,16 @@ size_t wave_write(void* theHandler, char* theMono16BitsWaveBuffer, size_t theSiz
|
||||
SHOW("wave_write > aTotalFreeMem(%d) >= bytes_to_write(%d)\n", aTotalFreeMem, bytes_to_write);
|
||||
break;
|
||||
}
|
||||
|
||||
// TBD: check if really helpful
|
||||
if (aTotalFreeMem >= MAXLENGTH*2)
|
||||
{
|
||||
aTotalFreeMem = MAXLENGTH*2;
|
||||
}
|
||||
|
||||
SHOW("wave_write > wait: aTotalFreeMem(%d) < bytes_to_write(%d)\n", aTotalFreeMem, bytes_to_write);
|
||||
|
||||
// 500: threshold for avoiding to many calls to pulse_write
|
||||
// 500: threshold for avoiding too many calls to pulse_write
|
||||
if (aTotalFreeMem>500)
|
||||
{
|
||||
pulse_write(aBuffer, aTotalFreeMem);
|
||||
@@ -821,7 +806,7 @@ void *wave_test_get_write_buffer()
|
||||
|
||||
|
||||
void wave_init() {}
|
||||
void* wave_open(char* the_api) {return (void *)1;}
|
||||
void* wave_open(const char* the_api) {return (void *)1;}
|
||||
size_t wave_write(void* theHandler, char* theMono16BitsWaveBuffer, size_t theSize) {return theSize;}
|
||||
int wave_close(void* theHandler) {return 0;}
|
||||
int wave_is_busy(void* theHandler) {return 0;}
|
||||
|
||||
Reference in New Issue
Block a user