18
#include "modulation.h"
19
#include "transcription.h"
28
RUTTS_EXPORT void ru_tts_config_init(ru_tts_conf_t *config)
30
config->speech_rate = 100;
31
config->voice_pitch = 100;
32
config->intonation = 100;
33
config->general_gap_factor = 100;
34
config->comma_gap_factor = 100;
35
config->dot_gap_factor = 100;
36
config->semicolon_gap_factor = 100;
37
config->colon_gap_factor = 100;
38
config->question_gap_factor = 100;
39
config->exclamation_gap_factor = 100;
40
config->intonational_gap_factor = 100;
41
config->flags = DEC_SEP_POINT | DEC_SEP_COMMA;
57
RUTTS_EXPORT void ru_tts_transfer(const ru_tts_conf_t *config,
58
const char *text, void *wave_buffer, size_t wave_buffer_size,
59
ru_tts_callback consumer, void *user_data)
61
uint8_t *transcription_buffer = malloc(TRANSCRIPTION_BUFFER_SIZE);
63
if (transcription_buffer)
66
sink_t transcription_consumer;
69
sink_setup(&(ttscb.wave_consumer), wave_buffer, wave_buffer_size, consumer, user_data);
70
sink_setup(&transcription_consumer, transcription_buffer, TRANSCRIPTION_MAXLEN, synth_function, &ttscb);
71
ttscb.flags = config->flags;
74
timing_setup(&(ttscb.timing), config->speech_rate, config->general_gap_factor);
75
adjust_gaplen(&(ttscb.timing), ',', config->comma_gap_factor);
76
adjust_gaplen(&(ttscb.timing), '.', config->dot_gap_factor);
77
adjust_gaplen(&(ttscb.timing), ';', config->semicolon_gap_factor);
78
adjust_gaplen(&(ttscb.timing), ':', config->colon_gap_factor);
79
adjust_gaplen(&(ttscb.timing), '?', config->question_gap_factor);
80
adjust_gaplen(&(ttscb.timing), '!', config->exclamation_gap_factor);
81
adjust_gaplen(&(ttscb.timing), '-', config->intonational_gap_factor);
84
modulation_setup(&(ttscb.modulation), config->voice_pitch, config->intonation);
87
process_text(text, &transcription_consumer);
88
free(transcription_buffer);