mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-17 18:40:50 +00:00
Merge branch 'master' into build
Conflicts: src/compiledata.cpp
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
|
||||
|
||||
|
||||
// 13.02.10 jonsd: Changed for eSpeak version 1.43
|
||||
// 14.09.10 Recognize long and short frames in phondata
|
||||
// 02.09.10 Fix: Q sections were omitted from the converted phondata
|
||||
// 13.08.10 jonsd: Added Q lines. Use Address to set the displacement in phondata file.
|
||||
// 13.02.10 jonsd: Changed for eSpeak version 1.43
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -10,6 +11,7 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN
|
||||
#define IS_BIG_ENDIAN 1
|
||||
@@ -57,7 +59,8 @@ typedef struct {
|
||||
|
||||
|
||||
// This is a new format for eSpeak 1.41
|
||||
typedef struct { // 44 bytes
|
||||
#define FRFLAG_KLATT 0x01 // this frame includes extra data for Klatt synthesizer
|
||||
typedef struct { // 64 bytes
|
||||
short frflags;
|
||||
short ffreq[7];
|
||||
unsigned char length;
|
||||
@@ -70,28 +73,29 @@ typedef struct { // 44 bytes
|
||||
unsigned char klattp2[5]; // continuation of klattp[], Avp, Fric, FricBP, Turb
|
||||
unsigned char klatt_ap[7]; // Klatt parallel amplitude
|
||||
unsigned char klatt_bp[7]; // Klatt parallel bandwidth /2
|
||||
unsigned char spare; // pad to multiple of 4 bytes
|
||||
} frame_t; // with extra Klatt parameters for parallel resonators
|
||||
|
||||
typedef struct { // 44 bytes
|
||||
short frflags;
|
||||
short ffreq[7];
|
||||
unsigned char length;
|
||||
unsigned char rms;
|
||||
unsigned char fheight[8];
|
||||
unsigned char fwidth[6]; // width/4 f0-5
|
||||
unsigned char fright[3]; // width/4 f0-2
|
||||
unsigned char bw[4]; // Klatt bandwidth BNZ /2, f1,f2,f3
|
||||
unsigned char klattp[5]; // AV, FNZ, Tilt, Aspr, Skew
|
||||
} frame_t2;
|
||||
|
||||
|
||||
#ifdef deleted
|
||||
// This is the previous format for versions before 1.41
|
||||
typedef struct {
|
||||
short frflags;
|
||||
unsigned char length;
|
||||
unsigned char rms;
|
||||
short ffreq[9];
|
||||
unsigned char fheight[9];
|
||||
unsigned char fwidth[6];
|
||||
unsigned char fright[6];
|
||||
} frame_t;
|
||||
#endif
|
||||
|
||||
#define N_SEQ_FRAMES 25
|
||||
|
||||
typedef struct {
|
||||
short length;
|
||||
unsigned char n_frames;
|
||||
unsigned char flags;
|
||||
unsigned char sqflags;
|
||||
frame_t frame[N_SEQ_FRAMES];
|
||||
} SPECT_SEQ;
|
||||
|
||||
@@ -106,6 +110,23 @@ void usage (const char *program_name);
|
||||
int xread; // prevent compiler warning from fread()
|
||||
|
||||
|
||||
int GetFileLength(const char *filename)
|
||||
{//====================================
|
||||
struct stat statbuf;
|
||||
|
||||
if(stat(filename,&statbuf) != 0)
|
||||
return(0);
|
||||
|
||||
if((statbuf.st_mode & S_IFMT) == S_IFDIR)
|
||||
// if(S_ISDIR(statbuf.st_mode))
|
||||
return(-2); // a directory
|
||||
|
||||
return(statbuf.st_size);
|
||||
} // end of GetFileLength
|
||||
|
||||
|
||||
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{//==============================
|
||||
const char *indir = "/usr/share/espeak-data";
|
||||
@@ -147,6 +168,19 @@ int main (int argc, char *argv[])
|
||||
printf ("Host seems to be little-endian ..\n");
|
||||
#endif
|
||||
|
||||
sprintf (f1, "%s/phondata", indir);
|
||||
sprintf (f2, "%s/temp_1", outdir);
|
||||
|
||||
printf ("Processing phondata ..\n");
|
||||
swap_phondata (f1, f2, manifest);
|
||||
if(GetFileLength(f1) != GetFileLength(f2))
|
||||
{
|
||||
fprintf(stderr, "Error: phondata length is different from the original\n");
|
||||
exit(1);
|
||||
}
|
||||
sprintf (f1, "%s/phondata", outdir);
|
||||
rename (f2, f1);
|
||||
|
||||
sprintf (f1, "%s/phontab", indir);
|
||||
sprintf (f2, "%s/temp_1", outdir);
|
||||
|
||||
@@ -163,14 +197,6 @@ int main (int argc, char *argv[])
|
||||
sprintf (f1, "%s/phonindex", outdir);
|
||||
rename (f2, f1);
|
||||
|
||||
sprintf (f1, "%s/phondata", indir);
|
||||
sprintf (f2, "%s/temp_1", outdir);
|
||||
|
||||
printf ("Processing phondata ..\n");
|
||||
swap_phondata (f1, f2, manifest);
|
||||
sprintf (f1, "%s/phondata", outdir);
|
||||
rename (f2, f1);
|
||||
|
||||
free (f1);
|
||||
free (f2);
|
||||
|
||||
@@ -218,34 +244,40 @@ void swap_phondata (const char *infile, const char *outfile,
|
||||
|
||||
if (line[0] == 'S') {
|
||||
SPECT_SEQ buf_spect;
|
||||
size_t ix;
|
||||
size_t frame_start;
|
||||
int n;
|
||||
|
||||
xread = fread (&buf_spect.length, 2, 1, in);
|
||||
xread = fread (&buf_spect.n_frames, 1, 1, in);
|
||||
fseek (in, -3, SEEK_CUR);
|
||||
|
||||
ix = (char *)(&buf_spect.frame[buf_spect.n_frames]) -
|
||||
(char *)(&buf_spect);
|
||||
ix = (ix+3) & 0xfffc;
|
||||
|
||||
xread = fread (&buf_spect, ix, 1, in);
|
||||
|
||||
xread = fread(&buf_spect, 4, 1, in);
|
||||
buf_spect.length = (short) SWAP_USHORT (buf_spect.length);
|
||||
fwrite(&buf_spect, 4, 1, out);
|
||||
|
||||
for (n = 0; n < buf_spect.n_frames; n++) {
|
||||
int k;
|
||||
|
||||
buf_spect.frame[n].frflags = (short)
|
||||
SWAP_USHORT (buf_spect.frame[n].frflags);
|
||||
frame_start = ftell(in);
|
||||
xread = fread(&buf_spect.frame[0], sizeof(frame_t), 1, in);
|
||||
|
||||
buf_spect.frame[0].frflags = (short)
|
||||
SWAP_USHORT (buf_spect.frame[0].frflags);
|
||||
|
||||
// Changed for eSpeak 1.41
|
||||
for (k = 0; k < 7; k++) {
|
||||
buf_spect.frame[n].ffreq[k] = (short)
|
||||
SWAP_USHORT (buf_spect.frame[n].ffreq[k]);
|
||||
buf_spect.frame[0].ffreq[k] = (short)
|
||||
SWAP_USHORT (buf_spect.frame[0].ffreq[k]);
|
||||
}
|
||||
}
|
||||
|
||||
fwrite (&buf_spect, ix, 1, out);
|
||||
// is this a long or a short frame?
|
||||
if(buf_spect.frame[0].frflags & FRFLAG_KLATT)
|
||||
{
|
||||
fwrite(&buf_spect.frame[0], sizeof(frame_t), 1, out);
|
||||
fseek(in, frame_start + sizeof(frame_t), SEEK_SET);
|
||||
}
|
||||
else
|
||||
{
|
||||
fwrite(&buf_spect.frame[0], sizeof(frame_t2), 1, out);
|
||||
fseek(in, frame_start + sizeof(frame_t2), SEEK_SET);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (line[0] == 'W') {
|
||||
long pos;
|
||||
@@ -286,6 +318,24 @@ void swap_phondata (const char *infile, const char *outfile,
|
||||
xread = fread (env_buf, 1, 128, in);
|
||||
fwrite (env_buf, 1, 128, out);
|
||||
}
|
||||
else if (line[0] == 'Q') {
|
||||
unsigned char pb[4];
|
||||
unsigned length;
|
||||
char *buf;
|
||||
|
||||
xread = fread (pb, 1, 4, in);
|
||||
fwrite (pb, 1, 4, out);
|
||||
|
||||
length = (pb[2] << 8) + pb[3]; // size in words
|
||||
length *= 4;
|
||||
|
||||
buf = (char *) malloc (length);
|
||||
|
||||
xread = fread (buf, length, 1, in);
|
||||
fwrite (buf, length, 1, out);
|
||||
|
||||
free (buf);
|
||||
}
|
||||
}
|
||||
|
||||
fclose (in);
|
||||
|
||||
@@ -609,6 +609,14 @@ SOURCE=.\src\sintab.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\sonic.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\sonic.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\speak_lib.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
// comment this out when compiling the "speak" process
|
||||
//#define SPECT_EDITOR
|
||||
#define INCLUDE_KLATT
|
||||
#define INCLUDE_MBROLA
|
||||
|
||||
#include <windows.h>
|
||||
#define PLATFORM_WINDOWS
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
// comment this out when compiling the "speak" process
|
||||
//#define SPECT_EDITOR
|
||||
#define INCLUDE_KLATT
|
||||
#define INCLUDE_MBROLA
|
||||
|
||||
#include <windows.h>
|
||||
#define PLATFORM_WINDOWS
|
||||
|
||||
@@ -118,6 +118,10 @@ SOURCE=.\src\setlengths.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\sonic.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\speak.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -171,6 +175,10 @@ SOURCE=.\src\sintab.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\sonic.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\speak_lib.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#define NO_VARIADIC_MACROS
|
||||
#define ESPEAK_API
|
||||
#define INCLUDE_KLATT
|
||||
#define INCLUDE_MBROLA
|
||||
|
||||
// will look for espeak_data directory here, and also in user's home directory
|
||||
#define PATH_ESPEAK_DATA "/usr/share/espeak-data"
|
||||
|
||||
@@ -109,6 +109,10 @@ SOURCE=.\src\klatt.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\sonic.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\numbers.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -174,6 +178,10 @@ SOURCE=.\src\klatt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\sonic.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\phoneme.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SPEAK_LIB_H
|
||||
#define SPEAK_LIB_H
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2005 to 2007 by Jonathan Duddington *
|
||||
* Copyright (C) 2005 to 2010 by Jonathan Duddington *
|
||||
* email: jonsd@users.sourceforge.net *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -24,11 +24,11 @@
|
||||
/* This is the header file for the library version of espeak */
|
||||
/* */
|
||||
/*************************************************************/
|
||||
#define ESPEAK_API __declspec(dllexport)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define ESPEAK_API_REVISION 5
|
||||
#define ESPEAK_API_REVISION 6
|
||||
/*
|
||||
Revision 2
|
||||
Added parameter "options" to eSpeakInitialize()
|
||||
@@ -41,11 +41,19 @@ Revision 4
|
||||
|
||||
Revision 5
|
||||
Added espeakCHARS_16BIT
|
||||
|
||||
Revision 6
|
||||
Added macros: espeakRATE_MINIMUM, espeakRATE_MAXIMUM, espeakRATE_NORMAL
|
||||
*/
|
||||
/********************/
|
||||
/* Initialization */
|
||||
/********************/
|
||||
|
||||
// values for 'value' in espeak_SetParameter(espeakRATE, value, 0), nominally in words-per-minute
|
||||
#define espeakRATE_MINIMUM 80
|
||||
#define espeakRATE_MAXIMUM 450
|
||||
#define espeakRATE_NORMAL 175
|
||||
|
||||
|
||||
typedef enum {
|
||||
espeakEVENT_LIST_TERMINATED = 0, // Retrieval mode: terminates the event list.
|
||||
@@ -74,7 +82,7 @@ typedef struct {
|
||||
const char *name; // used for MARK and PLAY events. UTF8 string
|
||||
} id;
|
||||
} espeak_EVENT;
|
||||
/*
|
||||
/*
|
||||
When a message is supplied to espeak_synth, the request is buffered and espeak_synth returns. When the message is really processed, the callback function will be repetedly called.
|
||||
|
||||
|
||||
@@ -82,16 +90,16 @@ typedef struct {
|
||||
|
||||
In PLAYBACK mode, the callback function is called as soon as an event happens.
|
||||
|
||||
For example suppose that the following message is supplied to espeak_Synth:
|
||||
For example suppose that the following message is supplied to espeak_Synth:
|
||||
"hello, hello."
|
||||
|
||||
|
||||
* Once processed in RETRIEVAL mode, it could lead to 3 calls of the callback function :
|
||||
|
||||
** Block 1:
|
||||
<audio data> +
|
||||
<audio data> +
|
||||
List of events: SENTENCE + WORD + LIST_TERMINATED
|
||||
|
||||
|
||||
** Block 2:
|
||||
<audio data> +
|
||||
List of events: WORD + END + LIST_TERMINATED
|
||||
@@ -128,11 +136,11 @@ typedef enum {
|
||||
|
||||
typedef enum {
|
||||
/* PLAYBACK mode: plays the audio data, supplies events to the calling program*/
|
||||
AUDIO_OUTPUT_PLAYBACK,
|
||||
AUDIO_OUTPUT_PLAYBACK,
|
||||
|
||||
/* RETRIEVAL mode: supplies audio data and events to the calling program */
|
||||
AUDIO_OUTPUT_RETRIEVAL,
|
||||
|
||||
|
||||
/* SYNCHRONOUS mode: as RETRIEVAL but doesn't return until synthesis is completed */
|
||||
AUDIO_OUTPUT_SYNCHRONOUS,
|
||||
|
||||
@@ -153,7 +161,7 @@ typedef enum {
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output, int buflength, const char *path, int options);
|
||||
int espeak_Initialize(espeak_AUDIO_OUTPUT output, int buflength, const char *path, int options);
|
||||
/* Must be called before any synthesis functions are called.
|
||||
output: the audio data can either be played by eSpeak or passed back by the SynthCallback function.
|
||||
|
||||
@@ -172,10 +180,10 @@ typedef int (t_espeak_callback)(short*, int, espeak_EVENT*);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API void espeak_SetSynthCallback(t_espeak_callback* SynthCallback);
|
||||
void espeak_SetSynthCallback(t_espeak_callback* SynthCallback);
|
||||
/* Must be called before any synthesis functions are called.
|
||||
This specifies a function in the calling program which is called when a buffer of
|
||||
speech sound data has been produced.
|
||||
speech sound data has been produced.
|
||||
|
||||
|
||||
The callback function is of the form:
|
||||
@@ -200,7 +208,7 @@ int SynthCallback(short *wav, int numsamples, espeak_EVENT *events);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API void espeak_SetUriCallback(int (*UriCallback)(int, const char*, const char*));
|
||||
void espeak_SetUriCallback(int (*UriCallback)(int, const char*, const char*));
|
||||
/* This function may be called before synthesis functions are used, in order to deal with
|
||||
<audio> tags. It specifies a callback function which is called when an <audio> element is
|
||||
encountered and allows the calling program to indicate whether the sound file which
|
||||
@@ -241,7 +249,7 @@ int UriCallback(int type, const char *uri, const char *base);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API espeak_ERROR espeak_Synth(const void *text,
|
||||
espeak_ERROR espeak_Synth(const void *text,
|
||||
size_t size,
|
||||
unsigned int position,
|
||||
espeak_POSITION_TYPE position_type,
|
||||
@@ -264,7 +272,7 @@ ESPEAK_API espeak_ERROR espeak_Synth(const void *text,
|
||||
start of the text.
|
||||
|
||||
position_type: Determines whether "position" is a number of characters, words, or sentences.
|
||||
Values:
|
||||
Values:
|
||||
|
||||
end_position: If set, this gives a character position at which speaking will stop. A value
|
||||
of zero indicates no end position.
|
||||
@@ -283,13 +291,13 @@ ESPEAK_API espeak_ERROR espeak_Synth(const void *text,
|
||||
espeakENDPAUSE If set then a sentence pause is added at the end of the text. If not set then
|
||||
this pause is suppressed.
|
||||
|
||||
unique_identifier: message identifier; helpful for identifying later
|
||||
unique_identifier: message identifier; helpful for identifying later
|
||||
data supplied to the callback.
|
||||
|
||||
user_data: pointer which will be passed to the callback function.
|
||||
|
||||
Return: EE_OK: operation achieved
|
||||
EE_BUFFER_FULL: the command can not be buffered;
|
||||
Return: EE_OK: operation achieved
|
||||
EE_BUFFER_FULL: the command can not be buffered;
|
||||
you may try after a while to call the function again.
|
||||
EE_INTERNAL_ERROR.
|
||||
*/
|
||||
@@ -297,7 +305,7 @@ ESPEAK_API espeak_ERROR espeak_Synth(const void *text,
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API espeak_ERROR espeak_Synth_Mark(const void *text,
|
||||
espeak_ERROR espeak_Synth_Mark(const void *text,
|
||||
size_t size,
|
||||
const char *index_mark,
|
||||
unsigned int end_position,
|
||||
@@ -312,8 +320,8 @@ ESPEAK_API espeak_ERROR espeak_Synth_Mark(const void *text,
|
||||
|
||||
For the other parameters, see espeak_Synth()
|
||||
|
||||
Return: EE_OK: operation achieved
|
||||
EE_BUFFER_FULL: the command can not be buffered;
|
||||
Return: EE_OK: operation achieved
|
||||
EE_BUFFER_FULL: the command can not be buffered;
|
||||
you may try after a while to call the function again.
|
||||
EE_INTERNAL_ERROR.
|
||||
*/
|
||||
@@ -321,13 +329,13 @@ ESPEAK_API espeak_ERROR espeak_Synth_Mark(const void *text,
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API espeak_ERROR espeak_Key(const char *key_name);
|
||||
espeak_ERROR espeak_Key(const char *key_name);
|
||||
/* Speak the name of a keyboard key.
|
||||
If key_name is a single character, it speaks the name of the character.
|
||||
Otherwise, it speaks key_name as a text string.
|
||||
|
||||
Return: EE_OK: operation achieved
|
||||
EE_BUFFER_FULL: the command can not be buffered;
|
||||
Return: EE_OK: operation achieved
|
||||
EE_BUFFER_FULL: the command can not be buffered;
|
||||
you may try after a while to call the function again.
|
||||
EE_INTERNAL_ERROR.
|
||||
*/
|
||||
@@ -335,11 +343,11 @@ ESPEAK_API espeak_ERROR espeak_Key(const char *key_name);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API espeak_ERROR espeak_Char(wchar_t character);
|
||||
/* Speak the name of the given character
|
||||
espeak_ERROR espeak_Char(wchar_t character);
|
||||
/* Speak the name of the given character
|
||||
|
||||
Return: EE_OK: operation achieved
|
||||
EE_BUFFER_FULL: the command can not be buffered;
|
||||
Return: EE_OK: operation achieved
|
||||
EE_BUFFER_FULL: the command can not be buffered;
|
||||
you may try after a while to call the function again.
|
||||
EE_INTERNAL_ERROR.
|
||||
*/
|
||||
@@ -380,22 +388,23 @@ typedef enum {
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative);
|
||||
espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative);
|
||||
/* Sets the value of the specified parameter.
|
||||
relative=0 Sets the absolute value of the parameter.
|
||||
relative=1 Sets a relative value of the parameter.
|
||||
|
||||
parameter:
|
||||
espeakRATE: speaking speed in word per minute.
|
||||
espeakRATE: speaking speed in word per minute. Values 80 to 450.
|
||||
|
||||
espeakVOLUME: volume in range 0-100 0=silence
|
||||
espeakVOLUME: volume in range 0-200 or more.
|
||||
0=silence, 100=normal full volume, greater values may produce amplitude compression or distortion
|
||||
|
||||
espeakPITCH: base pitch, range 0-100. 50=normal
|
||||
|
||||
espeakRANGE: pitch range, range 0-100. 0-monotone, 50=normal
|
||||
|
||||
espeakPUNCTUATION: which punctuation characters to announce:
|
||||
value in espeak_PUNCT_TYPE (none, all, some),
|
||||
value in espeak_PUNCT_TYPE (none, all, some),
|
||||
see espeak_GetParameter() to specify which characters are announced.
|
||||
|
||||
espeakCAPITALS: announce capital letters by:
|
||||
@@ -407,8 +416,8 @@ ESPEAK_API espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int valu
|
||||
|
||||
espeakWORDGAP: pause between words, units of 10mS (at the default speed)
|
||||
|
||||
Return: EE_OK: operation achieved
|
||||
EE_BUFFER_FULL: the command can not be buffered;
|
||||
Return: EE_OK: operation achieved
|
||||
EE_BUFFER_FULL: the command can not be buffered;
|
||||
you may try after a while to call the function again.
|
||||
EE_INTERNAL_ERROR.
|
||||
*/
|
||||
@@ -416,7 +425,7 @@ ESPEAK_API espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int valu
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API int espeak_GetParameter(espeak_PARAMETER parameter, int current);
|
||||
int espeak_GetParameter(espeak_PARAMETER parameter, int current);
|
||||
/* current=0 Returns the default value of the specified parameter.
|
||||
current=1 Returns the current value of the specified parameter, as set by SetParameter()
|
||||
*/
|
||||
@@ -424,14 +433,14 @@ ESPEAK_API int espeak_GetParameter(espeak_PARAMETER parameter, int current);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist);
|
||||
espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist);
|
||||
/* Specified a list of punctuation characters whose names are to be spoken when the
|
||||
value of the Punctuation parameter is set to "some".
|
||||
|
||||
punctlist: A list of character codes, terminated by a zero character.
|
||||
|
||||
Return: EE_OK: operation achieved
|
||||
EE_BUFFER_FULL: the command can not be buffered;
|
||||
Return: EE_OK: operation achieved
|
||||
EE_BUFFER_FULL: the command can not be buffered;
|
||||
you may try after a while to call the function again.
|
||||
EE_INTERNAL_ERROR.
|
||||
*/
|
||||
@@ -439,11 +448,12 @@ ESPEAK_API espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API void espeak_SetPhonemeTrace(int value, FILE *stream);
|
||||
void espeak_SetPhonemeTrace(int value, FILE *stream);
|
||||
/* Controls the output of phoneme symbols for the text
|
||||
value=0 No phoneme output (default)
|
||||
value=1 Output the translated phoneme symbols for the text
|
||||
value=2 as (1), but also output a trace of how the translation was done (matching rules and list entries)
|
||||
value=3 as (1), but produces IPA rather than ascii phoneme names
|
||||
|
||||
stream output stream for the phoneme symbols (and trace). If stream=NULL then it uses stdout.
|
||||
*/
|
||||
@@ -451,7 +461,7 @@ ESPEAK_API void espeak_SetPhonemeTrace(int value, FILE *stream);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log, int flags);
|
||||
void espeak_CompileDictionary(const char *path, FILE *log, int flags);
|
||||
/* Compile pronunciation dictionary for a language which corresponds to the currently
|
||||
selected voice. The required voice should be selected before calling this function.
|
||||
|
||||
@@ -475,7 +485,7 @@ typedef struct {
|
||||
unsigned char gender; // 0=none 1=male, 2=female,
|
||||
unsigned char age; // 0=not specified, or age in years
|
||||
unsigned char variant; // only used when passed as a parameter to espeak_SetVoiceByProperties
|
||||
unsigned char xx1; // for internal use
|
||||
unsigned char xx1; // for internal use
|
||||
int score; // for internal use
|
||||
void *spare; // for internal use
|
||||
} espeak_VOICE;
|
||||
@@ -504,24 +514,24 @@ typedef struct {
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec);
|
||||
const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec);
|
||||
/* Reads the voice files from espeak-data/voices and creates an array of espeak_VOICE pointers.
|
||||
The list is terminated by a NULL pointer
|
||||
|
||||
If voice_spec is NULL then all voices are listed.
|
||||
If voice spec is give, then only the voices which are compatible with the voice_spec
|
||||
If voice spec is given, then only the voices which are compatible with the voice_spec
|
||||
are listed, and they are listed in preference order.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API espeak_ERROR espeak_SetVoiceByName(const char *name);
|
||||
espeak_ERROR espeak_SetVoiceByName(const char *name);
|
||||
/* Searches for a voice with a matching "name" field. Language is not considered.
|
||||
"name" is a UTF8 string.
|
||||
|
||||
Return: EE_OK: operation achieved
|
||||
EE_BUFFER_FULL: the command can not be buffered;
|
||||
Return: EE_OK: operation achieved
|
||||
EE_BUFFER_FULL: the command can not be buffered;
|
||||
you may try after a while to call the function again.
|
||||
EE_INTERNAL_ERROR.
|
||||
*/
|
||||
@@ -529,7 +539,7 @@ ESPEAK_API espeak_ERROR espeak_SetVoiceByName(const char *name);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_spec);
|
||||
espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_spec);
|
||||
/* An espeak_VOICE structure is used to pass criteria to select a voice. Any of the following
|
||||
fields may be set:
|
||||
|
||||
@@ -549,7 +559,7 @@ ESPEAK_API espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_spec);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API espeak_VOICE *espeak_GetCurrentVoice(void);
|
||||
espeak_VOICE *espeak_GetCurrentVoice(void);
|
||||
/* Returns the espeak_VOICE data for the currently selected voice.
|
||||
This is not affected by temporary voice changes caused by SSML elements such as <voice> and <s>
|
||||
*/
|
||||
@@ -557,12 +567,12 @@ ESPEAK_API espeak_VOICE *espeak_GetCurrentVoice(void);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API espeak_ERROR espeak_Cancel(void);
|
||||
espeak_ERROR espeak_Cancel(void);
|
||||
/* Stop immediately synthesis and audio output of the current text. When this
|
||||
function returns, the audio output is fully stopped and the synthesizer is ready to
|
||||
synthesize a new message.
|
||||
|
||||
Return: EE_OK: operation achieved
|
||||
Return: EE_OK: operation achieved
|
||||
EE_INTERNAL_ERROR.
|
||||
*/
|
||||
|
||||
@@ -570,25 +580,25 @@ ESPEAK_API espeak_ERROR espeak_Cancel(void);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API int espeak_IsPlaying(void);
|
||||
int espeak_IsPlaying(void);
|
||||
/* Returns 1 if audio is played, 0 otherwise.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API espeak_ERROR espeak_Synchronize(void);
|
||||
espeak_ERROR espeak_Synchronize(void);
|
||||
/* This function returns when all data have been spoken.
|
||||
Return: EE_OK: operation achieved
|
||||
Return: EE_OK: operation achieved
|
||||
EE_INTERNAL_ERROR.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API espeak_ERROR espeak_Terminate(void);
|
||||
espeak_ERROR espeak_Terminate(void);
|
||||
/* last function to be called.
|
||||
Return: EE_OK: operation achieved
|
||||
Return: EE_OK: operation achieved
|
||||
EE_INTERNAL_ERROR.
|
||||
*/
|
||||
|
||||
@@ -596,9 +606,8 @@ ESPEAK_API espeak_ERROR espeak_Terminate(void);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
ESPEAK_API const char *espeak_Info(void* ptr);
|
||||
const char *espeak_Info(void* ptr);
|
||||
/* Returns the version number string.
|
||||
The parameter is for future use, and should be set to NULL
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define ESPEAK_API __declspec(dllexport)
|
||||
#define LIBRARY
|
||||
#define INCLUDE_KLATT
|
||||
#define INCLUDE_MBROLA
|
||||
|
||||
// will look for espeak_data directory here, and also in user's home directory
|
||||
#define PATH_ESPEAK_DATA "/usr/share/espeak-data"
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
//#define USE_PORTAUDIO
|
||||
//#define USE_NANOSLEEP
|
||||
#define INCLUDE_KLATT
|
||||
#define INCLUDE_MBROLA
|
||||
|
||||
// will look for espeak_data directory here, and also in user's home directory
|
||||
#define PATH_ESPEAK_DATA "/usr/share/espeak-data"
|
||||
|
||||
@@ -144,6 +144,10 @@ SOURCE=.\src\setlengths.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\sonic.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\speak_lib.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -237,6 +241,10 @@ SOURCE=.\src\sintab.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\sonic.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\speak_lib.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -261,8 +261,8 @@ static int ConvertRate(int new_rate)
|
||||
|
||||
int rate;
|
||||
|
||||
static int rate_table[21] = {80,110,124,133,142,151,159,168,174,180,187,
|
||||
196,208,220,240,270,300,335,369,390,450 };
|
||||
static int rate_table[21] = {80,110,124,135,145,155,165,173,180,187,196,
|
||||
208,220,245,270,300,335,370,410,450,500 };
|
||||
|
||||
rate = new_rate + master_rate;
|
||||
if(rate < -10) rate = -10;
|
||||
|
||||
Reference in New Issue
Block a user