mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-05 22:53:38 +00:00
[1.46.15]
git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@280 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+1
-1
@@ -161,7 +161,7 @@ static void InitGroups(Translator *tr)
|
||||
|
||||
if(p[0] == RULE_REPLACEMENTS)
|
||||
{
|
||||
pw = (unsigned int *)(((long)p+4) & ~3); // advance to next word boundary
|
||||
pw = (unsigned int *)(((long64)p+4) & ~3); // advance to next word boundary
|
||||
tr->langopts.replace_chars = pw;
|
||||
while(pw[0] != 0)
|
||||
{
|
||||
|
||||
+1
-1
@@ -308,7 +308,7 @@ void MakePhonemeList(Translator *tr, int post_pause, int start_sentence)
|
||||
next = phoneme_tab[plist3->phcode]; // this phoneme, i.e. after the insert
|
||||
|
||||
// re-use the previous entry for the inserted phoneme.
|
||||
// That's OK because we don't look backwards from plist3
|
||||
// That's OK because we don't look backwards from plist3 *** but CountVowelPosiion() and isAfterStress does !!!
|
||||
j--;
|
||||
plist3 = plist3_inserted = &ph_list3[j];
|
||||
if(j > 0)
|
||||
|
||||
+2
-2
@@ -575,7 +575,7 @@ void MarkerEvent(int type, unsigned int char_position, int value, int value2, un
|
||||
if((type == espeakEVENT_MARK) || (type == espeakEVENT_PLAY))
|
||||
ep->id.name = &namedata[value];
|
||||
else
|
||||
#ifdef deleted
|
||||
//#ifdef deleted
|
||||
// temporarily removed, don't introduce until after eSpeak version 1.46.02
|
||||
if(type == espeakEVENT_PHONEME)
|
||||
{
|
||||
@@ -585,7 +585,7 @@ void MarkerEvent(int type, unsigned int char_position, int value, int value2, un
|
||||
p[1] = value2;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
//#endif
|
||||
{
|
||||
ep->id.number = value;
|
||||
}
|
||||
|
||||
+11
-3
@@ -1,7 +1,7 @@
|
||||
#ifndef SPEAK_LIB_H
|
||||
#define SPEAK_LIB_H
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2005 to 2010 by Jonathan Duddington *
|
||||
* Copyright (C) 2005 to 2012 by Jonathan Duddington *
|
||||
* email: jonsd@users.sourceforge.net *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -34,7 +34,7 @@
|
||||
#define ESPEAK_API
|
||||
#endif
|
||||
|
||||
#define ESPEAK_API_REVISION 6
|
||||
#define ESPEAK_API_REVISION 7
|
||||
/*
|
||||
Revision 2
|
||||
Added parameter "options" to eSpeakInitialize()
|
||||
@@ -50,6 +50,11 @@ Revision 5
|
||||
|
||||
Revision 6
|
||||
Added macros: espeakRATE_MINIMUM, espeakRATE_MAXIMUM, espeakRATE_NORMAL
|
||||
|
||||
Revision 7 24.Dec.2011
|
||||
Changed espeak_EVENT structure to add id.string[] for phoneme mnemonics.
|
||||
Added espeakINITIALIZE_PHONEME_IPA option for espeak_Initialize() to report phonemes as IPA names.
|
||||
|
||||
*/
|
||||
/********************/
|
||||
/* Initialization */
|
||||
@@ -84,8 +89,9 @@ typedef struct {
|
||||
int sample; // sample id (internal use)
|
||||
void* user_data; // pointer supplied by the calling program
|
||||
union {
|
||||
int number; // used for WORD and SENTENCE events. For PHONEME events this is the phoneme mnemonic.
|
||||
int number; // used for WORD and SENTENCE events.
|
||||
const char *name; // used for MARK and PLAY events. UTF8 string
|
||||
char string[8]; // used for phoneme names (UTF8). Terminated by a zero byte unless the name needs the full 8 bytes.
|
||||
} id;
|
||||
} espeak_EVENT;
|
||||
/*
|
||||
@@ -164,6 +170,7 @@ typedef enum {
|
||||
} espeak_ERROR;
|
||||
|
||||
#define espeakINITIALIZE_PHONEME_EVENTS 0x0001
|
||||
#define espeakINITIALIZE_PHONEME_IPA 0x0002
|
||||
#define espeakINITIALIZE_DONT_EXIT 0x8000
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -178,6 +185,7 @@ ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output, int buflength, cons
|
||||
path: The directory which contains the espeak-data directory, or NULL for the default location.
|
||||
|
||||
options: bit 0: 1=allow espeakEVENT_PHONEME events.
|
||||
bit 1: 1= espeakEVENT_PHONEME events give IPA phoneme names, not eSpeak phoneme names
|
||||
bit 15: 1=don't exit if espeak_data is not found (used for --help)
|
||||
|
||||
Returns: sample rate in Hz, or -1 (EE_INTERNAL_ERROR).
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@
|
||||
typedef unsigned short USHORT;
|
||||
typedef unsigned char UCHAR;
|
||||
typedef double DOUBLEX;
|
||||
|
||||
typedef unsigned long long64; // use this for conversion between pointers and integers
|
||||
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.46.02 06.Jan.12";
|
||||
const char *version_string = "1.46.14 22.Feb.12";
|
||||
const int version_phdata = 0x014600;
|
||||
|
||||
int option_device_number = -1;
|
||||
|
||||
+37
-28
@@ -142,7 +142,7 @@ static void EndPitch(int voice_break)
|
||||
|
||||
static void DoAmplitude(int amp, unsigned char *amp_env)
|
||||
{//=====================================================
|
||||
long *q;
|
||||
long64 *q;
|
||||
|
||||
last_amp_cmd = wcmdq_tail;
|
||||
amp_length = 0; // total length of vowel with this amplitude envelope
|
||||
@@ -150,7 +150,7 @@ static void DoAmplitude(int amp, unsigned char *amp_env)
|
||||
q = wcmdq[wcmdq_tail];
|
||||
q[0] = WCMD_AMPLITUDE;
|
||||
q[1] = 0; // fill in later from amp_length
|
||||
q[2] = (long)amp_env;
|
||||
q[2] = (long64)amp_env;
|
||||
q[3] = amp;
|
||||
WcmdqInc();
|
||||
} // end of DoAmplitude
|
||||
@@ -159,7 +159,7 @@ static void DoAmplitude(int amp, unsigned char *amp_env)
|
||||
|
||||
static void DoPitch(unsigned char *env, int pitch1, int pitch2)
|
||||
{//============================================================
|
||||
long *q;
|
||||
long64 *q;
|
||||
|
||||
EndPitch(0);
|
||||
|
||||
@@ -179,7 +179,7 @@ static void DoPitch(unsigned char *env, int pitch1, int pitch2)
|
||||
q = wcmdq[wcmdq_tail];
|
||||
q[0] = WCMD_PITCH;
|
||||
q[1] = 0; // length, fill in later from pitch_length
|
||||
q[2] = (long)env;
|
||||
q[2] = (long64)env;
|
||||
q[3] = (pitch1 << 16) + pitch2;
|
||||
WcmdqInc();
|
||||
} // end of DoPitch
|
||||
@@ -248,7 +248,7 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
int min_length;
|
||||
int x;
|
||||
int len4;
|
||||
long *q;
|
||||
long64 *q;
|
||||
unsigned char *p;
|
||||
|
||||
index = index & 0x7fffff;
|
||||
@@ -336,7 +336,7 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
q = wcmdq[wcmdq_tail];
|
||||
q[0] = WCMD_WAVE2;
|
||||
q[1] = length | (wav_length << 16); // length in samples
|
||||
q[2] = long(&wavefile_data[index]);
|
||||
q[2] = long64(&wavefile_data[index]);
|
||||
q[3] = wav_scale + (amp << 8);
|
||||
WcmdqInc();
|
||||
return(length);
|
||||
@@ -357,7 +357,7 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
q = wcmdq[wcmdq_tail];
|
||||
q[0] = WCMD_WAVE;
|
||||
q[1] = x; // length in samples
|
||||
q[2] = long(&wavefile_data[index]);
|
||||
q[2] = long64(&wavefile_data[index]);
|
||||
q[3] = wav_scale + (amp << 8);
|
||||
WcmdqInc();
|
||||
|
||||
@@ -372,7 +372,7 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
q = wcmdq[wcmdq_tail];
|
||||
q[0] = WCMD_WAVE;
|
||||
q[1] = len4*2; // length in samples
|
||||
q[2] = long(&wavefile_data[index+x]);
|
||||
q[2] = long64(&wavefile_data[index+x]);
|
||||
q[3] = wav_scale + (amp << 8);
|
||||
WcmdqInc();
|
||||
|
||||
@@ -388,7 +388,7 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
q = wcmdq[wcmdq_tail];
|
||||
q[0] = WCMD_WAVE;
|
||||
q[1] = length; // length in samples
|
||||
q[2] = long(&wavefile_data[index+x]);
|
||||
q[2] = long64(&wavefile_data[index+x]);
|
||||
q[3] = wav_scale + (amp << 8);
|
||||
WcmdqInc();
|
||||
}
|
||||
@@ -775,7 +775,7 @@ static void SmoothSpect(void)
|
||||
{//==========================
|
||||
// Limit the rate of frequence change of formants, to reduce chirping
|
||||
|
||||
long *q;
|
||||
long64 *q;
|
||||
frame_t *frame;
|
||||
frame_t *frame2;
|
||||
frame_t *frame1;
|
||||
@@ -817,7 +817,7 @@ static void SmoothSpect(void)
|
||||
frame1 = (frame_t *)q[3];
|
||||
if(frame1 == frame)
|
||||
{
|
||||
q[3] = (long)frame2;
|
||||
q[3] = (long64)frame2;
|
||||
frame1 = frame2;
|
||||
}
|
||||
else
|
||||
@@ -865,7 +865,7 @@ static void SmoothSpect(void)
|
||||
modified = 1;
|
||||
}
|
||||
frame2->ffreq[pk] = frame1->ffreq[pk] + allowed;
|
||||
q[2] = (long)frame2;
|
||||
q[2] = (long64)frame2;
|
||||
}
|
||||
else
|
||||
if(diff < -allowed)
|
||||
@@ -876,7 +876,7 @@ static void SmoothSpect(void)
|
||||
modified = 1;
|
||||
}
|
||||
frame2->ffreq[pk] = frame1->ffreq[pk] - allowed;
|
||||
q[2] = (long)frame2;
|
||||
q[2] = (long64)frame2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -907,7 +907,7 @@ static void SmoothSpect(void)
|
||||
{
|
||||
if(frame1 == frame)
|
||||
{
|
||||
q[2] = (long)frame2;
|
||||
q[2] = (long64)frame2;
|
||||
frame1 = frame2;
|
||||
}
|
||||
else
|
||||
@@ -949,7 +949,7 @@ static void SmoothSpect(void)
|
||||
modified = 1;
|
||||
}
|
||||
frame2->ffreq[pk] = frame1->ffreq[pk] + allowed;
|
||||
q[3] = (long)frame2;
|
||||
q[3] = (long64)frame2;
|
||||
}
|
||||
else
|
||||
if(diff < -allowed)
|
||||
@@ -960,7 +960,7 @@ static void SmoothSpect(void)
|
||||
modified = 1;
|
||||
}
|
||||
frame2->ffreq[pk] = frame1->ffreq[pk] - allowed;
|
||||
q[3] = (long)frame2;
|
||||
q[3] = (long64)frame2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -997,7 +997,7 @@ int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_L
|
||||
frame_t *frame2;
|
||||
frame_t *fr;
|
||||
int ix;
|
||||
long *q;
|
||||
long64 *q;
|
||||
int len;
|
||||
int frame_length;
|
||||
int length_factor;
|
||||
@@ -1083,7 +1083,7 @@ if(which==1)
|
||||
&& !(last_frame->frflags & FRFLAG_BREAK))
|
||||
{
|
||||
// last frame of previous sequence was zero-length, replace with first of this sequence
|
||||
wcmdq[last_wcmdq][3] = (long)frame1;
|
||||
wcmdq[last_wcmdq][3] = (long64)frame1;
|
||||
|
||||
if(last_frame->frflags & FRFLAG_BREAK_LF)
|
||||
{
|
||||
@@ -1095,7 +1095,7 @@ if(which==1)
|
||||
fr->ffreq[ix] = last_frame->ffreq[ix];
|
||||
fr->fheight[ix] = last_frame->fheight[ix];
|
||||
}
|
||||
wcmdq[last_wcmdq][3] = (long)fr;
|
||||
wcmdq[last_wcmdq][3] = (long64)fr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1180,8 +1180,8 @@ if(which==1)
|
||||
q = wcmdq[wcmdq_tail];
|
||||
q[0] = wcmd_spect;
|
||||
q[1] = len + (modulation << 16);
|
||||
q[2] = long(frame1);
|
||||
q[3] = long(frame2);
|
||||
q[2] = (long64)frame1;
|
||||
q[3] = (long64)frame2;
|
||||
|
||||
WcmdqInc();
|
||||
}
|
||||
@@ -1254,7 +1254,7 @@ void DoVoiceChange(voice_t *v)
|
||||
v2 = (voice_t *)malloc(sizeof(voice_t));
|
||||
memcpy(v2,v,sizeof(voice_t));
|
||||
wcmdq[wcmdq_tail][0] = WCMD_VOICE;
|
||||
wcmdq[wcmdq_tail][1] = (long)(v2);
|
||||
wcmdq[wcmdq_tail][2] = (long64)v2;
|
||||
WcmdqInc();
|
||||
}
|
||||
|
||||
@@ -1291,7 +1291,7 @@ void DoEmbedded(int *embix, int sourceix)
|
||||
DoPause(10,0); // ensure a break in the speech
|
||||
wcmdq[wcmdq_tail][0] = WCMD_WAVE;
|
||||
wcmdq[wcmdq_tail][1] = soundicon_tab[value].length;
|
||||
wcmdq[wcmdq_tail][2] = (long)soundicon_tab[value].data + 44; // skip WAV header
|
||||
wcmdq[wcmdq_tail][2] = (long64)soundicon_tab[value].data + 44; // skip WAV header
|
||||
wcmdq[wcmdq_tail][3] = 0x1500; // 16 bit data, amp=21
|
||||
WcmdqInc();
|
||||
}
|
||||
@@ -1337,6 +1337,7 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
unsigned char *amp_env;
|
||||
PHONEME_TAB *ph;
|
||||
int use_ipa=0;
|
||||
int done_phoneme_marker;
|
||||
char phoneme_name[16];
|
||||
static int sourceix=0;
|
||||
|
||||
@@ -1424,11 +1425,19 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
if(p->prepause > 0)
|
||||
DoPause(p->prepause,1);
|
||||
|
||||
if(option_phoneme_events && (p->type != phVOWEL) && (p->ph->code != phonEND_WORD))
|
||||
done_phoneme_marker = 0;
|
||||
if(option_phoneme_events && (p->ph->code != phonEND_WORD))
|
||||
{
|
||||
// Note, for vowels, do the phoneme event after the vowel-start
|
||||
WritePhMnemonic(phoneme_name, p->ph, p, use_ipa);
|
||||
DoPhonemeMarker(espeakEVENT_PHONEME, sourceix, 0, phoneme_name);
|
||||
if((p->type == phVOWEL) && (prev->type==phLIQUID || prev->type==phNASAL))
|
||||
{
|
||||
// For vowels following a liquid or nasal, do the phoneme event after the vowel-start
|
||||
}
|
||||
else
|
||||
{
|
||||
WritePhMnemonic(phoneme_name, p->ph, p, use_ipa);
|
||||
DoPhonemeMarker(espeakEVENT_PHONEME, sourceix, 0, phoneme_name);
|
||||
done_phoneme_marker = 1;
|
||||
}
|
||||
}
|
||||
|
||||
switch(p->type)
|
||||
@@ -1733,7 +1742,7 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
DoSpect2(ph, 1, &fmtp, p, modulation);
|
||||
}
|
||||
|
||||
if(option_phoneme_events)
|
||||
if((option_phoneme_events) && (done_phoneme_marker == 0))
|
||||
{
|
||||
WritePhMnemonic(phoneme_name, p->ph, p, use_ipa);
|
||||
DoPhonemeMarker(espeakEVENT_PHONEME, sourceix, 0, phoneme_name);
|
||||
|
||||
+1
-1
@@ -462,7 +462,7 @@ extern unsigned char pitch_adjust_tab[MAX_PITCH_VALUE+1];
|
||||
#define N_WCMDQ 170
|
||||
#define MIN_WCMDQ 25 // need this many free entries before adding new phoneme
|
||||
|
||||
extern long wcmdq[N_WCMDQ][4];
|
||||
extern long64 wcmdq[N_WCMDQ][4];
|
||||
extern int wcmdq_head;
|
||||
extern int wcmdq_tail;
|
||||
|
||||
|
||||
+4
-4
@@ -130,7 +130,7 @@ unsigned char *out_end;
|
||||
int outbuf_size = 0;
|
||||
|
||||
// the queue of operations passed to wavegen from sythesize
|
||||
long wcmdq[N_WCMDQ][4];
|
||||
long64 wcmdq[N_WCMDQ][4];
|
||||
int wcmdq_head=0;
|
||||
int wcmdq_tail=0;
|
||||
|
||||
@@ -1868,7 +1868,7 @@ int WavegenFill2(int fill_zeros)
|
||||
// return: 0 output buffer has been filled
|
||||
// return: 1 input command queue is now empty
|
||||
|
||||
long *q;
|
||||
long64 *q;
|
||||
int length;
|
||||
int result;
|
||||
int marker_type;
|
||||
@@ -1972,8 +1972,8 @@ int WavegenFill2(int fill_zeros)
|
||||
break;
|
||||
|
||||
case WCMD_VOICE:
|
||||
WavegenSetVoice((voice_t *)q[1]);
|
||||
free((voice_t *)q[1]);
|
||||
WavegenSetVoice((voice_t *)q[2]);
|
||||
free((voice_t *)q[2]);
|
||||
break;
|
||||
|
||||
case WCMD_EMBEDDED:
|
||||
|
||||
Reference in New Issue
Block a user