RU_TTS_TRANSFER(3)

✨ NAME ✨

okay bestie, welcome to the RU_TTS_TRANSFER(3) manual page πŸ’–

ru_tts_transfer β€” transfer specified Russian text to speech πŸ—£οΈπŸ‡·πŸ‡Ίβœ¨


🌸 SYNOPSIS 🌸

#include <ru_tts.h>

typedef int (*ru_tts_callback)(void *buffer, size_t size, void *user_data);

void ru_tts_transfer(ru_tts_conf_t *config, char *text, void *wave_buffer, size_t wave_buffer_size, ru_tts_callback wave_consumer, void *user_data);

void ru_tts_config_init(ru_tts_conf_t *config);

πŸ’… DESCRIPTION πŸ’…

so ru_tts_transfer() takes the text that text is pointing at and turns it into digitized sound in the raw linear signed 8-bit 10 kHz format. no cap, that's the format. 🎧

that source text has to be a zero-terminated string holding Russian text in koi8-r charset. and here's the cute part β€” the symbols '+' and '=' sitting right after a vowel mean strong stress and weak stress respectively. it's giving diacritics but make it ASCII πŸ’…

the resulting data gets fed to the callback function referenced by the wave_consumer argument, chunk by chunk, through the buffer you specify with wave_buffer and wave_buffer_size. and the user_data argument gets passed to the callback as a pointer to whatever extra data you the user specified. it's literally your lil goodie bag πŸŽ€

you can pass all kinds of speech synthesis control options through the ru_tts_conf_t data structure pointed at by the config argument, and it holds these fields:

typedef struct {
    int speech_rate;
    int voice_pitch;
    int intonation;
    int general_gap_factor;
    int comma_gap_factor;
    int dot_gap_factor;
    int semicolon_gap_factor;
    int colon_gap_factor;
    int question_gap_factor;
    int exclamation_gap_factor;
    int intonational_gap_factor;
    int flags;
} ru_tts_conf_t;

this structure needs to be initialized by the ru_tts_config_init() function, which fills it with the default values. she's your starter pack, bestie ✨

okay so about the numbers β€” all numeric values are a percentage of the corresponding parameter's normal level. initially they're all set to 100. every parameter has its own reasonable value range, but ngl, out-of-range values don't cause any problem at all, because they just get treated as the nearest boundary of the acceptable range. so she's forgiving πŸ’–

  • speech_rate β€” speech rate in percents of the normal level. reasonable value range is from 20 up to 500. πŸƒβ€β™€οΈ
  • voice_pitch β€” voice pitch in percents of the normal level. reasonable value range is from 50 up to 300. 🎡
  • intonation β€” voice pitch variation range. it can vary from 0 (absolutely monotonic speech, like, zero drama) up to 140 (a bit more expressive than normal). 🎭
  • general_gap_factor β€” percentage factor applied to all interclause gaps. its lower boundary is 0, which means no gaps at all. the maximum proportionally depends on the speech rate. on normal rate it's approximately 312. ⏸️
  • comma_gap_factor β€” relative duration of the gap implied by comma encountering. reasonable value range is from 0 up to 750. ,
  • dot_gap_factor β€” relative duration of the gap implied by dot encountering. reasonable value range is from 0 up to 500. .
  • semicolon_gap_factor β€” relative duration of the gap implied by semicolon encountering. reasonable value range is from 0 up to 600. ;
  • colon_gap_factor β€” relative duration of the gap implied by colon encountering. reasonable value range is from 0 up to 600. :
  • question_gap_factor β€” relative duration of the gap implied by question mark encountering. reasonable value range is from 0 up to 375. ?
  • exclamation_gap_factor β€” relative duration of the gap implied by exclamation mark encountering. reasonable value range is from 0 up to 300. !
  • intonational_gap_factor β€” relative duration of purely intonational gaps not caused by a punctuation. reasonable value range is from 0 up to 1000. 🫧
  • flags β€” additional flags. the following flag constants, bitwise-or'd together, may be used here. πŸ‘‘
    • DEC_SEP_POINT β€” treat point inside a number as decimal separator. initially this flag is set. βœ…
    • DEC_SEP_COMMA β€” treat comma inside a number as decimal separator. initially this flag is set. βœ…
    • USE_ALTERNATIVE_VOICE β€” use alternative (female) voice instead of the default (male) one. initially this flag is not set. πŸ™ˆ
it is suggested that the user provided callback function takes further responsibility on the generated data. it may play it immediately or store it somewhere or do whatever it is designed for. πŸ’ΎπŸŽΆ
this function should return 0 in usual circumstances. a non-zero return value causes immediate transfer stop. 😭 so like, be careful bestie, that's the brakes πŸ›‘

🫢 AUTHOR 🫢

Igor B. Poretsky <poretsky@mlbox.ru>. πŸ‘‘


and that's the whole page, fr fr πŸ¦‹ this one was dated January 11, 2023, and it's the RU_TTS_TRANSFER(3) page from the Library Functions Manual β€” love her, read her, slay her πŸ’…βœ¨πŸŒˆ

πŸ“¦ where this page comes from