#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include "readclause.h" | |||||
#include "synthdata.h" | |||||
#include "wavegen.h" | |||||
#include "error.h" | #include "error.h" | ||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "voice.h" | #include "voice.h" |
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include "compiledict.h" | |||||
#include "dictionary.h" | |||||
#include "readclause.h" | |||||
#include "error.h" | #include "error.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "translate.h" | #include "translate.h" | ||||
extern void Write4Bytes(FILE *f, int value); | |||||
static FILE *f_log = NULL; | static FILE *f_log = NULL; | ||||
extern char *dir_dictionary; | extern char *dir_dictionary; | ||||
/* | |||||
* Copyright (C) 2005 to 2015 by Jonathan Duddington | |||||
* email: [email protected] | |||||
* Copyright (C) 2015-2018 Reece H. Dunn | |||||
* Copyright (C) 2018 Juho Hiltunen | |||||
* | |||||
* This program is free software; you can redistribute it and/or modify | |||||
* it under the terms of the GNU General Public License as published by | |||||
* the Free Software Foundation; either version 3 of the License, or | |||||
* (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU General Public License | |||||
* along with this program; if not, see: <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#ifndef ESPEAK_NG_COMPILEDICT_H | |||||
#define ESPEAK_NG_COMPILEDICT_H | |||||
#ifdef __cplusplus | |||||
extern "C" | |||||
{ | |||||
#endif | |||||
char *DecodeRule(const char *group_chars, | |||||
int group_length, | |||||
char *rule, | |||||
int control); | |||||
ESPEAK_NG_API espeak_ng_STATUS espeak_ng_CompileDictionary(const char *dsource, | |||||
const char *dict_name, | |||||
FILE *log, | |||||
int flags, | |||||
espeak_ng_ERROR_CONTEXT *context); | |||||
void print_dictionary_flags(unsigned int *flags, | |||||
char *buf, | |||||
int buf_len); | |||||
#ifdef __cplusplus | |||||
} | |||||
#endif | |||||
#endif | |||||
#include <espeak-ng/espeak_ng.h> | #include <espeak-ng/espeak_ng.h> | ||||
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include "mbrola.h" | |||||
#include "error.h" | #include "error.h" | ||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "speech.h" | #include "speech.h" |
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include "dictionary.h" | |||||
#include "numbers.h" | |||||
#include "readclause.h" | |||||
#include "synthdata.h" | |||||
#include "speech.h" | #include "speech.h" | ||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "voice.h" | #include "voice.h" | ||||
} | } | ||||
#pragma GCC visibility pop | #pragma GCC visibility pop | ||||
int Reverse4Bytes(int word) | |||||
static int Reverse4Bytes(int word) | |||||
{ | { | ||||
// reverse the order of bytes from little-endian to big-endian | // reverse the order of bytes from little-endian to big-endian | ||||
#ifdef ARCH_BIG | #ifdef ARCH_BIG |
/* | |||||
* Copyright (C) 2005 to 2015 by Jonathan Duddington | |||||
* email: [email protected] | |||||
* Copyright (C) 2015-2018 Reece H. Dunn | |||||
* Copyright (C) 2018 Juho Hiltunen | |||||
* | |||||
* This program is free software; you can redistribute it and/or modify | |||||
* it under the terms of the GNU General Public License as published by | |||||
* the Free Software Foundation; either version 3 of the License, or | |||||
* (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU General Public License | |||||
* along with this program; if not, see: <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#ifndef ESPEAK_NG_DICTIONARY_H | |||||
#define ESPEAK_NG_DICTIONARY_H | |||||
#include "compiledict.h" | |||||
#include "synthesize.h" | |||||
#include "translate.h" | |||||
#ifdef __cplusplus | |||||
extern "C" | |||||
{ | |||||
#endif | |||||
void strncpy0(char *to, const char *from, int size); | |||||
int LoadDictionary(Translator *tr, const char *name, int no_error); | |||||
int HashDictionary(const char *string); | |||||
const char *EncodePhonemes(const char *p, char *outptr, int *bad_phoneme); | |||||
void DecodePhonemes(const char *inptr, char *outptr); | |||||
char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int use_ipa, int *flags); | |||||
const char *GetTranslatedPhonemeString(int phoneme_mode); | |||||
int IsVowel(Translator *tr, int letter); | |||||
int Unpronouncable(Translator *tr, char *word, int posn); | |||||
void ChangeWordStress(Translator *tr, char *word, int new_stress); | |||||
void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags, int tonic, int control); | |||||
void AppendPhonemes(Translator *tr, char *string, int size, const char *ph); | |||||
int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, char *end_phonemes, int word_flags, unsigned int *dict_flags); | |||||
int TransposeAlphabet(Translator *tr, char *text); | |||||
int Lookup(Translator *tr, const char *word, char *ph_out); | |||||
int LookupDictList(Translator *tr, char **wordptr, char *ph_out, unsigned int *flags, int end_flags, WORD_TAB *wtab); | |||||
int LookupFlags(Translator *tr, const char *word, unsigned int **flags_out); | |||||
int RemoveEnding(Translator *tr, char *word, int end_type, char *word_copy); | |||||
#ifdef __cplusplus | |||||
} | |||||
#endif | |||||
#endif | |||||
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include "compiledict.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "voice.h" | #include "voice.h" | ||||
#include "synthesize.h" | #include "synthesize.h" |
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include "intonation.h" | |||||
#include "synthdata.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "voice.h" | #include "voice.h" | ||||
#include "synthesize.h" | #include "synthesize.h" |
/* | |||||
* Copyright (C) 2005 to 2015 by Jonathan Duddington | |||||
* email: [email protected] | |||||
* Copyright (C) 2015-2018 Reece H. Dunn | |||||
* Copyright (C) 2018 Juho Hiltunen | |||||
* | |||||
* This program is free software; you can redistribute it and/or modify | |||||
* it under the terms of the GNU General Public License as published by | |||||
* the Free Software Foundation; either version 3 of the License, or | |||||
* (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU General Public License | |||||
* along with this program; if not, see: <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#ifndef ESPEAK_NG_INTONATION_H | |||||
#define ESPEAK_NG_INTONATION_H | |||||
#include "translate.h" | |||||
#ifdef __cplusplus | |||||
extern "C" | |||||
{ | |||||
#endif | |||||
void CalcPitches(Translator *tr, int clause_type); | |||||
#ifdef __cplusplus | |||||
} | |||||
#endif | |||||
#endif | |||||
/* | |||||
* Copyright (C) 2005 to 2015 by Jonathan Duddington | |||||
* email: [email protected] | |||||
* Copyright (C) 2015-2018 Reece H. Dunn | |||||
* Copyright (C) 2018 Juho Hiltunen | |||||
* | |||||
* This program is free software; you can redistribute it and/or modify | |||||
* it under the terms of the GNU General Public License as published by | |||||
* the Free Software Foundation; either version 3 of the License, or | |||||
* (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU General Public License | |||||
* along with this program; if not, see: <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
// declarations for compilembrola.c and synth_mbrola.c | |||||
#ifndef ESPEAK_NG_MBROLA_H | |||||
#define ESPEAK_NG_MBROLA_H | |||||
#include <stdbool.h> | |||||
#include "synthesize.h" | |||||
#ifdef __cplusplus | |||||
extern "C" | |||||
{ | |||||
#endif | |||||
typedef struct { | |||||
int name; | |||||
unsigned int next_phoneme; | |||||
int mbr_name; | |||||
int mbr_name2; | |||||
int percent; // percentage length of first component | |||||
int control; | |||||
} MBROLA_TAB; | |||||
extern int mbrola_delay; | |||||
extern char mbrola_name[20]; | |||||
espeak_ng_STATUS LoadMbrolaTable(const char *mbrola_voice, | |||||
const char *phtrans, | |||||
int *srate); | |||||
int MbrolaGenerate(PHONEME_LIST *phoneme_list, | |||||
int *n_ph, bool resume); | |||||
int MbrolaFill(int length, | |||||
bool resume, | |||||
int amplitude); | |||||
void MbrolaReset(void); | |||||
int MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, bool resume, FILE *f_mbrola); | |||||
#ifdef __cplusplus | |||||
} | |||||
#endif | |||||
#endif | |||||
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include "dictionary.h" | |||||
#include "numbers.h" | |||||
#include "readclause.h" | |||||
#include "synthdata.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "voice.h" | #include "voice.h" | ||||
#include "synthesize.h" | #include "synthesize.h" |
/* | |||||
* Copyright (C) 2005 to 2015 by Jonathan Duddington | |||||
* email: [email protected] | |||||
* Copyright (C) 2015-2018 Reece H. Dunn | |||||
* Copyright (C) 2018 Juho Hiltunen | |||||
* | |||||
* This program is free software; you can redistribute it and/or modify | |||||
* it under the terms of the GNU General Public License as published by | |||||
* the Free Software Foundation; either version 3 of the License, or | |||||
* (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU General Public License | |||||
* along with this program; if not, see: <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#ifndef ESPEAK_NG_NUMBERS_H | |||||
#define ESPEAK_NG_NUMBERS_H | |||||
#ifdef __cplusplus | |||||
extern "C" | |||||
{ | |||||
#endif | |||||
void LookupAccentedLetter(Translator *tr, unsigned int letter, char *ph_buf); | |||||
void LookupLetter(Translator *tr, unsigned int letter, int next_byte, char *ph_buf1, int control); | |||||
int IsSuperscript(int letter); | |||||
void SetSpellingStress(Translator *tr, char *phonemes, int control, int n_chars); | |||||
int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab); | |||||
int TranslateNumber(Translator *tr, char *word1, char *ph_out, unsigned int *flags, WORD_TAB *wtab, int control); | |||||
int TranslateLetter(Translator *tr, char *word, char *phonemes, int control); | |||||
#ifdef __cplusplus | |||||
} | |||||
#endif | |||||
#endif | |||||
#define PH(c1, c2) (c2<<8)+c1 // combine two characters into an integer for phoneme name | #define PH(c1, c2) (c2<<8)+c1 // combine two characters into an integer for phoneme name | ||||
#define PH3(c1, c2, c3) (c3<<16)+(c2<<8)+c1 | #define PH3(c1, c2, c3) (c3<<16)+(c2<<8)+c1 | ||||
#define PhonemeCode2(c1, c2) PhonemeCode((c2<<8)+c1) | #define PhonemeCode2(c1, c2) PhonemeCode((c2<<8)+c1) | ||||
int LookupPhonemeString(const char *string); | |||||
int PhonemeCode(unsigned int mnem); | |||||
const char *EncodePhonemes(const char *p, char *outptr, int *bad_phoneme); | |||||
void DecodePhonemes(const char *inptr, char *outptr); | |||||
extern const char *WordToString(unsigned int word); | extern const char *WordToString(unsigned int word); | ||||
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include "phonemelist.h" | |||||
#include "synthdata.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "voice.h" | #include "voice.h" | ||||
#include "synthesize.h" | #include "synthesize.h" |
/* | |||||
* Copyright (C) 2005 to 2015 by Jonathan Duddington | |||||
* email: [email protected] | |||||
* Copyright (C) 2015-2018 Reece H. Dunn | |||||
* Copyright (C) 2018 Juho Hiltunen | |||||
* | |||||
* This program is free software; you can redistribute it and/or modify | |||||
* it under the terms of the GNU General Public License as published by | |||||
* the Free Software Foundation; either version 3 of the License, or | |||||
* (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU General Public License | |||||
* along with this program; if not, see: <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#ifndef ESPEAK_NG_PHONEMELIST_H | |||||
#define ESPEAK_NG_PHONEMELIST_H | |||||
#include "translate.h" | |||||
#ifdef __cplusplus | |||||
extern "C" | |||||
{ | |||||
#endif | |||||
#ifdef __cplusplus | |||||
} | |||||
#endif | |||||
void MakePhonemeList(Translator *tr, int post_pause, bool start_sentence); | |||||
#endif | |||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include <ucd/ucd.h> | #include <ucd/ucd.h> | ||||
#include "dictionary.h" | |||||
#include "readclause.h" | |||||
#include "synthdata.h" | |||||
#include "error.h" | #include "error.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "phoneme.h" | #include "phoneme.h" |
/* | |||||
* Copyright (C) 2005 to 2015 by Jonathan Duddington | |||||
* email: [email protected] | |||||
* Copyright (C) 2015-2018 Reece H. Dunn | |||||
* Copyright (C) 2018 Juho Hiltunen | |||||
* | |||||
* This program is free software; you can redistribute it and/or modify | |||||
* it under the terms of the GNU General Public License as published by | |||||
* the Free Software Foundation; either version 3 of the License, or | |||||
* (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU General Public License | |||||
* along with this program; if not, see: <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#ifndef ESPEAK_NG_READCLAUSE_H | |||||
#define ESPEAK_NG_READCLAUSE_H | |||||
#include "translate.h" | |||||
#ifdef __cplusplus | |||||
extern "C" | |||||
{ | |||||
#endif | |||||
typedef struct { | |||||
int type; | |||||
int parameter[N_SPEECH_PARAM]; | |||||
} PARAM_STACK; | |||||
extern PARAM_STACK param_stack[]; | |||||
extern const int param_defaults[N_SPEECH_PARAM]; | |||||
int clause_type_from_codepoint(uint32_t c); | |||||
int towlower2(unsigned int c); // Supports Turkish I | |||||
int Eof(void); | |||||
const char *WordToString2(unsigned int word); | |||||
int Read4Bytes(FILE *f); | |||||
int LoadSoundFile2(const char *fname); | |||||
int AddNameData(const char *name, | |||||
int wide); | |||||
int ReadClause(Translator *tr, | |||||
char *buf, | |||||
short *charix, | |||||
int *charix_top, | |||||
int n_buf, | |||||
int *tone_type, | |||||
char *voice_change); | |||||
#ifdef __cplusplus | |||||
} | |||||
#endif | |||||
#endif | |||||
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include "readclause.h" | |||||
#include "setlengths.h" | |||||
#include "synthdata.h" | |||||
#include "wavegen.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "voice.h" | #include "voice.h" | ||||
#include "synthesize.h" | #include "synthesize.h" |
/* | |||||
* Copyright (C) 2005 to 2015 by Jonathan Duddington | |||||
* email: [email protected] | |||||
* Copyright (C) 2015-2018 Reece H. Dunn | |||||
* Copyright (C) 2018 Juho Hiltunen | |||||
* | |||||
* This program is free software; you can redistribute it and/or modify | |||||
* it under the terms of the GNU General Public License as published by | |||||
* the Free Software Foundation; either version 3 of the License, or | |||||
* (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU General Public License | |||||
* along with this program; if not, see: <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#ifndef ESPEAK_NG_SETLENGTHS_H | |||||
#define ESPEAK_NG_SETLENGTHS_H | |||||
#include "translate.h" | |||||
#ifdef __cplusplus | |||||
extern "C" | |||||
{ | |||||
#endif | |||||
void CalcLengths(Translator *tr); | |||||
#ifdef __cplusplus | |||||
} | |||||
#endif | |||||
#endif | |||||
#define ESPEAK_NG_SPECT_H | #define ESPEAK_NG_SPECT_H | ||||
#include <espeak-ng/espeak_ng.h> | #include <espeak-ng/espeak_ng.h> | ||||
#include "wavegen.h" | |||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include "dictionary.h" | |||||
#include "mbrola.h" | |||||
#include "readclause.h" | |||||
#include "synthdata.h" | |||||
#include "wavegen.h" | |||||
#include "speech.h" | #include "speech.h" | ||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "voice.h" | #include "voice.h" |
#include <espeak-ng/espeak_ng.h> | #include <espeak-ng/espeak_ng.h> | ||||
#include "mbrola.h" | |||||
#ifdef __cplusplus | #ifdef __cplusplus | ||||
extern "C" | extern "C" | ||||
{ | { |
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include <ucd/ucd.h> | #include <ucd/ucd.h> | ||||
#include "readclause.h" | |||||
#include "error.h" | #include "error.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "phoneme.h" | #include "phoneme.h" |
#define HTML_NOSPACE 16 // don't insert a space for this element, so it doesn't break a word | #define HTML_NOSPACE 16 // don't insert a space for this element, so it doesn't break a word | ||||
#define SSML_CLOSE 0x20 // for a closing tag, OR this with the tag type | #define SSML_CLOSE 0x20 // for a closing tag, OR this with the tag type | ||||
int LoadSoundFile2(const char *fname); | |||||
int AddNameData(const char *name, | |||||
int wide); | |||||
int ProcessSsmlTag(wchar_t *xml_buf, | int ProcessSsmlTag(wchar_t *xml_buf, | ||||
char *outbuf, | char *outbuf, | ||||
int *outix, | int *outix, |
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include "dictionary.h" | |||||
#include "mbrola.h" | |||||
#include "readclause.h" | |||||
#include "synthdata.h" | |||||
#include "wavegen.h" | |||||
#include "speech.h" | #include "speech.h" | ||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "voice.h" | #include "voice.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "translate.h" | #include "translate.h" | ||||
// included here so tests can find these even without OPT_MBROLA set | |||||
int mbrola_delay; | |||||
char mbrola_name[20]; | |||||
#ifdef INCLUDE_MBROLA | #ifdef INCLUDE_MBROLA | ||||
extern int Read4Bytes(FILE *f); | |||||
extern unsigned char *outbuf; | extern unsigned char *outbuf; | ||||
#if defined(_WIN32) || defined(_WIN64) | #if defined(_WIN32) || defined(_WIN64) |
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include "readclause.h" | |||||
#include "synthdata.h" | |||||
#include "error.h" | #include "error.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "phoneme.h" | #include "phoneme.h" |
/* | |||||
* Copyright (C) 2005 to 2015 by Jonathan Duddington | |||||
* email: [email protected] | |||||
* Copyright (C) 2015-2018 Reece H. Dunn | |||||
* Copyright (C) 2018 Juho Hiltunen | |||||
* | |||||
* This program is free software; you can redistribute it and/or modify | |||||
* it under the terms of the GNU General Public License as published by | |||||
* the Free Software Foundation; either version 3 of the License, or | |||||
* (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU General Public License | |||||
* along with this program; if not, see: <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#ifndef ESPEAK_NG_SYNTHDATA_H | |||||
#define ESPEAK_NG_SYNTHDATA_H | |||||
#include "synthesize.h" | |||||
#include "translate.h" | |||||
#ifdef __cplusplus | |||||
extern "C" | |||||
{ | |||||
#endif | |||||
void InterpretPhoneme(Translator *tr, | |||||
int control, | |||||
PHONEME_LIST *plist, | |||||
PHONEME_DATA *phdata, | |||||
WORD_PH_DATA *worddata); | |||||
void InterpretPhoneme2(int phcode, | |||||
PHONEME_DATA *phdata); | |||||
void FreePhData(void); | |||||
unsigned char *GetEnvelope(int index); | |||||
espeak_ng_STATUS LoadPhData(int *srate, espeak_ng_ERROR_CONTEXT *context); | |||||
void LoadConfig(void); | |||||
int LookupPhonemeString(const char *string); | |||||
int LookupPhonemeTable(const char *name); | |||||
frameref_t *LookupSpect(PHONEME_TAB *this_ph, | |||||
int which, | |||||
FMT_PARAMS *fmt_params, | |||||
int *n_frames, | |||||
PHONEME_LIST *plist); | |||||
int NumInstnWords(unsigned short *prog); | |||||
int PhonemeCode(unsigned int mnem); | |||||
void SelectPhonemeTable(int number); | |||||
int SelectPhonemeTableName(const char *name); | |||||
#ifdef __cplusplus | |||||
} | |||||
#endif | |||||
#endif | |||||
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include "dictionary.h" | |||||
#include "intonation.h" | |||||
#include "mbrola.h" | |||||
#include "setlengths.h" | |||||
#include "synthdata.h" | |||||
#include "wavegen.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "voice.h" | #include "voice.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
int n_phoneme_list = 0; | int n_phoneme_list = 0; | ||||
PHONEME_LIST phoneme_list[N_PHONEME_LIST+1]; | PHONEME_LIST phoneme_list[N_PHONEME_LIST+1]; | ||||
int mbrola_delay; | |||||
char mbrola_name[20]; | |||||
SPEED_FACTORS speed; | SPEED_FACTORS speed; | ||||
static int last_pitch_cmd; | static int last_pitch_cmd; |
#define N_PHONEME_LIST 1000 // enough for source[N_TR_SOURCE] full of text, else it will truncate | #define N_PHONEME_LIST 1000 // enough for source[N_TR_SOURCE] full of text, else it will truncate | ||||
#define MAX_HARMONIC 400 // 400 * 50Hz = 20 kHz, more than enough | |||||
#define N_SEQ_FRAMES 25 // max frames in a spectrum sequence (real max is ablut 8) | #define N_SEQ_FRAMES 25 // max frames in a spectrum sequence (real max is ablut 8) | ||||
#define STEPSIZE 64 // 2.9mS at 22 kHz sample rate | #define STEPSIZE 64 // 2.9mS at 22 kHz sample rate | ||||
unsigned char klattp[5]; // AV, FNZ, Tilt, Aspr, Skew | unsigned char klattp[5]; // AV, FNZ, Tilt, Aspr, Skew | ||||
} frame_t2; // without the extra Klatt parameters | } frame_t2; // without the extra Klatt parameters | ||||
// formant data used by wavegen | |||||
typedef struct { | |||||
int freq; // Hz<<16 | |||||
int height; // height<<15 | |||||
int left; // Hz<<16 | |||||
int right; // Hz<<16 | |||||
double freq1; // floating point versions of the above | |||||
double height1; | |||||
double left1; | |||||
double right1; | |||||
double freq_inc; // increment by this every 64 samples | |||||
double height_inc; | |||||
double left_inc; | |||||
double right_inc; | |||||
} wavegen_peaks_t; | |||||
typedef struct { | typedef struct { | ||||
unsigned char *pitch_env; | unsigned char *pitch_env; | ||||
int pitch; // pitch Hz*256 | int pitch; // pitch Hz*256 | ||||
char *filename; | char *filename; | ||||
} SOUND_ICON; | } SOUND_ICON; | ||||
typedef struct { | |||||
int name; | |||||
unsigned int next_phoneme; | |||||
int mbr_name; | |||||
int mbr_name2; | |||||
int percent; // percentage length of first component | |||||
int control; | |||||
} MBROLA_TAB; | |||||
typedef struct { | typedef struct { | ||||
int pause_factor; | int pause_factor; | ||||
int clause_pause_factor; | int clause_pause_factor; | ||||
extern int wcmdq_head; | extern int wcmdq_head; | ||||
extern int wcmdq_tail; | extern int wcmdq_tail; | ||||
// from Wavegen file | |||||
int WcmdqFree(void); | |||||
void WcmdqStop(void); | |||||
int WcmdqUsed(void); | |||||
void WcmdqInc(void); | |||||
void WavegenInit(int rate, int wavemult_fact); | |||||
int WavegenFill(void); | |||||
void MarkerEvent(int type, unsigned int char_position, int value, int value2, unsigned char *out_ptr); | void MarkerEvent(int type, unsigned int char_position, int value, int value2, unsigned char *out_ptr); | ||||
int GetAmplitude(void); | |||||
void SetPitch2(voice_t *voice, int pitch1, int pitch2, int *pitch_base, int *pitch_range); | |||||
int PeaksToHarmspect(wavegen_peaks_t *peaks, int pitch, int *htab, int control); | |||||
extern unsigned char *wavefile_data; | extern unsigned char *wavefile_data; | ||||
extern int samplerate; | extern int samplerate; | ||||
extern int echo_amp; | extern int echo_amp; | ||||
extern short echo_buf[N_ECHO_BUF]; | extern short echo_buf[N_ECHO_BUF]; | ||||
extern int mbrola_delay; | |||||
extern char mbrola_name[20]; | |||||
// from synthdata file | |||||
unsigned int LookupSound(PHONEME_TAB *ph1, PHONEME_TAB *ph2, int which, int *match_level, int control); | |||||
frameref_t *LookupSpect(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, int *n_frames, PHONEME_LIST *plist); | |||||
void FreePhData(void); | |||||
unsigned char *LookupEnvelope(int ix); | |||||
espeak_ng_STATUS LoadPhData(int *srate, espeak_ng_ERROR_CONTEXT *context); | |||||
void SynthesizeInit(void); | void SynthesizeInit(void); | ||||
int Generate(PHONEME_LIST *phoneme_list, int *n_ph, bool resume); | int Generate(PHONEME_LIST *phoneme_list, int *n_ph, bool resume); | ||||
void MakeWave2(PHONEME_LIST *p, int n_ph); | void MakeWave2(PHONEME_LIST *p, int n_ph); | ||||
int SpeakNextClause(int control); | int SpeakNextClause(int control); | ||||
void SetSpeed(int control); | void SetSpeed(int control); | ||||
void SetEmbedded(int control, int value); | void SetEmbedded(int control, int value); | ||||
void SelectPhonemeTable(int number); | |||||
int SelectPhonemeTableName(const char *name); | |||||
int FormantTransition2(frameref_t *seq, int *n_frames, unsigned int data1, unsigned int data2, PHONEME_TAB *other_ph, int which); | int FormantTransition2(frameref_t *seq, int *n_frames, unsigned int data1, unsigned int data2, PHONEME_TAB *other_ph, int which); | ||||
void Write4Bytes(FILE *f, int value); | void Write4Bytes(FILE *f, int value); | ||||
int Read4Bytes(FILE *f); | |||||
int Reverse4Bytes(int word); | |||||
#if HAVE_SONIC_H | #if HAVE_SONIC_H | ||||
void DoSonicSpeed(int value); | void DoSonicSpeed(int value); | ||||
extern int n_soundicon_tab; | extern int n_soundicon_tab; | ||||
extern SOUND_ICON soundicon_tab[N_SOUNDICON_TAB]; | extern SOUND_ICON soundicon_tab[N_SOUNDICON_TAB]; | ||||
espeak_ng_STATUS LoadMbrolaTable(const char *mbrola_voice, const char *phtrans, int *srate); | |||||
espeak_ng_STATUS SetParameter(int parameter, int value, int relative); | espeak_ng_STATUS SetParameter(int parameter, int value, int relative); | ||||
int MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, bool resume, FILE *f_mbrola); | |||||
int MbrolaGenerate(PHONEME_LIST *phoneme_list, int *n_ph, bool resume); | |||||
int MbrolaFill(int length, bool resume, int amplitude); | |||||
void MbrolaReset(void); | |||||
void DoEmbedded(int *embix, int sourceix); | void DoEmbedded(int *embix, int sourceix); | ||||
void DoMarker(int type, int char_posn, int length, int value); | void DoMarker(int type, int char_posn, int length, int value); | ||||
void DoPhonemeMarker(int type, int char_posn, int length, char *name); | void DoPhonemeMarker(int type, int char_posn, int length, char *name); | ||||
int DoSample3(PHONEME_DATA *phdata, int length_mod, int amp); | int DoSample3(PHONEME_DATA *phdata, int length_mod, int amp); | ||||
int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_LIST *plist, int modulation); | int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_LIST *plist, int modulation); | ||||
int PauseLength(int pause, int control); | int PauseLength(int pause, int control); | ||||
int LookupPhonemeTable(const char *name); | |||||
unsigned char *GetEnvelope(int index); | |||||
int NumInstnWords(unsigned short *prog); | |||||
void InitBreath(void); | |||||
#ifdef __cplusplus | #ifdef __cplusplus | ||||
} | } |
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include "dictionary.h" | |||||
#include "numbers.h" | |||||
#include "phonemelist.h" | |||||
#include "readclause.h" | |||||
#include "synthdata.h" | |||||
#include "speech.h" | #include "speech.h" | ||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "voice.h" | #include "voice.h" |
#include <espeak-ng/espeak_ng.h> | #include <espeak-ng/espeak_ng.h> | ||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include "synthesize.h" | |||||
#ifdef __cplusplus | #ifdef __cplusplus | ||||
extern "C" | extern "C" | ||||
{ | { | ||||
#define CLAUSE_COLON (30 | CLAUSE_INTONATION_FULL_STOP | CLAUSE_TYPE_CLAUSE) | #define CLAUSE_COLON (30 | CLAUSE_INTONATION_FULL_STOP | CLAUSE_TYPE_CLAUSE) | ||||
#define CLAUSE_SEMICOLON (30 | CLAUSE_INTONATION_COMMA | CLAUSE_TYPE_CLAUSE) | #define CLAUSE_SEMICOLON (30 | CLAUSE_INTONATION_COMMA | CLAUSE_TYPE_CLAUSE) | ||||
int clause_type_from_codepoint(uint32_t c); | |||||
//@} | //@} | ||||
#define SAYAS_CHARS 0x12 | #define SAYAS_CHARS 0x12 | ||||
unsigned char length; | unsigned char length; | ||||
} WORD_TAB; | } WORD_TAB; | ||||
typedef struct { | |||||
int type; | |||||
int parameter[N_SPEECH_PARAM]; | |||||
} PARAM_STACK; | |||||
extern PARAM_STACK param_stack[]; | |||||
extern const int param_defaults[N_SPEECH_PARAM]; | |||||
typedef struct { | typedef struct { | ||||
const char *name; | const char *name; | ||||
int offset; | int offset; | ||||
extern int (*phoneme_callback)(const char *); | extern int (*phoneme_callback)(const char *); | ||||
extern void SetLengthMods(Translator *tr, int value); | extern void SetLengthMods(Translator *tr, int value); | ||||
void LoadConfig(void); | |||||
int TransposeAlphabet(Translator *tr, char *text); | |||||
#define LEADING_2_BITS 0xC0 // 0b11000000 | #define LEADING_2_BITS 0xC0 // 0b11000000 | ||||
#define UTF8_TAIL_BITS 0x80 // 0b10000000 | #define UTF8_TAIL_BITS 0x80 // 0b10000000 | ||||
int lookupwchar(const unsigned short *list, int c); | int lookupwchar(const unsigned short *list, int c); | ||||
int lookupwchar2(const unsigned short *list, int c); | int lookupwchar2(const unsigned short *list, int c); | ||||
int Eof(void); | |||||
char *strchr_w(const char *s, int c); | char *strchr_w(const char *s, int c); | ||||
int IsBracket(int c); | int IsBracket(int c); | ||||
void InitNamedata(void); | void InitNamedata(void); | ||||
int IsDigit(unsigned int c); | int IsDigit(unsigned int c); | ||||
int IsDigit09(unsigned int c); | int IsDigit09(unsigned int c); | ||||
int IsAlpha(unsigned int c); | int IsAlpha(unsigned int c); | ||||
int IsVowel(Translator *tr, int c); | |||||
int IsSuperscript(int letter); | |||||
int isspace2(unsigned int c); | int isspace2(unsigned int c); | ||||
int towlower2(unsigned int c); // Supports Turkish I | |||||
const char *GetTranslatedPhonemeString(int phoneme_mode); | |||||
const char *WordToString2(unsigned int word); | |||||
ALPHABET *AlphabetFromChar(int c); | ALPHABET *AlphabetFromChar(int c); | ||||
Translator *SelectTranslator(const char *name); | Translator *SelectTranslator(const char *name); | ||||
int SetTranslator2(const char *name); | int SetTranslator2(const char *name); | ||||
void DeleteTranslator(Translator *tr); | void DeleteTranslator(Translator *tr); | ||||
void ProcessLanguageOptions(LANGUAGE_OPTIONS *langopts); | void ProcessLanguageOptions(LANGUAGE_OPTIONS *langopts); | ||||
int Lookup(Translator *tr, const char *word, char *ph_out); | |||||
int LookupFlags(Translator *tr, const char *word, unsigned int **flags_out); | |||||
int TranslateNumber(Translator *tr, char *word1, char *ph_out, unsigned int *flags, WORD_TAB *wtab, int control); | |||||
int TranslateRoman(Translator *tr, char *word, char *ph_out, WORD_TAB *wtab); | |||||
void ChangeWordStress(Translator *tr, char *word, int new_stress); | |||||
void SetSpellingStress(Translator *tr, char *phonemes, int control, int n_chars); | |||||
int TranslateLetter(Translator *tr, char *letter, char *phonemes, int control); | |||||
void LookupLetter(Translator *tr, unsigned int letter, int next_byte, char *ph_buf, int control); | |||||
void LookupAccentedLetter(Translator *tr, unsigned int letter, char *ph_buf); | |||||
int LoadDictionary(Translator *tr, const char *name, int no_error); | |||||
int LookupDictList(Translator *tr, char **wordptr, char *ph_out, unsigned int *flags, int end_flags, WORD_TAB *wtab); | |||||
int HashDictionary(const char *string); | |||||
void print_dictionary_flags(unsigned int *flags, char *buf, int buf_len); | void print_dictionary_flags(unsigned int *flags, char *buf, int buf_len); | ||||
char *DecodeRule(const char *group_chars, int group_length, char *rule, int control); | |||||
void MakePhonemeList(Translator *tr, int post_pause, bool new_sentence); | |||||
void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags); | void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags); | ||||
void AppendPhonemes(Translator *tr, char *string, int size, const char *ph); | |||||
void CalcLengths(Translator *tr); | |||||
void CalcPitches(Translator *tr, int clause_tone); | |||||
int RemoveEnding(Translator *tr, char *word, int end_type, char *word_copy); | |||||
int Unpronouncable(Translator *tr, char *word, int posn); | |||||
void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags, int tonic, int prev_stress); | |||||
int TranslateRules(Translator *tr, char *p, char *phonemes, int size, char *end_phonemes, int end_flags, unsigned int *dict_flags); | |||||
int TranslateWord(Translator *tr, char *word1, WORD_TAB *wtab, char *word_out); | int TranslateWord(Translator *tr, char *word1, WORD_TAB *wtab, char *word_out); | ||||
void TranslateClause(Translator *tr, int *tone, char **voice_change); | void TranslateClause(Translator *tr, int *tone, char **voice_change); | ||||
int ReadClause(Translator *tr, char *buf, short *charix, int *charix_top, int n_buf, int *tone_type, char *voice_change); | |||||
void SetVoiceStack(espeak_VOICE *v, const char *variant_name); | void SetVoiceStack(espeak_VOICE *v, const char *variant_name); | ||||
void InterpretPhoneme(Translator *tr, int control, PHONEME_LIST *plist, PHONEME_DATA *phdata, WORD_PH_DATA *worddata); | |||||
void InterpretPhoneme2(int phcode, PHONEME_DATA *phdata); | |||||
char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int use_ipa, int *flags); | |||||
extern FILE *f_trans; // for logging | extern FILE *f_trans; // for logging | ||||
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include "dictionary.h" | |||||
#include "readclause.h" | |||||
#include "synthdata.h" | |||||
#include "wavegen.h" | |||||
#include "speech.h" | #include "speech.h" | ||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "voice.h" | #include "voice.h" |
#include <espeak-ng/espeak_ng.h> | #include <espeak-ng/espeak_ng.h> | ||||
#include <espeak-ng/speak_lib.h> | #include <espeak-ng/speak_lib.h> | ||||
#include "wavegen.h" | |||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "phoneme.h" | #include "phoneme.h" | ||||
static int harm_sqrt_n = 0; | static int harm_sqrt_n = 0; | ||||
#define N_LOWHARM 30 | #define N_LOWHARM 30 | ||||
#define MAX_HARMONIC 400 // 400 * 50Hz = 20 kHz, more than enough | |||||
static int harm_inc[N_LOWHARM]; // only for these harmonics do we interpolate amplitude between steps | static int harm_inc[N_LOWHARM]; // only for these harmonics do we interpolate amplitude between steps | ||||
static int *harmspect; | static int *harmspect; | ||||
static int hswitch = 0; | static int hswitch = 0; | ||||
#endif | #endif | ||||
// Call WavegenFill2, and then speed up the output samples. | // Call WavegenFill2, and then speed up the output samples. | ||||
int WavegenFill() | |||||
int WavegenFill(void) | |||||
{ | { | ||||
int finished; | int finished; | ||||
unsigned char *p_start; | unsigned char *p_start; |
/* | |||||
* Copyright (C) 2005 to 2015 by Jonathan Duddington | |||||
* email: [email protected] | |||||
* Copyright (C) 2015-2018 Reece H. Dunn | |||||
* Copyright (C) 2018 Juho Hiltunen | |||||
* | |||||
* This program is free software; you can redistribute it and/or modify | |||||
* it under the terms of the GNU General Public License as published by | |||||
* the Free Software Foundation; either version 3 of the License, or | |||||
* (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU General Public License | |||||
* along with this program; if not, see: <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#ifndef ESPEAK_NG_WAVEGEN_H | |||||
#define ESPEAK_NG_WAVEGEN_H | |||||
#include "voice.h" | |||||
#ifdef __cplusplus | |||||
extern "C" | |||||
{ | |||||
#endif | |||||
typedef struct { | |||||
int freq; // Hz<<16 | |||||
int height; // height<<15 | |||||
int left; // Hz<<16 | |||||
int right; // Hz<<16 | |||||
double freq1; // floating point versions of the above | |||||
double height1; | |||||
double left1; | |||||
double right1; | |||||
double freq_inc; // increment by this every 64 samples | |||||
double height_inc; | |||||
double left_inc; | |||||
double right_inc; | |||||
} wavegen_peaks_t; | |||||
int GetAmplitude(void); | |||||
void InitBreath(void); | |||||
int PeaksToHarmspect(wavegen_peaks_t *peaks, | |||||
int pitch, | |||||
int *htab, | |||||
int control); | |||||
void SetPitch2(voice_t *voice, | |||||
int pitch1, | |||||
int pitch2, | |||||
int *pitch_base, | |||||
int *pitch_range); | |||||
void WavegenInit(int rate, | |||||
int wavemult_fact); | |||||
int WavegenFill(void); | |||||
void WavegenSetVoice(voice_t *v); | |||||
int WcmdqFree(void); | |||||
void WcmdqStop(void); | |||||
int WcmdqUsed(void); | |||||
void WcmdqInc(void); | |||||
#ifdef __cplusplus | |||||
} | |||||
#endif | |||||
#endif | |||||
#include <espeak-ng/espeak_ng.h> | #include <espeak-ng/espeak_ng.h> | ||||
#include <espeak-ng/encoding.h> | #include <espeak-ng/encoding.h> | ||||
#include "readclause.h" | |||||
#include "speech.h" | #include "speech.h" | ||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "voice.h" | #include "voice.h" |