voice.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Copyright (C) 2005 to 2007 by Jonathan Duddington
  3. * email: jonsd@users.sourceforge.net
  4. * Copyright (C) 2015 Reece H. Dunn
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, see: <http://www.gnu.org/licenses/>.
  18. */
  19. #ifdef __cplusplus
  20. //extern "C"
  21. //{
  22. #endif
  23. typedef struct {
  24. char v_name[40];
  25. char language_name[20];
  26. int phoneme_tab_ix; // phoneme table number
  27. int pitch_base; // Hz<<12
  28. int pitch_range; // standard = 0x1000
  29. int speedf1;
  30. int speedf2;
  31. int speedf3;
  32. int speed_percent; // adjust the WPM speed by this percentage
  33. int flutter;
  34. int roughness;
  35. int echo_delay;
  36. int echo_amp;
  37. int n_harmonic_peaks; // highest formant which is formed from adding harmonics
  38. int peak_shape; // alternative shape for formant peaks (0=standard 1=squarer)
  39. int voicing; // 100% = 64, level of formant-synthesized sound
  40. int formant_factor; // adjust nominal formant frequencies by this because of the voice's pitch (256ths)
  41. int consonant_amp; // amplitude of unvoiced consonants
  42. int consonant_ampv; // amplitude of the noise component of voiced consonants
  43. int samplerate;
  44. int klattv[8];
  45. // parameters used by Wavegen
  46. short freq[N_PEAKS]; // 100% = 256
  47. short height[N_PEAKS]; // 100% = 256
  48. short width[N_PEAKS]; // 100% = 256
  49. short freqadd[N_PEAKS]; // Hz
  50. // copies without temporary adjustments from embedded commands
  51. short freq2[N_PEAKS]; // 100% = 256
  52. short height2[N_PEAKS]; // 100% = 256
  53. short width2[N_PEAKS]; // 100% = 256
  54. int breath[N_PEAKS]; // amount of breath for each formant. breath[0] indicates whether any are set.
  55. int breathw[N_PEAKS]; // width of each breath formant
  56. // This table provides the opportunity for tone control.
  57. // Adjustment of harmonic amplitudes, steps of 8Hz
  58. // value of 128 means no change
  59. #define N_TONE_ADJUST 1000
  60. unsigned char tone_adjust[N_TONE_ADJUST]; // 8Hz steps * 1000 = 8kHz
  61. } voice_t;
  62. // percentages shown to user, ix=N_PEAKS means ALL peaks
  63. extern USHORT voice_pcnt[N_PEAKS+1][3];
  64. #define N_VOICES_LIST 250
  65. extern int n_voices_list;
  66. extern espeak_VOICE *voices_list [N_VOICES_LIST];
  67. extern espeak_VOICE current_voice_selected;
  68. extern voice_t *voice;
  69. extern int tone_points[12];
  70. const char *SelectVoice(espeak_VOICE *voice_select, int *found);
  71. espeak_VOICE *SelectVoiceByName(espeak_VOICE **voices, const char *name);
  72. voice_t *LoadVoice(const char *voice_name, int control);
  73. voice_t *LoadVoiceVariant(const char *voice_name, int variant);
  74. espeak_ng_STATUS DoVoiceChange(voice_t *v);
  75. espeak_VOICE *ReadVoiceFile(FILE *f_in, const char *fname, int is_language_file);
  76. void WavegenSetVoice(voice_t *v);
  77. void ReadTonePoints(char *string, int *tone_pts);
  78. void VoiceReset(int control);
  79. void FreeVoiceList(void);
  80. #ifdef __cplusplus
  81. //}
  82. #endif