<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3792887</guid>
        <pubDate>Thu, 14 Mar 2019 07:32:13 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3792887</link>
        <description><![CDATA[webcoder88: Пример синтеза дробей после доработки кода<br>
<span class="b-attach" data-size="139043" data-hits="788" data-attach-id="60337" data-attach-post-id="3792887">
			<span class="b-attach__title"></span><a class='b-attach-link' href='https://forum.sources.ru/index.php?act=Attach&amp;type=post&amp;id=3792887&amp;attach_id=60337' title='Скачать файл' target='_blank'>output_1.rar</a> (, : 788)
		</span>]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3792885</guid>
        <pubDate>Thu, 14 Mar 2019 07:19:58 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3792885</link>
        <description><![CDATA[webcoder88: Доработка текстового анализатора SALB и flite для того, чтобы синтезатор произносил знакомую всем фразу &quot;с++&quot; или &quot;c+++ --+=&quot;.<br>
<br>
В файл us_text.c вносятся следующие изменения:<br>
<br>
после кода<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;r = val_append(en_exp_number(aaa),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cons_val(string_val(&quot;slash&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;en_exp_number(bbb)));</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if ((cst_regex_match(cst_rx_digits,ffeature_string(token,&quot;p.name&quot;)))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&amp;&amp; (item_prev(token))) &nbsp;/* don&#39;t mistake &quot;0&quot; as a number */</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;r = cons_val(string_val(&quot;and&quot;),r);</div><div class="code_line">&nbsp;&nbsp; &nbsp;cst_free(aaa);</div><div class="code_line">&nbsp;&nbsp; &nbsp;cst_free(bbb);</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
<br>
необходимо добавить<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp;// этот код синтезирует первый символ -,+,=</div><div class="code_line">&nbsp;&nbsp; &nbsp;// &nbsp;- + = &nbsp; &nbsp; &nbsp; - --- + +++ = ===</div><div class="code_line">&nbsp;&nbsp; &nbsp;else if (cst_streq(name,&quot;-&quot;))</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp;item_set_string(token,&quot;punc&quot;,&quot;&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;r = cons_val(string_val(&quot;minus&quot;),NULL);</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;else if (cst_streq(name,&quot;+&quot;))</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp;item_set_string(token,&quot;punc&quot;,&quot;&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;r = cons_val(string_val(&quot;plus&quot;),NULL);</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;else if (cst_streq(name,&quot;=&quot;))</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp;item_set_string(token,&quot;punc&quot;,&quot;&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;r = cons_val(string_val(&quot;it&quot;),NULL);</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div></ol></div></div></div></div><br>
<br>
и закоментировать следующий код:<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp;/*</div><div class="code_line">// этот код удаляет &quot;-&quot; из синтезированной речи </div><div class="code_line">&nbsp;&nbsp; &nbsp;else if ((p=(strchr(name,&#39;-&#39;))))</div><div class="code_line">&nbsp;&nbsp; &nbsp;{ &nbsp; /* aaa-bbb */</div><div class="code_line">&nbsp;&nbsp; &nbsp;/*aaa = cst_strdup(name);</div><div class="code_line">&nbsp;&nbsp; &nbsp;aaa[cst_strlen(name)-cst_strlen(p)] = &#39;{text}&#39;;</div><div class="code_line">&nbsp;&nbsp; &nbsp;bbb = cst_strdup(p+1);</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (cst_regex_match(cst_rx_digits,aaa) &amp;&amp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;cst_regex_match(cst_rx_digits,bbb))</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ccc = cst_strdup(name);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;item_set_string(token,&quot;name&quot;,bbb);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;r = us_tokentowords_one(token,bbb);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;item_set_string(token,&quot;name&quot;,aaa);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;r = val_append(us_tokentowords_one(token,aaa),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cons_val(string_val(&quot;to&quot;),r));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;item_set_string(token,&quot;name&quot;,ccc);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cst_free(ccc);</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;r = val_append(us_tokentowords_one(token,aaa),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; us_tokentowords_one(token,bbb));</div><div class="code_line">&nbsp;&nbsp; &nbsp;cst_free(aaa);</div><div class="code_line">&nbsp;&nbsp; &nbsp;cst_free(bbb);</div><div class="code_line">&nbsp;&nbsp; &nbsp;}*/</div></ol></div></div></div></div><br>
<br>
<br>
Следующий код в исходном файле разбивает токены вида &quot;c++text&quot; на несколько токенов (те для произнесения с++), но программа падает при токенизации кирилицы:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp;else if ((cst_strlen(name) &#62; 1) &amp;&amp; (!cst_regex_match(cst_rx_alpha,name)))</div><div class="code_line">&nbsp;&nbsp; &nbsp;{ &nbsp; /* its not just alphas */</div><div class="code_line">&nbsp;&nbsp; &nbsp;for (i=0; name[i] != &#39;{text}&#39;; i++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (text_splitable(name,i))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;break;</div><div class="code_line">&nbsp;&nbsp; &nbsp;aaa = cst_strdup(name);</div><div class="code_line">&nbsp;&nbsp; &nbsp;aaa[i+1] = &#39;{text}&#39;;</div><div class="code_line">&nbsp;&nbsp; &nbsp;bbb = cst_strdup(&amp;name[i+1]);</div><div class="code_line">&nbsp;&nbsp; &nbsp;item_set_string(token,&quot;nsw&quot;,&quot;nide&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;r = val_append(us_tokentowords_one(token,aaa),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; us_tokentowords_one(token,bbb));</div><div class="code_line">&nbsp;&nbsp; &nbsp;cst_free(aaa);</div><div class="code_line">&nbsp;&nbsp; &nbsp;cst_free(bbb);</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div></ol></div></div></div></div><br>
<br>
Проверочная строка &quot;аз,+=и&quot;, кодировка ascii<br>
<br>
Запуск в отладчике с английским текстом показал, что программа заходит в блок, если name содержит  знаки +-= (признаки токенизации).<br>
Если строка содержит кириллицу, то программа заходит в блок в любом случае.<br>
Ошибка.<br>
Функция cst_regex_match(cst_rx_alpha,name) возвращает false, если в строке нет символов &quot;-+=&quot;, другие я не проверял.<br>
Функция hs_regexec(const cst_regex *prog, const char *string); проверяет на валидность и запускает предварительно откомпилированную функцию с объектным кодом. Видимо автор flite не дружит с встроенным ассемблером или защищает свои авторские права. См. файлы regexp.c и cst_regex.h . <br>
<br>
&quot;Косяк&quot; с кириллицей исправляется так<br>
//else if ((cst_strlen(name) &gt; 1) &amp;&amp; (&#33;cst_regex_match(cst_rx_alpha,name)))<br>
<br>
else if ( (cst_strlen(name) &gt; 1) &amp;&amp; (strchr(name,&#39;+&#39;) || strchr(name,&#39;-&#39;) || strchr(name,&#39;=&#39;))  )]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3792767</guid>
        <pubDate>Wed, 13 Mar 2019 03:50:37 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3792767</link>
        <description><![CDATA[webcoder88: Кто-нибудь собирал  последнюю версию RHVoice в Windows 7...8.1? Поделитесь опытом.<br><br>Считаю, что в Linux - это ось командной строки, в которой всегда висит окно консоли для ввода команд, настройки окон, запуска программ, удаления создания файлов и тд. Не ось, а печатная машинка. Поэтому разработчикам Windos трудно перейти на Linux и наоборот. Есть VS для Linux, но все разработчики используют только python+scons.<br>Я неспеша дорабатываю SALB. Уже воспроизводит русский голос, но еще много недоработок: английский акцент (тк я прикрутил только лексику из RHvoice), иногда неправильное ударение, <br>пока не работают канал русского языка в 64-битной версия драйвера, хотя английский работает нормально и 64-битный бинарник hts_engine и cli( ошибка доступа к памяти при инициализации звукового интерфейса bp winmm.lib,  но в драйвере в канале англ. языка работает без проблем).]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3783723</guid>
        <pubDate>Sun, 25 Nov 2018 07:13:10 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3783723</link>
        <description><![CDATA[webcoder88: Исходный код упаковщика hts-голосов RHVoice в новый формат 1.07(8). Код без оптимизации, но проверен и протестирован.<br>
<br>
<span class="b-attach" data-size="77041" data-hits="784" data-attach-id="59536" data-attach-post-id="3783723">
			<span class="b-attach__title"></span><a class='b-attach-link' href='https://forum.sources.ru/index.php?act=Attach&amp;type=post&amp;id=3783723&amp;attach_id=59536' title='Скачать файл' target='_blank'>hts_pack1.07_2.rar</a> (, : 784)
		</span>]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3772297</guid>
        <pubDate>Mon, 18 Jun 2018 07:19:48 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3772297</link>
        <description><![CDATA[webcoder88: Голос Alan,16кГц в новом формате <a class='tag-url' href='https://drive.google.com/open?id=1VTAQsviK7QuaHSlaqVkvyimCjnvQ55M2' target='_blank'>https://drive.google.com/open?id=1VTAQsviK7...VkvyimCjnvQ55M2</a>]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3770996</guid>
        <pubDate>Sun, 03 Jun 2018 04:00:57 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3770996</link>
        <description><![CDATA[webcoder88: Вся информация о форматах содержится в исходных кодах hts_engine 1.05 и 1.07<br>
Открываете и изучаете файлы HTS_model.c. <br>
<br>
Как сделать из версии hts_engine 1.07 утилиту распаковки? Очень просто. Надо инициализировать движок и загрузить модель голоса, вызов синтеза комментируется, удаляются ненужные ключи и код их обработки, а также добавить код сохранения файлов на диск. <br>
<br>
Все необходимое нужно искать в HTS_model.c по строке   /* load duration */<br>
<br>
Исходный вариант для длительности:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;/* load duration */</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;pdf_fp = NULL;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;tree_fp = NULL;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;matched_size = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if (HTS_get_token_from_string_with_separator(temp_duration_pdf, &amp;matched_size, buff2, &#39;-&#39;) == TRUE) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; s = (size_t) atoi(buff2);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; e = (size_t) atoi(&amp;temp_duration_pdf[matched_size]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; HTS_fseek(fp, (long) s, SEEK_CUR);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; pdf_fp = HTS_fopen_from_fp(fp, fsize);</div><div class="code_line">&nbsp;&nbsp; &nbsp; HTS_fseek(fp, start_of_data, SEEK_SET);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;}</div></ol></div></div></div></div><br>
<br>
Новая версия:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;// в начале функции.</div><div class="code_line">&nbsp;&nbsp; int sw;</div><div class="code_line">&nbsp;&nbsp; FILE* fw;</div><div class="code_line">&nbsp;&nbsp; char* buff;</div><div class="code_line">&nbsp;&nbsp; int fsize; // file size</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;...</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;/* load duration */</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;pdf_fp = NULL;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;tree_fp = NULL;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;matched_size = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if (HTS_get_token_from_string_with_separator(temp_duration_pdf, &amp;matched_size, buff2, &#39;-&#39;) == TRUE) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; s = (size_t) atoi(buff2);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; e = (size_t) atoi(&amp;temp_duration_pdf[matched_size]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; fsize = e - s + 1;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; HTS_fseek(fp, (long) s, SEEK_CUR);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; pdf_fp = HTS_fopen_from_fp(fp, fsize);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; fw = fopen((char*)&quot;dur.pdf&quot;,&quot;wb&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; buff = &nbsp;(char*)HTS_calloc(fsize, sizeof(char</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; HTS_fread_little_endian( (void*)(buff), 1, fsize, (HTS_File*) pdf_fp);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; //HTS_byte_swap(buff, 4, (fsize)/4);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; sw = &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fwrite(buff, 1, fsize, fw); //&#60;&#60;&#60;--------------</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; fclose(fw);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; free(buff);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; HTS_fseek(fp, start_of_data, SEEK_SET);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;}</div></ol></div></div></div></div><br>
<br>
<br>
Аналогично правится весь код загрузки файлов.<br>
<br>
После извлечения файлов голоса можно приступать к их изучению. Откройте в винхексе распакованный dur.pdf и аналогичный файл из голоса arctic_slt. Содержимое файлов отличается.<br>
В новом файле нет заголовка, хотя первое слово может быть кол-вом пдфок в файле. Порядок следования байтов прямой. Если присмотреться еще лучше, то можете заметить, что все слова перевернуты и не хватает части заголовка. Добавляете часть заголовка, переворачивате все слова вручную или программно и проверяете файл на валидность.<br>
Теперь надо решить вопрос быстрой проверки файлов на валидность. Лучше всего использовать тренированный голос на 48000 Гц, в котором файлы заменяются парами (пдф и дерево) или по одному. <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2018-06-03T04:11:02+00:00">03.06.18, 04:11</time></span></span><br>
Дальше файл фильтра. Также не хватает части заголовка, перевернуты слова и векторы мин и вариации  длиной 31 (см параметры) идут один за друг, а в старом формате их значения чередуются.<br>
Файл mgc.pdf также не очень сложный, но в звуке вного искажений. М/б неправильное чередование векторов и тд.<br>
<br>
Реально сделать, голос распакован и протестирован. Ссылка на архив с распаковщиком и распакованным голосом: <a class='tag-url' href='https://drive.google.com/file/d/1EjGxn_oHrPAvky6ZIh35lBOts5-nGxry/view?usp=sharing' target='_blank'>https://drive.google.com/file/d/1EjGxn_oHrP...iew?usp=sharing</a><br>
<br>
Предыдущий вариант голоса неправильно произносит часть слов. Архив с правильным файлом продолжительности и исправленной утилитой. Можете скопировать только pdf и inf в каталог с  голосом, не запуская утилиту. В командных файлах значение коэф-та а изменено на 0.55.<br>
В прикрепленном архиве исправленная версия утилиты(создает правильный файл dur.pdf). Добавлен ключ для распаковки, см. встроенную справку.<br>
Исходники залью в конце 2018 года.<br>
<span class="b-attach" data-size="47727" data-hits="938" data-attach-id="58859" data-attach-post-id="3770996">
			<span class="b-attach__title"></span><a class='b-attach-link' href='https://forum.sources.ru/index.php?act=Attach&amp;type=post&amp;id=3770996&amp;attach_id=58859' title='Скачать файл' target='_blank'>upd1.rar</a> (, : 938)
		</span>]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3770907</guid>
        <pubDate>Sat, 02 Jun 2018 07:02:58 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3770907</link>
        <description><![CDATA[webcoder88: Недавно нашлось немного времени на синтезатор. Лучший вариант для Windows <a class='tag-url' href='https://github.com/m-toman/SALB' target='_blank'>https://github.com/m-toman/SALB</a> + русская лексика из RHVoice.<br>
На данный момент английские и немецкие голоса и воспроизводятся  также как в оригинальном проекте, для русских голосов только метки, тк нет голосов в новом формате. Метки можно прослушать в hts_engine.<br>
Новый формат пдф-файлов сильно отличается от предыдущих версий. На создание утилит конвертации форматов потребуется время и программисты.<br>
Ссылка для скачивания бетта-версии с интегрированной русской лексикой: <a class='tag-url' href='https://drive.google.com/open?id=1pgmxcE-3eUVJ6PVle-ZC0qu9fWzgFLiL' target='_blank'>salb_tts</a><br>
Постлексика и интонация осталась от англ. языка, поэтому речь с акцентом.<br>
<br>
Для исследователей<br>
cmu_us_arctic_slt.htsvoice, открываете в винхексе, копируете в текстовый редактор, открываете в вордпале или VS2012. Можем видеть, что голос с GV для кепстральных коэффициентов и основного тона:<br>
USE_GV[MCP]:1<br>
USE_GV[LF0]:1<br>
USE_GV[LPF]:0<br>
Их можно отключить, изменив 1 на 0 в винхексе. Дальше можете проверить синтез голоса.<br>
Дальше вырезать эти файлы из файла голоса. Будет работать.<br>
Формат всех файлов, кроме пдф-ок совпадает с файлами модели голоса RHVoice. <br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">[GLOBAL]</div><div class="code_line">HTS_VOICE_VERSION:1.0</div><div class="code_line">SAMPLING_FREQUENCY:48000</div><div class="code_line">FRAME_PERIOD:240</div><div class="code_line">NUM_STATES:5</div><div class="code_line">NUM_STREAMS:3</div><div class="code_line">STREAM_TYPE:MCP,LF0,LPF</div><div class="code_line">FULLCONTEXT_FORMAT:HTS_TTS_ENG</div><div class="code_line">FULLCONTEXT_VERSION:1.0</div><div class="code_line">GV_OFF_CONTEXT:&quot;*-pau+*&quot;,&quot;*-h#+*&quot;,&quot;*-brth+*&quot;</div><div class="code_line">COMMENT:</div><div class="code_line">[STREAM]</div><div class="code_line">VECTOR_LENGTH[MCP]:35</div><div class="code_line">VECTOR_LENGTH[LF0]:1</div><div class="code_line">VECTOR_LENGTH[LPF]:31</div><div class="code_line">IS_MSD[MCP]:0</div><div class="code_line">IS_MSD[LF0]:1</div><div class="code_line">IS_MSD[LPF]:0</div><div class="code_line">NUM_WINDOWS[MCP]:3</div><div class="code_line">NUM_WINDOWS[LF0]:3</div><div class="code_line">NUM_WINDOWS[LPF]:1</div><div class="code_line">USE_GV[MCP]:1</div><div class="code_line">USE_GV[LF0]:1</div><div class="code_line">USE_GV[LPF]:0</div><div class="code_line">OPTION[MCP]:ALPHA=0.55</div><div class="code_line">OPTION[LF0]:</div><div class="code_line">OPTION[LPF]:</div><div class="code_line">[POSITION]</div><div class="code_line">DURATION_PDF:0-22203</div><div class="code_line">DURATION_TREE:22204-91164</div><div class="code_line">STREAM_WIN[MCP]:91165-91170,91171-91185,91186-91200</div><div class="code_line">STREAM_WIN[LF0]:91201-91206,91207-91221,91222-91236</div><div class="code_line">STREAM_WIN[LPF]:91237-91242</div><div class="code_line">STREAM_PDF[MCP]:91243-1141262</div><div class="code_line">STREAM_PDF[LF0]:1141263-1241550</div><div class="code_line">STREAM_PDF[LPF]:1241551-1242810</div><div class="code_line">STREAM_TREE[MCP]:1242811-1373734</div><div class="code_line">STREAM_TREE[LF0]:1373735-1741482</div><div class="code_line">STREAM_TREE[LPF]:1741483-1741587</div><div class="code_line">GV_PDF[MCP]:1741588-1742151</div><div class="code_line">GV_PDF[LF0]:1742152-1742179</div><div class="code_line">GV_TREE[MCP]:1742180-1742332</div><div class="code_line">GV_TREE[LF0]:1742333-1742639</div><div class="code_line">[DATA]</div></ol></div></div></div></div>]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3672250</guid>
        <pubDate>Mon, 30 May 2016 09:04:00 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3672250</link>
        <description><![CDATA[webcoder88: Шаг 5<br>
<br>
Следует исключить внесение каких-либо изменений в библиотеки сторонних разработчиков, а вместо этого переносить изменяемые функции в код своего проекта.<br>
Поэтому для обработки действий пользователя и подсветки текста одновременно с синтезом речи следует исправить код функции speak_frag(), те заменить строку HTS_Engine_create_gstream(&amp;engine.engine); <br>
<br>
на    HTS_Engine_create_gstream2(&amp;engine.engine); // &lt;--- синтез речи  и обработка событий.<br>
<br>
Объявляем функцию HTS_Engine_create_gstream2 в секции public класса CFliteTTSEngineObj и копируем код функци HTS_Engine_create_gstream из hts_engine_API в файл FliteTTSEngineObj.cpp с заменой имени <br>
<br>
на новое HTS_Engine_create_gstream2. Эта функция ничего не делает кроме вызова др. функцию HTS_GStreamSet_create, поэтому также меняем ее имя на HTS_GStreamSet_create2.<br>
Далее аналогично объявляем HTS_GStreamSet_create2 в секции public класса CFliteTTSEngineObj, копируем ее код из  hts_engine_API в файл FliteTTSEngineObj.cpp и добавляем в конце имени цифру 2<br>
  <br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">/* HTS_Engine_create_gstream: synthesis speech */</div><div class="code_line">HTS_Boolean</div><div class="code_line">CFliteTTSEngineObj::HTS_Engine_create_gstream2(HTS_Engine * engine)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; return HTS_GStreamSet_create2(&amp;engine-&#62;gss, &amp;engine-&#62;pss, engine-&#62;global.stage, engine-&#62;global.use_log_gain, engine-&#62;global.sampling_rate, engine-&#62;global.fperiod,engine-&#62;global.alpha, engine-&#62;global.beta, &amp;engine-&#62;global.stop, engine-&#62;global.volume, engine-&#62;global.audio_buff_size &#62; 0 ? &amp;engine-&#62;audio : NULL);</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
<br>
<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">/* HTS_GStreamSet_create: generate speech */</div><div class="code_line">/* (stream[0] == spectrum &amp;&amp; stream[1] == lf0) */</div><div class="code_line">HTS_Boolean </div><div class="code_line">CFliteTTSEngineObj::HTS_GStreamSet_create2(HTS_GStreamSet * gss, HTS_PStreamSet * pss, int stage, HTS_Boolean use_log_gain, int sampling_rate, int fperiod, double alpha, double beta, HTS_Boolean * </div><div class="code_line">&nbsp;</div><div class="code_line">stop, double volume, HTS_Audio * audio)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; int i, j, k;</div><div class="code_line">&nbsp;&nbsp; int msd_frame;</div><div class="code_line">&nbsp;&nbsp; HTS_Vocoder v;</div><div class="code_line">&nbsp;&nbsp; int nlpf = 0;</div><div class="code_line">&nbsp;&nbsp; double *lpf = NULL;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; /* check */</div><div class="code_line">&nbsp;&nbsp; if (gss-&#62;gstream || gss-&#62;gspeech) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//HTS_error(1, &quot;HTS_GStreamSet_create: HTS_GStreamSet is not initialized.\n&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; MessageBoxW(0, L&quot;HTS_GStreamSet_create: HTS_GStreamSet is not initialized.\n&quot;,L&quot;HTS_Error&quot;,0);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;return FALSE;</div><div class="code_line">&nbsp;&nbsp; }</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; /* initialize */</div><div class="code_line">&nbsp;&nbsp; gss-&#62;nstream = HTS_PStreamSet_get_nstream(pss);</div><div class="code_line">&nbsp;&nbsp; gss-&#62;total_frame = HTS_PStreamSet_get_total_frame(pss);</div><div class="code_line">&nbsp;&nbsp; gss-&#62;total_nsample = fperiod * gss-&#62;total_frame;</div><div class="code_line">&nbsp;&nbsp; gss-&#62;gstream = (HTS_GStream *) HTS_calloc(gss-&#62;nstream, sizeof(HTS_GStream));</div><div class="code_line">&nbsp;&nbsp; for (i = 0; i &#60; gss-&#62;nstream; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;gss-&#62;gstream[i].static_length = HTS_PStreamSet_get_static_length(pss, i);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;gss-&#62;gstream[i].par = (double **) HTS_calloc(gss-&#62;total_frame, sizeof(double *));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;for (j = 0; j &#60; gss-&#62;total_frame; j++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; gss-&#62;gstream[i].par[j] = (double *) HTS_calloc(gss-&#62;gstream[i].static_length, sizeof(double));</div><div class="code_line">&nbsp;&nbsp; }</div><div class="code_line">&nbsp;&nbsp; gss-&#62;gspeech = (short *) HTS_calloc(gss-&#62;total_nsample, sizeof(short));</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; /* copy generated parameter */</div><div class="code_line">&nbsp;&nbsp; for (i = 0; i &#60; gss-&#62;nstream; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if (HTS_PStreamSet_is_msd(pss, i)) { &nbsp; &nbsp; &nbsp;/* for MSD */</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; for (j = 0, msd_frame = 0; j &#60; gss-&#62;total_frame; j++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (HTS_PStreamSet_get_msd_flag(pss, i, j)) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (k = 0; k &#60; gss-&#62;gstream[i].static_length; k++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;gss-&#62;gstream[i].par[j][k] = HTS_PStreamSet_get_parameter(pss, i, msd_frame, k);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msd_frame++;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (k = 0; k &#60; gss-&#62;gstream[i].static_length; k++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;gss-&#62;gstream[i].par[j][k] = LZERO;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;} else { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* for non MSD */</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; for (j = 0; j &#60; gss-&#62;total_frame; j++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (k = 0; k &#60; gss-&#62;gstream[i].static_length; k++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gss-&#62;gstream[i].par[j][k] = HTS_PStreamSet_get_parameter(pss, i, j, k);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; }</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; /* check */</div><div class="code_line">&nbsp;&nbsp; if (gss-&#62;nstream != 2 &amp;&amp; gss-&#62;nstream != 3) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//HTS_error(1, &quot;HTS_GStreamSet_create: The number of streams should be 2 or 3.\n&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;MessageBoxW(0, L&quot;HTS_GStreamSet_create: The number of streams should be 2 or 3.\n&quot;,L&quot;HTS_Error&quot;,0);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;HTS_GStreamSet_clear(gss);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;return FALSE;</div><div class="code_line">&nbsp;&nbsp; }</div><div class="code_line">&nbsp;&nbsp; if (HTS_PStreamSet_get_static_length(pss, 1) != 1) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//HTS_error(1, &quot;HTS_GStreamSet_create: The size of lf0 static vector should be 1.\n&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;MessageBoxW(0, L&quot;HTS_GStreamSet_create: The size of lf0 static vector should be 1.\n&quot;,L&quot;HTS_Error&quot;,0);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;HTS_GStreamSet_clear(gss);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;return FALSE;</div><div class="code_line">&nbsp;&nbsp; }</div><div class="code_line">&nbsp;&nbsp; if (gss-&#62;nstream &#62;= 3 &amp;&amp; gss-&#62;gstream[2].static_length % 2 == 0) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//HTS_error(1, &quot;HTS_GStreamSet_create: The number of low-pass filter coefficient should be odd numbers.&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;MessageBoxW(0, L&quot;HTS_GStreamSet_create: The number of low-pass filter coefficient should be odd numbers.&quot;, L&quot;HTS_Error&quot;,0);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;HTS_GStreamSet_clear(gss);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;return FALSE;</div><div class="code_line">&nbsp;&nbsp; }</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; /* synthesize speech waveform */</div><div class="code_line">&nbsp;&nbsp; HTS_Vocoder_initialize(&amp;v, gss-&#62;gstream[0].static_length - 1, stage, use_log_gain, sampling_rate, fperiod);</div><div class="code_line">&nbsp;&nbsp; if (gss-&#62;nstream &#62;= 3)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;nlpf = (gss-&#62;gstream[2].static_length - 1) / 2;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; cst_item *s = NULL;</div><div class="code_line">&nbsp;&nbsp; int sps;</div><div class="code_line">&nbsp;&nbsp; sps = get_param_int(curr_vox-&#62;features, &quot;sample_rate&quot;, sampling_rate); //16000</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;// цикл синтеза по меткам</div><div class="code_line">&nbsp;&nbsp; for (i = 0, k = 0, s = relation_head(utt_relation(curr_utt, &quot;Segment&quot;)); s;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;s = item_next(s), i++) { //k-номер фрейма</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;int offset;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;SPEVENT evt;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;cst_item *token;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//const cst_val *bmark;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;offset = (int) (ffeature_float(s, &quot;p.end&quot;) * sps * sizeof(short));</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;for (int j=0; j&#60;nstate; j++){ </div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (gss-&#62;nstream &#62;= 3)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lpf = &amp;gss-&#62;gstream[2].par[i][0];</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;get_actions_and_do_them();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (aborted)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;goto stop_synth;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (sentence_skip == 0) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//send_sentence_event(ts-&#62;token_pos</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ curr_frag-&#62;ulTextSrcOffset);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;HTS_Vocoder_synthesize(&amp;v, gss-&#62;gstream[0].static_length - 1, gss-&#62;gstream[1].par[k][0], </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp;gss-&#62;gstream[0].par[k][0], nlpf, lpf, alpha, beta, volume, &amp;gss-&#62;gspeech[k * fperiod], audio);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;k++; // next frame</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} else {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--sentence_skip;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;site-&#62;CompleteSkip(1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; } // end for on item</div><div class="code_line">&nbsp;</div><div class="code_line">stop_synth:</div><div class="code_line">&nbsp;&nbsp; HTS_Vocoder_clear(&amp;v);</div><div class="code_line">&nbsp;&nbsp; if (audio)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;HTS_Audio_flush(audio);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; return TRUE;</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
Последняя функция тянет за собой HTS_calloc(). Копируем ее в файл FliteTTSEngineObj.cpp.<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// snarfed from HTS_Engine</div><div class="code_line">&nbsp;</div><div class="code_line">/* HTS_calloc: wrapper for calloc */</div><div class="code_line">char *HTS_calloc(const size_t num, const size_t size)</div><div class="code_line">{</div><div class="code_line">#ifdef FESTIVAL</div><div class="code_line">&nbsp;&nbsp; char *mem = (char *) safe_wcalloc(num * size);</div><div class="code_line">#else</div><div class="code_line">&nbsp;&nbsp; char *mem = (char *) calloc(num, size);</div><div class="code_line">#endif &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* FESTIVAL */</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; if (mem == NULL)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;MessageBoxW(0, L&quot;HTS_calloc: Cannot allocate memory.\n&quot;,L&quot;HTS_Error&quot;,0);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; return mem;</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
Если собрать проект, то драйвер может обрабатывать события от элементов интерфейса одновременно с синтезом речи.<br>
Осталось добавить подсветку произносимого текста. Для этого необходимо организовать цикл по токенам, в котором будем определять общую длительность метки в фреймах, а затем синтезировать речь по этим фреймам в цикле по длительности.<br>
<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;for (i = 0, k = 0, s = relation_head(utt_relation(curr_utt, &quot;Segment&quot;)); s;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;s = item_next(s), i++) { //k-номер фрейма</div><div class="code_line">//...</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
<br>
Каждая метка имеет 5 состояний с разной длительностью (в фреймах), дающих при суммирровании общую длительность фонемы в фреймах.<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp;// цикл синтеза по меткам</div><div class="code_line">&nbsp;&nbsp; &nbsp;// необходимо определить общую длительность метки в фреймах</div><div class="code_line">&nbsp;&nbsp; &nbsp;// и синтезировать речь по этим фреймам, тоже в цикле по длительности</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; for (i = 0, k = 0, s = relation_head(utt_relation(curr_utt, &quot;Segment&quot;)); s;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;s = item_next(s), i++) { //k-номер фрейма</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;// get label duration</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;int lab_duration = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;int nstate = engine.engine.sss.nstate; //=5</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;for (int j=0; j&#60;nstate; j++){ &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lab_duration = lab_duration + &nbsp;engine.engine.sss.duration[i*nstate+j];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//itoa( lab_duration, buff, 10);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;// &nbsp; &nbsp;MessageBoxA(0,buff,(char*)&quot;lab_duration&quot;,0); //***</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;for (j = 0; j &#60; lab_duration &amp;&amp; (*stop) == FALSE; j++){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// синтез речи</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;// подсветка токена</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
<br>
Законченный вариант функции:<br>
<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">/* HTS_GStreamSet_create: generate speech */</div><div class="code_line">/* (stream[0] == spectrum &amp;&amp; stream[1] == lf0) */</div><div class="code_line">HTS_Boolean </div><div class="code_line">CFliteTTSEngineObj::HTS_GStreamSet_create2(HTS_GStreamSet * gss, HTS_PStreamSet * pss, int stage, HTS_Boolean use_log_gain, int sampling_rate, int fperiod, double alpha, double beta, HTS_Boolean * </div><div class="code_line">&nbsp;</div><div class="code_line">stop, double volume, HTS_Audio * audio)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; int i, j, k;</div><div class="code_line">&nbsp;&nbsp; int msd_frame;</div><div class="code_line">&nbsp;&nbsp; HTS_Vocoder v;</div><div class="code_line">&nbsp;&nbsp; int nlpf = 0;</div><div class="code_line">&nbsp;&nbsp; double *lpf = NULL;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; /* check */</div><div class="code_line">&nbsp;&nbsp; if (gss-&#62;gstream || gss-&#62;gspeech) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//HTS_error(1, &quot;HTS_GStreamSet_create: HTS_GStreamSet is not initialized.\n&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; MessageBoxW(0, L&quot;HTS_GStreamSet_create: HTS_GStreamSet is not initialized.\n&quot;,L&quot;HTS_Error&quot;,0);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;return FALSE;</div><div class="code_line">&nbsp;&nbsp; }</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; /* initialize */</div><div class="code_line">&nbsp;&nbsp; gss-&#62;nstream = HTS_PStreamSet_get_nstream(pss);</div><div class="code_line">&nbsp;&nbsp; gss-&#62;total_frame = HTS_PStreamSet_get_total_frame(pss);</div><div class="code_line">&nbsp;&nbsp; gss-&#62;total_nsample = fperiod * gss-&#62;total_frame;</div><div class="code_line">&nbsp;&nbsp; gss-&#62;gstream = (HTS_GStream *) HTS_calloc(gss-&#62;nstream, sizeof(HTS_GStream));</div><div class="code_line">&nbsp;&nbsp; for (i = 0; i &#60; gss-&#62;nstream; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;gss-&#62;gstream[i].static_length = HTS_PStreamSet_get_static_length(pss, i);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;gss-&#62;gstream[i].par = (double **) HTS_calloc(gss-&#62;total_frame, sizeof(double *));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;for (j = 0; j &#60; gss-&#62;total_frame; j++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; gss-&#62;gstream[i].par[j] = (double *) HTS_calloc(gss-&#62;gstream[i].static_length, sizeof(double));</div><div class="code_line">&nbsp;&nbsp; }</div><div class="code_line">&nbsp;&nbsp; gss-&#62;gspeech = (short *) HTS_calloc(gss-&#62;total_nsample, sizeof(short));</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; /* copy generated parameter */</div><div class="code_line">&nbsp;&nbsp; for (i = 0; i &#60; gss-&#62;nstream; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if (HTS_PStreamSet_is_msd(pss, i)) { &nbsp; &nbsp; &nbsp;/* for MSD */</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; for (j = 0, msd_frame = 0; j &#60; gss-&#62;total_frame; j++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (HTS_PStreamSet_get_msd_flag(pss, i, j)) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (k = 0; k &#60; gss-&#62;gstream[i].static_length; k++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;gss-&#62;gstream[i].par[j][k] = HTS_PStreamSet_get_parameter(pss, i, msd_frame, k);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msd_frame++;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (k = 0; k &#60; gss-&#62;gstream[i].static_length; k++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;gss-&#62;gstream[i].par[j][k] = LZERO;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;} else { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* for non MSD */</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; for (j = 0; j &#60; gss-&#62;total_frame; j++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (k = 0; k &#60; gss-&#62;gstream[i].static_length; k++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gss-&#62;gstream[i].par[j][k] = HTS_PStreamSet_get_parameter(pss, i, j, k);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; }</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; /* check */</div><div class="code_line">&nbsp;&nbsp; if (gss-&#62;nstream != 2 &amp;&amp; gss-&#62;nstream != 3) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//HTS_error(1, &quot;HTS_GStreamSet_create: The number of streams should be 2 or 3.\n&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;MessageBoxW(0, L&quot;HTS_GStreamSet_create: The number of streams should be 2 or 3.\n&quot;,L&quot;HTS_Error&quot;,0);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;HTS_GStreamSet_clear(gss);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;return FALSE;</div><div class="code_line">&nbsp;&nbsp; }</div><div class="code_line">&nbsp;&nbsp; if (HTS_PStreamSet_get_static_length(pss, 1) != 1) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//HTS_error(1, &quot;HTS_GStreamSet_create: The size of lf0 static vector should be 1.\n&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;MessageBoxW(0, L&quot;HTS_GStreamSet_create: The size of lf0 static vector should be 1.\n&quot;,L&quot;HTS_Error&quot;,0);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;HTS_GStreamSet_clear(gss);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;return FALSE;</div><div class="code_line">&nbsp;&nbsp; }</div><div class="code_line">&nbsp;&nbsp; if (gss-&#62;nstream &#62;= 3 &amp;&amp; gss-&#62;gstream[2].static_length % 2 == 0) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//HTS_error(1, &quot;HTS_GStreamSet_create: The number of low-pass filter coefficient should be odd numbers.&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;MessageBoxW(0, L&quot;HTS_GStreamSet_create: The number of low-pass filter coefficient should be odd numbers.&quot;, L&quot;HTS_Error&quot;,0);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;HTS_GStreamSet_clear(gss);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;return FALSE;</div><div class="code_line">&nbsp;&nbsp; }</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; /* synthesize speech waveform */</div><div class="code_line">&nbsp;&nbsp; HTS_Vocoder_initialize(&amp;v, gss-&#62;gstream[0].static_length - 1, stage, use_log_gain, sampling_rate, fperiod);</div><div class="code_line">&nbsp;&nbsp; if (gss-&#62;nstream &#62;= 3)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;nlpf = (gss-&#62;gstream[2].static_length - 1) / 2;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; cst_item *s = NULL;</div><div class="code_line">&nbsp;&nbsp; int sps;</div><div class="code_line">&nbsp;&nbsp; sps = get_param_int(curr_vox-&#62;features, &quot;sample_rate&quot;, sampling_rate); //16000</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;//ts = my_ts_open_string(curr_utt, text);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;// цикл синтеза по меткам</div><div class="code_line">&nbsp;&nbsp; &nbsp;// необходимо определить общую длительность метки в фреймах</div><div class="code_line">&nbsp;&nbsp; &nbsp;// и синтезировать речь по этим фреймам, тоже в цикле по длительности</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; for (i = 0, k = 0, s = relation_head(utt_relation(curr_utt, &quot;Segment&quot;)); s;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;s = item_next(s), i++) { //k-номер фрейма</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;int offset;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;SPEVENT evt;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;cst_item *token;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//const cst_val *bmark;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;offset = (int) (ffeature_float(s, &quot;p.end&quot;) * sps * sizeof(short));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;token = path_to_item(s, &quot;R:SylStructure.parent.parent.R:Token.parent&quot;); </div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;// get label duration</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;int lab_duration = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;int nstate = engine.engine.sss.nstate; //=5</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;for (int j=0; j&#60;nstate; j++){ &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lab_duration = lab_duration + &nbsp;engine.engine.sss.duration[i*nstate+j];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//itoa( lab_duration, buff, 10);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;// &nbsp; &nbsp;MessageBoxA(0,buff,(char*)&quot;lab_duration&quot;,0); //***</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (j = 0; j &#60; lab_duration &amp;&amp; (*stop) == FALSE; j++){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (gss-&#62;nstream &#62;= 3)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lpf = &amp;gss-&#62;gstream[2].par[i][0];</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;get_actions_and_do_them();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (aborted)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;goto stop_synth;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (sentence_skip == 0) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//send_sentence_event(ts-&#62;token_pos</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ curr_frag-&#62;ulTextSrcOffset);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;HTS_Vocoder_synthesize(&amp;v, gss-&#62;gstream[0].static_length - 1, gss-&#62;gstream[1].par[k][0], </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp;gss-&#62;gstream[0].par[k][0], nlpf, lpf, alpha, beta, volume, &amp;gss-&#62;gspeech[k * fperiod], audio);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;k++; // next frame</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} else {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--sentence_skip;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;site-&#62;CompleteSkip(1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} // end for on lab_duration</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;/* Word boundaries */</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (token</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp;&amp; item_parent(item_as(s, &quot;SylStructure&quot;))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp;&amp; item_prev(item_as(s, &quot;SylStructure&quot;)) == NULL</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp;&amp; item_prev(item_parent(item_as(s, &quot;SylStructure&quot;))) == NULL</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp;&amp; (token !=</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;path_to_item(s, &quot;R:SylStructure.parent.parent.p.&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;R:Token.parent&quot;))){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//MessageBoxA(0,label_data[i],0,0); //***</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//MessageBoxA(0,item_feat_string(token, &quot;name&quot;),(char*)&quot;token_name&quot;,0);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sztoken = ts_get(ts);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//item_set_int(token, &quot;token_pos&quot;, ts-&#62;token_pos);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//item_set_int(token, &quot;token_length&quot;, strlen(sztoken));</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//itoa(item_feat_int(token, &quot;token_pos&quot;) + curr_frag-&#62;ulTextSrcOffset, buff, 10);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//MessageBoxA(0,buff,(char*)&quot;token_length&quot;,0); //***</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//itoa( ts-&#62;token_pos, buff, 10);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//MessageBoxA(0,buff,(char*)&quot;token_pos&quot;,0); //***</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (sampling_rate==16000) Sleep(210); //synchronizing, need thread :)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SpClearEvent(&amp;evt);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;evt.eEventId = SPEI_WORD_BOUNDARY;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;evt.elParamType = SPET_LPARAM_IS_UNDEFINED;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;evt.ullAudioStreamOffset = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //bcount + offset;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;evt.wParam = strlen(item_feat_string(token, &quot;name&quot;)); &nbsp; //item_feat_int(token, &quot;token_length&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;evt.lParam = ts-&#62;token_pos; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //item_feat_int(token, &quot;token_pos&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;site-&#62;AddEvents(&amp;evt, 1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; } // end for on item</div><div class="code_line">&nbsp;</div><div class="code_line">stop_synth:</div><div class="code_line">&nbsp;&nbsp; HTS_Vocoder_clear(&amp;v);</div><div class="code_line">&nbsp;&nbsp; if (audio)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;HTS_Audio_flush(audio);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; return TRUE;</div><div class="code_line">}</div></ol></div></div></div></div> <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2016-05-30T09:11:36+00:00">30.05.16, 09:11</time></span></span><br>
if (sampling_rate==16000) Sleep(210); //synchronizing, need thread :) - этот параметр подобран экспериментально<br>
Без этой задержки для 16кГц-вых голосов проскакиваются первые 2 токена (слова). Для 48кГц задержка не нужна.<br>
<br>
Предлагаю самостоятельно устранить баг при смене голосов. Подсказка: при выборе голоса др. TTS ошибки нет, ошибка возникает при последовательной смене HTS-голосов.]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3672118</guid>
        <pubDate>Sat, 28 May 2016 01:41:53 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3672118</link>
        <description><![CDATA[webcoder88: Несколько слов о регулировке темпа речи.<br>
Если перенести таблицу преобразования  из исходного кода Flite, то регулятор будет работать с точностью до наоборот. При движении влево темп речи будет увеличиваться, при движении вправо - уменьшаться. Самое простое решение, которое приходит в голову, это взять обратную величину от значения в таблице и отправить его в движок flite+hts. Но такое решение не оптимально, тк график функции 1/x сильно отличается от прямой линии.<br>
Поэтому лучшим вариантом будет испавить таблицу вручную, те перевернуть числовой ряд на 180 градусов. После замены проверка регулятора показала, что темп речи изменяется в более широком диапазоне, чем необходимо на практике. Уменьшаем шаг приращения темпа речи на меньшее значение и методом подбора получаем окончательный вариант таблицы.<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">/* Each step is prev +(1/20) */</div><div class="code_line">static const double sapi_ratetab_foo[21] = {</div><div class="code_line">&nbsp;&nbsp; 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95,</div><div class="code_line">&nbsp;&nbsp; 1.0,</div><div class="code_line">&nbsp;&nbsp; 1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5</div><div class="code_line">};</div><div class="code_line">static const double *sapi_ratetab = sapi_ratetab_foo + 10;</div></ol></div></div></div></div><br>
<br>
<br>
Функции преобразования значения регулятора в значение темпа речи:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">static double</div><div class="code_line">convert_sapi_rate(int r)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (r &#60; -10)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;r = -10;</div><div class="code_line">&nbsp;&nbsp; &nbsp;else if (r &#62; 10)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;r = 10;</div><div class="code_line">&nbsp;&nbsp; &nbsp;return sapi_ratetab[r];</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
Таблица static const double sapi_pitchtab_foo[21]  для преобразования pitch  используется без изменения.<br>
<br>
Далее понадобится дудочка как фильме &quot;Прометей&quot; и похоже, что Сирианская.]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3670097</guid>
        <pubDate>Sun, 15 May 2016 06:19:24 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3670097</link>
        <description><![CDATA[webcoder88: Хотя я писал драйвер под тибетские мантры, Аллах больше Тибета. <br>
Аллах Велик, поэтому кому-то в Аллахе это обязательно пригодится.<br>
 <br>
<br>
Шаг 4<br>
Если вы сделали все правильно, то ваш драйвер должен проговаривать английский текст любым зарегистрированным английским голосом. Но остался один баг,<br>
который проявляется только при смене голоса в аплете Речь Панели управления и приводит к ошибке приложения. Я нашел один способ пофиксить его, но <br>
предлагаю вам самостоятельно найти более правильное решение. <br>
<br>
Теперь осталось доделать синхронное подсветку проговариваемого текста. Хотя Майкрософт предлагает специальное приложение TTSApp.exe, будем проверять <br>
драйвер в том же апплете Речь.  Отмечу, что приложение TTSApp.exe позволяет выбрать голос, проговорить любой текст, сохранить синтезированную речь в файл, <br>
вывести события TTS в спец. окне, менять значение темпа речи и громкости.<br>
<br>
Для лучшего понимания работы sapi-драйвера лучше почитать статьи, посвященные SAPI-интерфейсу.<br>
В одной замечательной статье (сохраненной где-то на жестком диске) описана модель событий драйвера, хотя с первого раза не совсем ясно, как добавленные <br>
события подсвечивают нужные слова. Просто следует запомнить, что нужно правильно добавить события, а драйвер сам асинхронно в удобное время обработает весь набор добавленных событий.<br>
Механизм добавления и обработки событий  будем проверять в функции speak_frag.<br>
Здесь я привожу измененный вариант функции. <br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">void</div><div class="code_line">CFliteTTSEngineObj::speak_frag()</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;//cst_tokenstream *ts; // global now</div><div class="code_line">&nbsp;&nbsp; &nbsp;const char *token; // global now</div><div class="code_line">&nbsp;&nbsp; &nbsp;cst_item *t;</div><div class="code_line">&nbsp;&nbsp; &nbsp;char *text;</div><div class="code_line">&nbsp;&nbsp; &nbsp;size_t len;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;int i;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;cst_item *s = NULL;</div><div class="code_line">&nbsp;&nbsp; &nbsp;char **label_data = NULL;</div><div class="code_line">&nbsp;&nbsp; &nbsp;int label_size = 0;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;setlocale(LC_CTYPE,(const char*)&quot;&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;len = wcstombs(NULL, curr_frag-&#62;pTextStart, curr_frag-&#62;ulTextLen);</div><div class="code_line">&nbsp;&nbsp; &nbsp;text = cst_alloc(char, len+1);</div><div class="code_line">&nbsp;&nbsp; &nbsp;wcstombs(text, curr_frag-&#62;pTextStart, curr_frag-&#62;ulTextLen);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;//MessageBoxA(0,text,(char*)&quot;text&quot;,0); //***</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;////v 1</div><div class="code_line">&nbsp;&nbsp; utt_set_input_text(curr_utt,text);</div><div class="code_line">&nbsp;&nbsp; </div><div class="code_line">&nbsp;&nbsp; ts = my_ts_open_string(curr_utt, text);</div><div class="code_line">&nbsp;&nbsp; //cst_free(text); // move to func. end</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;while (!ts_eof(ts)) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sztoken = ts_get(ts);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;t = append_new_token(ts, token, tok_rel);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;//item_set_int(t, &quot;token_pos&quot;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// &nbsp; &nbsp; &nbsp; ts-&#62;token_pos + curr_frag-&#62;ulTextSrcOffset);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;item_set_int(t, &quot;token_pos&quot;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; curr_frag-&#62;ulTextSrcOffset);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;item_set_int(t, &quot;token_length&quot;, strlen(sztoken));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;set_local_prosody(t, &amp;curr_frag-&#62;State);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// &nbsp;itoa(item_feat_int(t, &quot;token_pos&quot;) + curr_frag-&#62;ulTextSrcOffset, buff, 10); //если не устанавливалась, то сброс программы</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//MessageBoxA(0,buff,(char*)&quot;token_length&quot;,0); //***</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SPEVENT evt;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SpClearEvent(&amp;evt);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;evt.eEventId = SPEI_WORD_BOUNDARY;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;evt.elParamType = SPET_LPARAM_IS_UNDEFINED;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;evt.ullAudioStreamOffset = 0; //bcount + offset;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;evt.wParam = strlen(sztoken);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;evt.lParam = ts-&#62;token_pos + curr_frag-&#62;ulTextSrcOffset;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;site-&#62;AddEvents(&amp;evt, 1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//Sleep(1000);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (relation_head(tok_rel)) { //if (relation_head(tok_rel) &amp;&amp; utt_break(ts, token, tok_rel)) {</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (aborted)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;goto pod_bay_doors;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (sentence_skip == 0) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//send_sentence_event(ts-&#62;token_pos</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ curr_frag-&#62;ulTextSrcOffset);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//MessageBoxA(0,(char*)&quot;need_synth_one_utt&quot;,0,0); //***</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//synth_one_utt();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//start_new_utt();</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} else {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--sentence_skip;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;site-&#62;CompleteSkip(1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//start_new_utt();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;//itoa(ts-&#62;token_pos + curr_frag-&#62;ulTextSrcOffset, buff, 10);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;//MessageBoxA(0,buff,token,0); //***</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">pod_bay_doors: /* Open the POD bay doors, KAL... */</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; cst_free(text);</div><div class="code_line">&nbsp;&nbsp; delete_tokenstream(ts); //&#60;----</div><div class="code_line">&nbsp;&nbsp; delete_utterance(curr_utt);</div><div class="code_line">&nbsp;&nbsp; curr_utt = NULL;</div><div class="code_line">&nbsp;&nbsp; tok_rel = NULL;</div><div class="code_line">&nbsp;&nbsp; return;</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
Следует отметить, что поток токенов создается и работает независимо от функции высказывания utt и подключается к ней в случае необходимости.<br>
Если вы соберете и проверите код, то не заметите никаких изменений, хотя драйвер правильно обрабатывает события и подсвечивает текст.<br>
Для того, чтобы заметить подсветку, необходимо ввести временную задержку, например в 1 сек. Для этого раскоментируйте строку //Sleep(1000); и снова проверьте его работу.<br>
драйвера.  Теперь видно, что подсветка работает, но текст не проговаривается.<br>
<br>
В конечном варианте я заменил этот цикл на типичный код синтеза текста из flite+hts.<br>
Здесь привожу почти законченный код.<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">void</div><div class="code_line">CFliteTTSEngineObj::speak_frag()</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;//cst_tokenstream *ts; // global now</div><div class="code_line">&nbsp;&nbsp; &nbsp;const char *token; // global now</div><div class="code_line">&nbsp;&nbsp; &nbsp;cst_item *t;</div><div class="code_line">&nbsp;&nbsp; &nbsp;char *text;</div><div class="code_line">&nbsp;&nbsp; &nbsp;size_t len;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;int i;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;cst_item *s = NULL;</div><div class="code_line">&nbsp;&nbsp; &nbsp;char **label_data = NULL;</div><div class="code_line">&nbsp;&nbsp; &nbsp;int label_size = 0;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;setlocale(LC_CTYPE,(const char*)&quot;&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;len = wcstombs(NULL, curr_frag-&#62;pTextStart, curr_frag-&#62;ulTextLen);</div><div class="code_line">&nbsp;&nbsp; &nbsp;text = cst_alloc(char, len+1);</div><div class="code_line">&nbsp;&nbsp; &nbsp;wcstombs(text, curr_frag-&#62;pTextStart, curr_frag-&#62;ulTextLen);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; //MessageBoxA(0,text,(char*)&quot;text&quot;,0); //***</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;////v 1</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; utt_set_input_text(curr_utt,text); // &nbsp; flite_do_synth(curr_utt, curr_vox, utt_synth);</div><div class="code_line">&nbsp;&nbsp; </div><div class="code_line">&nbsp;&nbsp; ts = my_ts_open_string(curr_utt, text);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; if (curr_utt == NULL)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;return;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; for (s = relation_head(utt_relation(curr_utt, &quot;Segment&quot;)); s; s = item_next(s))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;label_size++;</div><div class="code_line">&nbsp;&nbsp; if (label_size &#60;= 0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;return;</div><div class="code_line">&nbsp;&nbsp; label_data = (char **) calloc(label_size, sizeof(char *));</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; for (i = 0, s = relation_head(utt_relation(curr_utt, &quot;Segment&quot;)); s;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;s = item_next(s), i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;label_data[i] = (char *) calloc(MAXBUFLEN, sizeof(char));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;Flite_HTS_Engine_create_label(&amp;engine, s, label_data[i]);</div><div class="code_line">&nbsp;&nbsp; }</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; if (phoneme_alignment) &nbsp; &nbsp; &nbsp; // modify label</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;HTS_Label_set_frame_specified_flag(&amp;engine.engine.label, TRUE);</div><div class="code_line">&nbsp;&nbsp; if (speech_speed != 1.0) &nbsp; &nbsp; // modify label</div><div class="code_line">&nbsp;&nbsp; HTS_Label_set_speech_speed(&amp;engine.engine.label, speech_speed);</div><div class="code_line">&nbsp;&nbsp; </div><div class="code_line">&nbsp;&nbsp; if (volume!=100) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // set volume &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;hts_volume = volume*0.01;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//hts_volume = hts_volume/100; //err---&#62;hts_volume=0</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;HTS_Engine_set_volume(&amp;engine.engine, hts_volume );</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; // speech synthesis part</div><div class="code_line">&nbsp;&nbsp; HTS_Engine_load_label_from_string_list(&amp;engine.engine, label_data, label_size);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; HTS_Engine_create_sstream(&amp;engine.engine);</div><div class="code_line">&nbsp;&nbsp; HTS_Engine_create_pstream(&amp;engine.engine);</div><div class="code_line">&nbsp;&nbsp; HTS_Engine_create_gstream(&amp;engine.engine);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">pod_bay_doors: /* Open the POD bay doors, KAL... */</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; HTS_Engine_refresh(&amp;engine.engine);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; for (i = 0; i &#60; label_size; i++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;free(label_data[i]);</div><div class="code_line">&nbsp;&nbsp; free(label_data);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; cst_free(text);</div><div class="code_line">&nbsp;&nbsp; delete_tokenstream(ts); //&#60;----</div><div class="code_line">&nbsp;&nbsp; delete_utterance(curr_utt);</div><div class="code_line">&nbsp;&nbsp; curr_utt = NULL;</div><div class="code_line">&nbsp;&nbsp; tok_rel = NULL;</div><div class="code_line">&nbsp;&nbsp; return;</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
 <br>
Обработку событий от интефейса и подсветку текста можно выполнить только в функции   HTS_Engine_create_gstream(&amp;engine.engine);<br>
Для этого потребуется объявить ее в классе и внести в код сооответстующие изменения.]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3667551</guid>
        <pubDate>Tue, 26 Apr 2016 10:19:29 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3667551</link>
        <description><![CDATA[webcoder88: Вариант кода синтеза речи и обработки действий пользователя<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">/* HTS_GStreamSet_create: generate speech */</div><div class="code_line">/* (stream[0] == spectrum &amp;&amp; stream[1] == lf0) */</div><div class="code_line">HTS_Boolean </div><div class="code_line">CFliteTTSEngineObj::HTS_GStreamSet_create2(HTS_GStreamSet * gss, HTS_PStreamSet * pss, int stage, HTS_Boolean use_log_gain, int sampling_rate, int fperiod, double alpha, double beta, HTS_Boolean * stop, double volume, HTS_Audio * audio)</div><div class="code_line">{</div><div class="code_line">&nbsp;//...</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;int lab_duration = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;int nstate = engine.engine.sss.nstate; //=5</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;for (int j=0; j&#60;nstate; j++){ &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lab_duration = lab_duration + &nbsp;engine.engine.sss.duration[i*nstate+j];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//itoa( lab_duration, buff, 10);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;// &nbsp; &nbsp;MessageBoxA(0,buff,(char*)&quot;lab_duration&quot;,0); //***</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (j = 0; j &#60; lab_duration &amp;&amp; (*stop) == FALSE; j++){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (gss-&#62;nstream &#62;= 3)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lpf = &amp;gss-&#62;gstream[2].par[i][0];</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;get_actions_and_do_them();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (aborted)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;goto stop_synth;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (sentence_skip == 0) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//send_sentence_event(ts-&#62;token_pos</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ curr_frag-&#62;ulTextSrcOffset);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;HTS_Vocoder_synthesize(&amp;v, gss-&#62;gstream[0].static_length - 1, gss-&#62;gstream[1].par[k][0], </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp;gss-&#62;gstream[0].par[k][0], nlpf, lpf, alpha, beta, volume, &amp;gss-&#62;gspeech[k * fperiod], audio);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;k++; // next frame</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} else {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--sentence_skip;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;site-&#62;CompleteSkip(1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} // end for on lab_duration</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">//...</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
Алах Акбар&#33;]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3667509</guid>
        <pubDate>Tue, 26 Apr 2016 04:30:59 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3667509</link>
        <description><![CDATA[webcoder88: Шаг 3<br>Краткий обзор драйвера Flite. Функции приводятся в порядке их вызова. <br>Файл FliteTTSEngineObj.cpp<br> <br>STDMETHODIMP CFliteTTSEngineObj::SetObjectToken(ISpObjectToken* pToken) - Инициализация драйвера: чтение параметров реестра, инициализация структур вокодера и структуры текущего высказывания.<br><br>STDMETHODIMP CFliteTTSEngineObj::GetOutputFormat(const GUID * pTargetFormatId,<br>				    const WAVEFORMATEX * pTargetWaveFormatEx,<br>				    GUID * pDesiredFormatId, <br>				    WAVEFORMATEX ** ppCoMemDesiredWaveFormatEx) - функция инициализации структуры WAVEFORMATEX, определяющей формат аудиоданных.<br><br>STDMETHODIMP CFliteTTSEngineObj::Speak(DWORD dwSpeakFlags,<br>			  REFGUID rguidFormatId,<br>			  const WAVEFORMATEX * pWaveFormatEx,<br>			  const SPVTEXTFRAG* pTextFragList,<br>			  ISpTTSEngineSite* pOutputSite) - основная функция, содержащая цикл обработки событий драйвера: SPVA_Speak, SPVA_SpellOut, SPVA_Pronounce, SPVA_Silence, SPVA_Bookmark, а также цикл обрабоки событий, поступивших от пользователя. Эти события обрабатываются функциями:<br>speak_frag() - создание потока токенов (слов) и синтез речи по полученному тексту (фрагу);<br>spell_frag() - создание потока токенов(букв) для синтеза по буквам; <br>pronounce_frag() - создание потока токенов(фонем) для синтеза по фонемам;<br>silence_frag() - записать паузу в выходной звуковой поток, длит-ть паузы задается в теге, в мсек;<br>set_bookmark() - создание потока токенов(закладок) для синтеза по закладкам;<br>get_actions_and_do_them - функция с циклом обработки событий от интерфейсных элементах (действиях пользователя):<br>SPVES_ABORT, SPVST_SENTENCE, SPVES_RATE, SPVES_VOLUME.<br>Два последних события возникают при изменении пользователем темпа речи и громкости соответственно. <br>Здесь, Фраг - весь текст, переданный из приложения: предложение или текст из набора предложений.<br><br>speak_frag() - функция для создания потока токенов полученного текста и  синтеза речи в цикле по токенам. <br>Я особо не вникал, как складываются потоки токенов, но синтезируются они с помощью этой функции.<br><br>Здесь же устанавливается значения позиции токена в тексте и его длина и обрабатываются действия пользователя <br>(снова вызывается get_actions_and_do_them()).<br>Далее эти значения копируются в структуру Высказывания curr_utt и  заполняются остальные параметры Высказывания.<br>Синтез заполненной структуры для текущего токена происходит в synth_one_utt();<br><br>synth_one_utt() - функция синтеза речи по заполненной структуре текущего Высказывания;<br><br>Пока следует отметить, что в новом драйвере можно и нужно исключить функцию synth_one_utt(),<br>а синтез функциями HTS_engine сделать непосредственно в speak_frag().<br>Однако очистка потоков движка занимает много времени и приводит к задержкам между произносимыми токенами (словами) в 1-3 сек.<br>В конечном варианте, пришлось отказаться от цикла формирования потока токенов и их раздельного синтеза и вернуться к циклу создания меток и их синтеза.<br>Действия пользователя можно обрабатывать в цикле синтеза меток функцией get_actions_and_do_them() или кодом из нее.<br>Темп и громкость речи регулируется путем установки 2-х переменных, объявленных в классе.<br>Их значения обрабатыаются непосредственно перед синтезом меток.<br><br>Сложнее всего описать алгоритм формирования событий для синхронизации подстветки проговариваемых слов.]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3667013</guid>
        <pubDate>Fri, 22 Apr 2016 02:44:40 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3667013</link>
        <description><![CDATA[webcoder88: register-vox:<br>
Компилятор.<br>
E:&#092;WinDDK&#092;7600.16385.1&#092;inc&#092;atl71<br>
Компоновщик.<br>
../Release/register-vox.exe<br>
E:&#092;WinDDK&#092;7600.16385.1&#092;lib&#092;ATL&#092;i386<br>
<br>
Новый драйвер будет читать параметры и путь к файлам голоса из реестра, поэтому начнем с проекта register-vox. Заменим код файла register-vox.сpp на немного исправленный код из проекта SALB, тк лучше алгоритм. Кроме того, запись параметров производится одновременно и в ключ реестра и в его подключ Attributes. Это сильно облегчит извлечение пути во время инициализации sapi-драйвера.<br>
<br>
После сборки и запуска _register-alan.bat в реестре появится новый ключ HKEY_LOCAL_MACHINE&#092;SOFTWARE&#092;Microsoft&#092;Speech&#092;Voices&#092;Tokens&#092;HTS Voice Alan<br>
Экспорт ключа в текстовый файл:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">Windows Registry Editor Version 5.00</div><div class="code_line">&nbsp;</div><div class="code_line">[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\HTS Voice Alan]</div><div class="code_line">&quot;CLSID&quot;=&quot;{72CEF72B-809E-4CB4-A63C-ADC7938CFD5B}&quot;</div><div class="code_line">@=&quot;HTS Voice Alan&quot;</div><div class="code_line">&quot;409&quot;=&quot;HTS Voice Alan&quot;</div><div class="code_line">&quot;Language&quot;=&quot;en-us&quot;</div><div class="code_line">&quot;Voxpath&quot;=&quot;С:\flite+hts_engine-1.02.02\sapi2008\FliteCMUKalDiphone\Release\data\voices\Alan&quot;</div><div class="code_line">&quot;Textrules&quot;=&quot;&quot;</div><div class="code_line">&quot;Logfile&quot;=&quot;С:\_flite+hts_engine-1.02.02\sapi2008\FliteCMUKalDiphone\Release\alan.log&quot;</div><div class="code_line">&nbsp;</div><div class="code_line">[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\HTS Voice Alan\Attributes]</div><div class="code_line">&quot;Gender&quot;=&quot;Female&quot;</div><div class="code_line">&quot;Name&quot;=&quot;HTS Voice Alan&quot;</div><div class="code_line">&quot;Language&quot;=&quot;409&quot;</div><div class="code_line">&quot;Age&quot;=&quot;Adult&quot;</div><div class="code_line">&quot;Vendor&quot;=&quot;FTW&quot;</div></ol></div></div></div></div><br>
<br>
<br>
Далее можно переходить к сборке FliteTTSEngineObj.<br>
В FliteTTSEngineObj.h добавляется строка #include &quot;flite_hts_engine.h&quot; и  коментируется строка flite_init();	--&#62;	//flite_init();<br>
<br>
В опр. класса после деструктора ~ добавляются новые методы и данные:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">// Flite+HTS methods</div><div class="code_line">public:</div><div class="code_line">static void Flite_HTS_Engine_create_label(Flite_HTS_Engine * f, cst_item * item, char *label);</div><div class="code_line">void Flite_HTS_Engine_initialize(Flite_HTS_Engine * f,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HTS_Boolean use_lpf,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int sampling_rate,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int fperiod,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double alpha,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int stage,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double beta,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int audio_buff_size,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double uv_threshold,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HTS_Boolean use_log_gain,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double gv_weight_mgc, double gv_weight_lf0,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double gv_weight_lpf);</div><div class="code_line">&nbsp;</div><div class="code_line">void Flite_HTS_Engine_load_voice(Flite_HTS_Engine * f, &nbsp;char* voice_path);</div><div class="code_line">void Flite_HTS_Engine_clear(Flite_HTS_Engine * f);</div><div class="code_line">&nbsp;</div><div class="code_line">/* ISpObjectWithToken methods */</div><div class="code_line">public:</div><div class="code_line">&nbsp;&nbsp; &nbsp;STDMETHODIMP SetObjectToken(ISpObjectToken * pToken);</div><div class="code_line">&nbsp;&nbsp; &nbsp;STDMETHODIMP GetObjectToken(ISpObjectToken** ppToken)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{ return SpGenericGetObjectToken(ppToken, vox_token); }</div><div class="code_line">&nbsp;</div><div class="code_line">/* ISpTTSEngine methods */</div><div class="code_line">public:</div><div class="code_line">&nbsp;&nbsp; &nbsp;STDMETHOD(Speak)(DWORD dwSpeakFlags,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; REFGUID rguidFormatId, const WAVEFORMATEX * pWaveFormatEx,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; const SPVTEXTFRAG* pTextFragList, ISpTTSEngineSite* pOutputSite);</div><div class="code_line">&nbsp;&nbsp; &nbsp;STDMETHOD(GetOutputFormat)(const GUID * pTargetFormatId,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; const WAVEFORMATEX * pTargetWaveFormatEx,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GUID * pDesiredFormatId, </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WAVEFORMATEX ** ppCoMemDesiredWaveFormatEx);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;void get_actions_and_do_them();</div><div class="code_line">&nbsp;&nbsp; &nbsp;HTS_Boolean HTS_Engine_create_gstream2(HTS_Engine * engine);</div><div class="code_line">&nbsp;&nbsp; &nbsp;HTS_Boolean HTS_GStreamSet_create2(HTS_GStreamSet * gss, HTS_PStreamSet * pss, int stage, </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;HTS_Boolean use_log_gain, int sampling_rate, int fperiod, double alpha, double beta, </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;HTS_Boolean * stop, double volume, HTS_Audio * audio);</div><div class="code_line">&nbsp;</div><div class="code_line">/* Implementation stuff */</div><div class="code_line">protected:</div><div class="code_line">&nbsp;&nbsp; &nbsp;/* These get set by a subclass&#39;s constructor. &nbsp;That&#39;s not the</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; proper C++ way to do this, but I do not care. */</div><div class="code_line">&nbsp;&nbsp; &nbsp;cst_voice *(*regfunc)(const char *);</div><div class="code_line">&nbsp;&nbsp; &nbsp;void (*unregfunc)(cst_voice *);</div><div class="code_line">&nbsp;&nbsp; &nbsp;int (*phonemefunc)(cst_item *);</div><div class="code_line">&nbsp;&nbsp; &nbsp;int (*visemefunc)(cst_item *);</div><div class="code_line">&nbsp;&nbsp; &nbsp;int (*featurefunc)(cst_item *);</div><div class="code_line">&nbsp;&nbsp; &nbsp;cst_val *(*pronouncefunc)(SPPHONEID *);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;/* SAPI&#39;s use of the term &quot;token&quot; is quite unfortunate. */</div><div class="code_line">&nbsp;&nbsp; &nbsp;CComPtr&#60;ISpObjectToken&#62; vox_token;</div><div class="code_line">&nbsp;&nbsp; &nbsp;CComPtr&#60;ISpObjectToken&#62; attr_token;</div><div class="code_line">&nbsp;&nbsp; &nbsp;cst_voice *curr_vox;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;/* Synthesis state variables */</div><div class="code_line">&nbsp;&nbsp; &nbsp;cst_utterance *curr_utt;</div><div class="code_line">&nbsp;&nbsp; &nbsp;cst_relation *tok_rel;</div><div class="code_line">&nbsp;&nbsp; &nbsp;const SPVTEXTFRAG *curr_frag;</div><div class="code_line">&nbsp;&nbsp; &nbsp;ISpTTSEngineSite *site;</div><div class="code_line">&nbsp;&nbsp; &nbsp;ULONGLONG bcount;</div><div class="code_line">&nbsp;&nbsp; &nbsp;int sentence_start;</div><div class="code_line">&nbsp;&nbsp; &nbsp;int sentence_skip;</div><div class="code_line">&nbsp;&nbsp; &nbsp;int aborted;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;const char *sztoken;</div><div class="code_line">&nbsp;&nbsp; &nbsp;cst_tokenstream *ts;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;FILE *file_list[num_hts_data_files];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; /* engine */</div><div class="code_line">&nbsp;&nbsp; &nbsp;//static</div><div class="code_line">&nbsp;&nbsp; &nbsp;Flite_HTS_Engine engine;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">private:</div><div class="code_line">&nbsp;//...</div><div class="code_line">static int open_hts_data_files(const char *path,FILE *file_list[num_hts_data_files]);</div><div class="code_line">static void close_hts_data_files(FILE *file_list[num_hts_data_files]);</div></ol></div></div></div></div><br>
<br>
<br>
В начале FliteTTSEngineObj.cpp после существующих инклудов нужно добавить код<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">#include &#60;clocale&#62; </div><div class="code_line">&nbsp;</div><div class="code_line">#define MAXBUFLEN 1024</div><div class="code_line">&nbsp;</div><div class="code_line">#include &quot;config.c&quot;</div><div class="code_line">&nbsp;</div><div class="code_line">char buff[30]; &nbsp;//for debug output</div><div class="code_line">&nbsp;</div><div class="code_line">typedef struct</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp;const char *name;</div><div class="code_line">&nbsp;&nbsp;const char *open_mode;</div><div class="code_line">&nbsp;&nbsp;int is_optional;</div><div class="code_line">} hts_data_file_info;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">static const hts_data_file_info hts_data_list[num_hts_data_files]={</div><div class="code_line">&nbsp;&nbsp;{&quot;dur.pdf&quot;,&quot;rb&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;tree-dur.inf&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;mgc.pdf&quot;,&quot;rb&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;tree-mgc.inf&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;mgc.win1&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;mgc.win2&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;mgc.win3&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;lf0.pdf&quot;,&quot;rb&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;tree-lf0.inf&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;lf0.win1&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;lf0.win2&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;lf0.win3&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;lpf.pdf&quot;,&quot;rb&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;tree-lpf.inf&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;lpf.win1&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;gv-mgc.pdf&quot;,&quot;rb&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;tree-gv-mgc.inf&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;gv-lf0.pdf&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;tree-gv-lf0.inf&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;gv-mgc-lpf.pdf&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;tree-gv-lpf.inf&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;gv-switch.inf&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;voice.params&quot;,&quot;r&quot;,0},</div><div class="code_line">&nbsp;&nbsp;{&quot;voice.info&quot;,&quot;r&quot;,0}};</div><div class="code_line">&nbsp;</div><div class="code_line">static cst_val *sapi_tokentowords(cst_item *i);</div><div class="code_line">&nbsp;</div><div class="code_line">int CFliteTTSEngineObj::open_hts_data_files(const char *path,FILE *file_list[num_hts_data_files])</div><div class="code_line">{</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;int result=1;</div><div class="code_line">&nbsp;&nbsp;int i,l;</div><div class="code_line">&nbsp;&nbsp;</div><div class="code_line">&nbsp;&nbsp;//printf(&quot;*****111***************\n\n&quot;);</div><div class="code_line">#ifdef WIN32</div><div class="code_line">&nbsp;&nbsp;char sep=&#39;\&#39;;</div><div class="code_line">#else</div><div class="code_line">&nbsp;&nbsp;char sep=&#39;/&#39;;</div><div class="code_line">#endif</div><div class="code_line">&nbsp;&nbsp;char *full_path;</div><div class="code_line">&nbsp;&nbsp;char *name;</div><div class="code_line">&nbsp;&nbsp;memset(file_list,0,num_hts_data_files*sizeof(FILE*));</div><div class="code_line">&nbsp;&nbsp;l=strlen(path);</div><div class="code_line">&nbsp;&nbsp;if(l==0)</div><div class="code_line">&nbsp;&nbsp; &nbsp;return 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//printf(&quot;****222****************\n\n&quot;);</div><div class="code_line">&nbsp;&nbsp;full_path=(char *)calloc(l+20,sizeof(char));</div><div class="code_line">&nbsp;&nbsp;if(full_path==NULL)</div><div class="code_line">&nbsp;&nbsp; &nbsp;return 0;</div><div class="code_line">&nbsp;&nbsp;memcpy(full_path,path,l);</div><div class="code_line">&nbsp;&nbsp;if(full_path[l-1]!=sep)</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;full_path[l]=sep;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;name=full_path+l+1;</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp;name=full_path+l;</div><div class="code_line">&nbsp;&nbsp;for(i=0;i&#60;num_hts_data_files;i++)</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;strcpy(name,hts_data_list[i].name);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//printf(&quot;lib.c filename = %s\n&quot;, name);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//printf(&quot;lib.c full_path = %s\n&quot;, full_path);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;file_list[i]=fopen(full_path,hts_data_list[i].open_mode);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;//printf(&quot;lib.c file_list[%d] = %d\n&quot;, i, file_list[i]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if (i&#60;15){ // error if no any file from first 14 files</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if((file_list[i]==NULL)&amp;&amp;(!hts_data_list[i].is_optional))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;result=0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp;free(full_path);</div><div class="code_line">&nbsp;&nbsp;if(!result)</div><div class="code_line">&nbsp;&nbsp; &nbsp;close_hts_data_files(file_list);</div><div class="code_line">&nbsp;&nbsp;return result;</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">void CFliteTTSEngineObj::close_hts_data_files(FILE *file_list[num_hts_data_files])</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp;int i;</div><div class="code_line">&nbsp;&nbsp;for(i=0;i&#60;num_hts_data_files;i++)</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if(file_list[i]!=NULL)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fclose(file_list[i]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;file_list[i]=NULL;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">typedef struct</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp;int id;</div><div class="code_line">&nbsp;&nbsp;HTS_Engine *engine;</div><div class="code_line">&nbsp;&nbsp;int is_free;</div><div class="code_line">} engine_resource;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">void CFliteTTSEngineObj::Flite_HTS_Engine_create_label(Flite_HTS_Engine * f, cst_item * item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;char *label)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; char seg_pp[8];</div><div class="code_line">&nbsp;&nbsp; char seg_p[8];</div><div class="code_line">&nbsp;&nbsp; char seg_c[8];</div><div class="code_line">&nbsp;&nbsp; char seg_n[8];</div><div class="code_line">&nbsp;&nbsp; char seg_nn[8];</div><div class="code_line">&nbsp;&nbsp; char endtone[8];</div><div class="code_line">&nbsp;&nbsp; int sub_phrases = 0;</div><div class="code_line">&nbsp;&nbsp; int lisp_total_phrases = 0;</div><div class="code_line">&nbsp;&nbsp; int tmp1 = 0;</div><div class="code_line">&nbsp;&nbsp; int tmp2 = 0;</div><div class="code_line">&nbsp;&nbsp; int tmp3 = 0;</div><div class="code_line">&nbsp;&nbsp; int tmp4 = 0;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; /* load segments */</div><div class="code_line">&nbsp;&nbsp; strcpy(seg_pp, ffeature_string(item, &quot;p.p.name&quot;));</div><div class="code_line">&nbsp;&nbsp; strcpy(seg_p, ffeature_string(item, &quot;p.name&quot;));</div><div class="code_line">&nbsp;&nbsp; strcpy(seg_c, ffeature_string(item, &quot;name&quot;));</div><div class="code_line">&nbsp;&nbsp; strcpy(seg_n, ffeature_string(item, &quot;n.name&quot;));</div><div class="code_line">&nbsp;&nbsp; strcpy(seg_nn, ffeature_string(item, &quot;n.n.name&quot;));</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; /* load endtone */</div><div class="code_line">&nbsp;&nbsp; strcpy(endtone,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_string(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;R:SylStructure.parent.parent.R:Phrase.parent.daughtern.R:SylStructure.daughtern.endtone&quot;));</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; if (strcmp(seg_c, &quot;pau&quot;) == 0) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;/* for pause */</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if (item_next(item) != NULL) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; sub_phrases =</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;n.R:SylStructure.parent.R:Syllable.sub_phrases&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; tmp1 =</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;n.R:SylStructure.parent.parent.R:Phrase.parent.lisp_total_syls&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; tmp2 =</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;n.R:SylStructure.parent.parent.R:Phrase.parent.lisp_total_words&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; lisp_total_phrases =</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;n.R:SylStructure.parent.parent.R:Phrase.parent.lisp_total_phrases&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;} else {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; sub_phrases =</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;p.R:SylStructure.parent.R:Syllable.sub_phrases&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; tmp1 =</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;p.R:SylStructure.parent.parent.R:Phrase.parent.lisp_total_syls&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; tmp2 =</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;p.R:SylStructure.parent.parent.R:Phrase.parent.lisp_total_words&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; lisp_total_phrases =</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;p.R:SylStructure.parent.parent.R:Phrase.parent.lisp_total_phrases&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;sprintf(label,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;%s^%s-%s+%s=%s@x_x/A:%d_%d_%d/B:x-x-x@x-x&amp;x-x#x-x$x-x!x-x;x-x|x/C:%d+%d+%d/D:%s_%d/E:x+x@x+x&amp;x+x#x+x/F:%s_%d/G:%d_%d/H:x=x^%d=%d|%s/I:%d=%d/J:%d+%d-%d&quot;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strcmp(seg_pp, &quot;0&quot;) == 0 ? &quot;x&quot; : seg_pp,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strcmp(seg_p, &quot;0&quot;) == 0 ? &quot;x&quot; : seg_p,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;seg_c,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strcmp(seg_n, &quot;0&quot;) == 0 ? &quot;x&quot; : seg_n,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strcmp(seg_nn, &quot;0&quot;) == 0 ? &quot;x&quot; : seg_nn,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item, &quot;p.R:SylStructure.parent.R:Syllable.stress&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item, &quot;p.R:SylStructure.parent.R:Syllable.accented&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;p.R:SylStructure.parent.R:Syllable.syl_numphones&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item, &quot;n.R:SylStructure.parent.R:Syllable.stress&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item, &quot;n.R:SylStructure.parent.R:Syllable.accented&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;n.R:SylStructure.parent.R:Syllable.syl_numphones&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_string(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;p.R:SylStructure.parent.parent.R:Word.gpos&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;p.R:SylStructure.parent.parent.R:Word.word_numsyls&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_string(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;n.R:SylStructure.parent.parent.R:Word.gpos&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;n.R:SylStructure.parent.parent.R:Word.word_numsyls&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;p.R:SylStructure.parent.parent.R:Phrase.parent.lisp_num_syls_in_phrase&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;p.R:SylStructure.parent.parent.R:Phrase.parent.lisp_num_words_in_phrase&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sub_phrases + 1, lisp_total_phrases - sub_phrases,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;endtone,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;n.R:SylStructure.parent.parent.R:Phrase.parent.lisp_num_syls_in_phrase&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;n.R:SylStructure.parent.parent.R:Phrase.parent.lisp_num_words_in_phrase&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;tmp1, tmp2, lisp_total_phrases);</div><div class="code_line">&nbsp;&nbsp; } else {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;/* for no pause */</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;tmp1 = ffeature_int(item, &quot;R:SylStructure.pos_in_syl&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;tmp2 =</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item, &quot;R:SylStructure.parent.R:Syllable.syl_numphones&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;tmp3 = ffeature_int(item, &quot;R:SylStructure.parent.R:Syllable.pos_in_word&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;tmp4 =</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.parent.R:Word.word_numsyls&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;sub_phrases =</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item, &quot;R:SylStructure.parent.R:Syllable.sub_phrases&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;lisp_total_phrases =</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.parent.R:Phrase.parent.lisp_total_phrases&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;sprintf(label,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;%s^%s-%s+%s=%s@%d_%d/A:%d_%d_%d/B:%d-%d-%d@%d-%d&amp;%d-%d#%d-%d$%d-%d!%d-%d;%d-%d|%s/C:%d+%d+%d/D:%s_%d/E:%s+%d@%d+%d&amp;%d+%d#%d+%d/F:%s_%d/G:%d_%d/H:%d=%d^%d=%d|%s/I:%d=%d/J:%d+%d-%d&quot;,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strcmp(seg_pp, &quot;0&quot;) == 0 ? &quot;x&quot; : seg_pp, strcmp(seg_p,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;0&quot;) ==</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 ? &quot;x&quot; : seg_p, seg_c, strcmp(seg_n, &quot;0&quot;) == 0 ? &quot;x&quot; : seg_n,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strcmp(seg_nn, &quot;0&quot;) == 0 ? &quot;x&quot; : seg_nn, tmp1 + 1, tmp2 - tmp1,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item, &quot;R:SylStructure.parent.R:Syllable.p.stress&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item, &quot;R:SylStructure.parent.R:Syllable.p.accented&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.R:Syllable.p.syl_numphones&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item, &quot;R:SylStructure.parent.R:Syllable.stress&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item, &quot;R:SylStructure.parent.R:Syllable.accented&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;tmp2, tmp3 + 1, tmp4 - tmp3, ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;R:SylStructure.parent.R:Syllable.syl_in&quot;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ 1, ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;R:SylStructure.parent.R:Syllable.syl_out&quot;) + 1,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.R:Syllable.ssyl_in&quot;) + 1,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.R:Syllable.ssyl_out&quot;) + 1,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.R:Syllable.asyl_in&quot;) + 1,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.R:Syllable.asyl_out&quot;) + 1,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.R:Syllable.lisp_distance_to_p_stress&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.R:Syllable.lisp_distance_to_n_stress&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.R:Syllable.lisp_distance_to_p_accent&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.R:Syllable.lisp_distance_to_n_accent&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_string(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;R:SylStructure.parent.R:Syllable.syl_vowel&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item, &quot;R:SylStructure.parent.R:Syllable.n.stress&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item, &quot;R:SylStructure.parent.R:Syllable.n.accented&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.R:Syllable.n.syl_numphones&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_string(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;R:SylStructure.parent.parent.R:Word.p.gpos&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.parent.R:Word.p.word_numsyls&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_string(item, &quot;R:SylStructure.parent.parent.R:Word.gpos&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;tmp4, ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.parent.R:Word.pos_in_phrase&quot;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ 1, ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;R:SylStructure.parent.parent.R:Word.words_out&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.parent.R:Word.content_words_in&quot;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ 1, ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;R:SylStructure.parent.parent.R:Word.content_words_out&quot;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ 1, ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;R:SylStructure.parent.parent.R:Word.lisp_distance_to_p_content&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.parent.R:Word.lisp_distance_to_n_content&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_string(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;R:SylStructure.parent.parent.R:Word.n.gpos&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.parent.R:Word.n.word_numsyls&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.parent.R:Phrase.parent.p.lisp_num_syls_in_phrase&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.parent.R:Phrase.parent.p.lisp_num_words_in_phrase&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.parent.R:Phrase.parent.lisp_num_syls_in_phrase&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.parent.R:Phrase.parent.lisp_num_words_in_phrase&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sub_phrases + 1, lisp_total_phrases - sub_phrases,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strcmp(endtone, &quot;0&quot;) == 0 ? &quot;NONE&quot; : endtone,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.parent.R:Phrase.parent.n.lisp_num_syls_in_phrase&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.parent.R:Phrase.parent.n.lisp_num_words_in_phrase&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.parent.R:Phrase.parent.lisp_total_syls&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ffeature_int(item,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;R:SylStructure.parent.parent.R:Phrase.parent.lisp_total_words&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lisp_total_phrases);</div><div class="code_line">&nbsp;&nbsp; }</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
<br>
<br>
Парметр &quot;Voxpath&quot; читается в функции<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">STDMETHODIMP</div><div class="code_line">CFliteTTSEngineObj::SetObjectToken(ISpObjectToken* pToken)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;USES_CONVERSION;</div><div class="code_line">&nbsp;&nbsp; &nbsp;CSpDynamicString voxpath;</div><div class="code_line">&nbsp;&nbsp; &nbsp;char *avoxpath;</div><div class="code_line">&nbsp;&nbsp; &nbsp;HRESULT hr;</div><div class="code_line">&nbsp;&nbsp; &nbsp;const cst_val *ttwv;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (!SUCCEEDED(hr = SpGenericSetObjectToken(pToken, vox_token)))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return hr;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (!SUCCEEDED(vox_token-&#62;GetStringValue(L&quot;Voxpath&quot;, &amp;voxpath)))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;avoxpath = NULL; /* It isn&#39;t always necessary */</div><div class="code_line">&nbsp;&nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;avoxpath = W2A(voxpath); &nbsp;//Unicode to Ansi</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (avoxpath==NULL){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;MessageBoxA(0,(char*)&quot;Не указан каталог голоса в реестре (Voxpath). Переустановите программу.&quot;,0,0);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return E_INVALIDARG;</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;//MessageBoxW(0,voxpath,0,0);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; /* initialize */</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (curr_vox){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;(*unregfunc)(curr_vox);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if ((curr_vox = (*regfunc)(avoxpath)) == NULL)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return E_INVALIDARG; /* or something */</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;// otherwise darts out mistake after select of other voice in SAPI5 TTSAPP</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (curr_vox){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;(*unregfunc)(curr_vox);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if ((curr_vox = (*regfunc)(avoxpath)) == NULL)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return E_INVALIDARG; // or something</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; /* initialize */</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (engine.engine.global.sampling_rate&#62;0){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;HTS_Engine_refresh(&amp;engine.engine);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Flite_HTS_Engine_clear(&amp;engine);</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Flite_HTS_Engine_initialize(&amp;engine, use_lpf, sampling_rate, fperiod, alpha,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stage, beta, audio_buff_size, uv_threshold,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; use_log_gain, gv_weight_mgc, gv_weight_lf0,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gv_weight_lpf);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //*/</div><div class="code_line">&nbsp;&nbsp; /* load */</div><div class="code_line">&nbsp;&nbsp; Flite_HTS_Engine_load_voice(&amp;engine, avoxpath);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; // Здесь для проверки работы можно добавить код для синтеза речи по любой англ. текстовой строке</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;//if ((ttwv = feat_val(curr_vox-&#62;features, &quot;tokentowords_func&quot;))) {</div><div class="code_line">&nbsp;&nbsp; &nbsp;// &nbsp;feat_set(curr_vox-&#62;features, &quot;old_tokentowords_func&quot;, ttwv);</div><div class="code_line">&nbsp;&nbsp; &nbsp;// &nbsp;feat_set(curr_vox-&#62;features, &quot;tokentowords_func&quot;,</div><div class="code_line">&nbsp;&nbsp; &nbsp;// &nbsp; &nbsp; &nbsp; itemfunc_val(sapi_tokentowords));</div><div class="code_line">&nbsp;&nbsp; &nbsp;//}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;return hr;</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
Если все сделано правильно, то можно проверить работу драйвера в апплете Речь Панели управления Windows.<br>
Синтез нельзя будет остановить кнопкой Стоп, нельзя поменять темп речи, но можно закрыть окно и подождать пока закончится синтезированная речь.<br>
<br>
Далее постараюсь описать назначение некоторых функций старого драйвера, обработку событий от интерфейсных элементов в новом драйвере.<br>
<span class="b-attach" data-size="2521" data-hits="1079" data-attach-id="49331" data-attach-post-id="3667013">
			<span class="b-attach__title"></span><a class='b-attach-link' href='https://forum.sources.ru/index.php?act=Attach&amp;type=post&amp;id=3667013&amp;attach_id=49331' title='Скачать файл' target='_blank'>register_vox.zip</a> (, : 1079)
		</span>]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3666959</guid>
        <pubDate>Thu, 21 Apr 2016 12:48:15 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3666959</link>
        <description><![CDATA[webcoder88: Шаг 2.<br><br>Преже всего, необходимо переделать проект flite+hts_engine-1.02 в flite+hts_engine-1.02.02, т.е добавить в него новую функцию LoadeVoice(), далее скопировать каталог Sapi из проекта Flite в каталог проекта flite+hts_engine-1.02.02.<br>Тк каталоги проектов имеют разную структуру, то вам потребуется исправить пути к файлам во всех проектах решения. Это можно сделать проще. Все файлы Flite компактно расположены в одноименном каталоге. Например, берете проект cmu_us_kal. Удалите все  Source-файлы проекта, а потом выделите файлcmu_us_kal.c  в каталоге &#092;flite&#092;lang&#092;cmu_us_kal (Кроме него там должен быть файл voxdefs.h), перенесите и отпустите на значек каталога Source Files в Обозревателе решения.  <br>Аналогично исправьте все проекты в Обозревателе решения сверху вниз, исключая все файлы в Обозревателе решения и перенося все Header- и Source-файлы из соответствующих каталогов.<br>Состав каталога flite&#092;lang:<br>cmu_us_kal<br>cmulex<br>usenglish<br>Проект register-vox можно оставить без изменения. <br>Далее в решение следует добавить новый пустой проект hts_engine_API, сняв галочку создать отдельный каталог проекта. В корневом каталоге Sapi должен появиться еще один каталог проекта hts_engine_API. Добавьте в проект заголовочные и исходные файлы через Обозреватель решения, путем переноса из каталога flite+hts_engine-1.02.02s_ok&#092;hts_engine_API&#092;lib<br>Далее необходимо заменить 1 include-файл, тк драйвер использует более старую версию файла &#092;flite&#092;include&#092;cst_tokenstream.h. Переименуйте его в cst_tokenstream_new.h и скопируйте одноименный файл из исходного проекта Flite 2001 года.<br>Для сборки драйвера  Свойства всех проектов должны иметь одинаковую настройку компилятора: Создание кода-библиотека времени выполнения-Многопоточная(MT), тначе не соберется из-за конфликта библиотек (иногда можно собрать, если исключать конфликтные <br>библиотеки в настройках Линкера, но это лишнее).<br>Проекты, относящиеся к flite и hts_engine_API должны собраться без проблем. В проекте <br>FliteTTSEngineObj необходимо исправить код, в определении класса и самом классе.<br>Самый простой путь - закоментировать все строки, вызывающие ошибку.<br><br>В каждом проекте нужно прописать пути к заголовочным файлам, указать библиотеку времени выполнения MT и выходные каталоги для готовых библиотек.<br>Начнем с поекта cmulex, тк он не зависит от других проектов. <br>Идете в свойства проекта cmulex (правый щелчек в Обозревателе), Компилятор(С/С++) - Общие - Дополнительные каталоги включения:             ..&#092;..&#092;flite&#092;include; ..&#092;..&#092;flite&#092;lang&#092;usenglish&#092;;..&#092;..&#092;flite&#092;src&#092;synth<br>Это относительные пути, что намного короче и профессиональнее, чем абсолютные пути.<br>..&#092; говорит компилятору поднятся на один каталог выше, а ..&#092;..&#092; - поднятся на два уровня выше.<br>А как узнать, насколько нужно подниматься? Все просто. Каталог этого проекта расположен в flite+hts_engine-1.02.02&#092;sapi&#092;usenglish. Чтобы добраться до файлов включения, нужно подняться на 1 уровень, в каталог flite+hts_engine-1.02.02&#092;sapi, где находятся каталоги всех проектов. Это только проекты, а их заголовочные и исходные файлы расположены в соответствующих подкаталогах в flite+hts_engine-1.02.02.<br>Таким образом, параметр ..&#092;..&#092;flite&#092;include;  говорит компилятору поднятся от текущего пути на 2 уровня, зайти в каталог flite, далее зайти в его подкаталог include и искать здесь заголовочные файлы.<br>Теперь параметры Библиотекаря. Общие - Выходной файл - .&#092;Release&#092;usenglish.lib<br>.&#092; - текущий каталог.<br>Аналогично изменяются параметры остальных проектов.<br>hts_engine_API:<br>Компилятор.<br>..&#092;..&#092;hts_engine_API&#092;include<br>Линкер.<br>.&#092;Release&#092;&#036;(ProjectName).lib <br><br>flite:<br>..&#092;..&#092;include;..&#092;..&#092;flite&#092;include<br>.&#092;Release&#092;flite.lib<br><br>cmulex:<br>..&#092;..&#092;include;..&#092;..&#092;flite&#092;include<br>.&#092;Release&#092;cmulex.lib.&#092;Release&#092;cmulex.lib<br><br>cmu_us_kal:<br>..&#092;..&#092;flite&#092;include,..&#092;..&#092;flite&#092;lang&#092;cmulex,..&#092;..&#092;flite&#092;lang&#092;usenglish<br>.&#092;Release&#092;cmu_us_kal.lib<br><br>FliteTTSEngineObj:<br>Компилятор.<br>..&#092;..&#092;flite&#092;include;..&#092;..&#092;flite&#092;src&#092;utils;..&#092;..&#092;hts_engine_API&#092;include;E:&#092;WinDDK&#092;7600.16385.1&#092;inc&#092;atl71;..&#092;..&#092;include<br>Линкер.<br>Выходной файл                     .&#092;Release&#092;FliteTTSEngineObj.lib<br>Дополнительные зависимости        cmu_us_kal.lib ..&#092;flite&#092;Release&#092;flite.lib  ..&#092;hts_engine_API&#092;Release&#092;hts_engine_API.lib<br>Дополнительные каталоги библиотек &quot;..&#092;..&#092;lib&quot;;&quot;..&#092;cmu_us_kal&#092;Release&quot;;E:&#092;WinDDK&#092;7600.16385.1&#092;lib&#092;ATL&#092;i386<br><br>FliteCMUKalDiphone:<br>Компилятор.<br>..&#092;..&#092;include;..&#092;..&#092;hts_engine_API&#092;include;E:&#092;WinDDK&#092;7600.16385.1&#092;inc&#092;atl71;..&#092;..&#092;flite&#092;include;..&#092;..&#092;flite&#092;lang&#092;cmu_us_kal;..&#092;flitettsengineobj<br>Линкер.<br>Выходной файл                     .&#092;Release&#092;FliteTTSEngineObj.lib <br>Дополнительные зависимости        cmu_us_kal.lib ..&#092;flite&#092;Release&#092;flite.lib  ..&#092;hts_engine_API&#092;Release&#092;hts_engine_API.lib<br>Дополнительные каталоги библиотек &quot;..&#092;..&#092;lib&quot;;&quot;..&#092;cmu_us_kal&#092;Release&quot;;E:&#092;WinDDK&#092;7600.16385.1&#092;lib&#092;ATL&#092;i386<br><br><br>Путь E:&#092;WinDDK&#092;7600.16385.1&#092;lib&#092;ATL&#092;i386 исправьте на свой.]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3666764</guid>
        <pubDate>Wed, 20 Apr 2016 01:01:49 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3666764</link>
        <description><![CDATA[webcoder88: Драйвер SAPI своими руками. <br>
<br>
Здесь приводится описание готового sapi-драйвера. На Харбар пока не тянет.<br>
<br>
Шаг 1.<br>
<br>
Прежде чем что-то создавать, стоит поискать готовое или почти готовое решение в Интернете. Это позволит съэкономить очень много времени.<br>
В настоящее время в Интернете можно легко найти проекты с открытым исходным кодом: FLite, RHVoice, SALB.<br>
Проект SALB - это sapi-интерфейс для синтезаторов речи, использующих марковские модели голосов и созданных в HTS. Вы можете посмотреть релиз на <a class='tag-url' href='https://github.com/m-toman/SALB/releases' target='_blank'>https://github.com/m-toman/SALB/releases</a> и  странице проекта на github-е по адресу <a class='tag-url' href='https://github.com/m-toman/SALB' target='_blank'>https://github.com/m-toman/SALB</a>.<br>
Данный проект работает с файлом голоса, сохраненным в формате hts_engine_API версии 1.08...1.10 (модель голоса одним файлом), но для совместимости с голосами RHVoice нужно применить версию 1.05..06. <br>
Для сборки проекта потребуются следующие компоненты:<br>
- WinDDK версии 7.1.0 или выше для сборки sapi-драйвера.<br>
- ATL (входит в состав WinDDK);<br>
- Студия VC++ 2012...2015.<br>
Поддериваются аглийские и немецкие голоса (на уровне языковой спецификации, есть документация).<br>
<br>
RHVoice -  русский синтезатор речи с открытым кодом, но разработан в среде LInux.<br>
Для сборки потребуются следующие компоненты:<br>
- база русской речи и спецификация языка,  <a class='tag-url' href='https://developer.berlios.de/projects/festlang;' target='_blank'>https://developer.berlios.de/projects/festlang;</a><br>
- HTS скрипты для тренировки голоса, <a class='tag-url' href='http://hts.sp.nitech.ac.jp;' target='_blank'>http://hts.sp.nitech.ac.jp;</a><br>
- hts_engine API для синтеза речи в реальном времени, <a class='tag-url' href='http://hts-engine.sourceforge.net/;' target='_blank'>http://hts-engine.sourceforge.net/;</a><br>
- анализатор текста  Flite, <a class='tag-url' href='http://www.speech.cs.cmu.edu/flite;' target='_blank'>http://www.speech.cs.cmu.edu/flite;</a><br>
- пакет русской лексики от Игоря  Порецкого, <a class='tag-url' href='http://poretsky.homelinux.net/packages/' target='_blank'>http://poretsky.homelinux.net/packages/</a><br>
- библиотека libunistring для работы с уникодом, <a class='tag-url' href='http://www.gnu.org/software/libunistring/;' target='_blank'>http://www.gnu.org/software/libunistring/;</a><br>
- библиотека sonic для преобразования форматов звуковых файлов и синтеза быстрой речи, git://vinuxproject.org/sonic<br>
- парсер expat XML для поддержки SSML, <a class='tag-url' href='http://expat.sourceforge.net' target='_blank'>http://expat.sourceforge.net</a><br>
- библиотека PCRE (версии 8.10 или выше), <a class='tag-url' href='http://pcre.org;' target='_blank'>http://pcre.org;</a><br>
- libsox для некоторых задач постобработки, <a class='tag-url' href='http://sox.sourceforge.net;' target='_blank'>http://sox.sourceforge.net;</a><br>
<br>
- WinDDK версии 7.1.0 или выше для сборки sapi-драйвера. <br>
- Студия VC++ 2008...2015<br>
- sygwin для эмуляции командного процессора Linux;<br>
- совместимые версии phiton и scons для запуска скриптов сборки проекта и установки голоса.<br>
Скорее всего, это не предел по кол-ву библиотек и компонентов и могло быть еще больше, просто у разработчицы не хватило фантазии.  <br>
<br>
FLIte - это проект 2001 года с открытым исходным кодом и проектом sapi-драйвера на ATL. Максимальная совместимость и минимум классов.<br>
К недостаткам относятся: механический голос и поддержка спецификации английского языка на уровне кода. <br>
Для сборки проекта потребуются следующие компоненты:<br>
- WinDDK версии 7.1.0 или выше для сборки sapi-драйвера.<br>
- ATL (входит в состав WinDDK);<br>
- Студия VC++ 6.0...2015.<br>
<br>
Я остановил свой выбор на проекте sapi Flite.<br>
Для начала стоит Загрузить архив flite-1.2-release.tar.bz2 со страницы проекта  и разархивировать в любой каталог. Далее необходи открыть проект flite+hts_engine-1.02/sapi в студии VC++ <br>
2008...2015. Новая студия предложит преобразование проекта, тк он создан в VC++ 6.0. После преобразования проект можно собрать и проверить работу полученного дифонного движка. Регистрацию драйвера выполяет сама студия. См. события после построения.<br>
<br>
Следующий шаг - интеграция hts_engine_API версии 1.06 и удаление ненужных файлов.]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3663338</guid>
        <pubDate>Sun, 03 Apr 2016 11:41:39 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3663338</link>
        <description><![CDATA[webcoder88: <strong class='tag-b'>amk</strong><br>
Я взял файлы из проекта SALB. :)<br>
Есть желающие добавить русский язык в парсер Flite. Код можно взять в RHVoice, но есть некоторые нюансы:<br>
-разработчица, Linux-разработчица, в Линуксе ничего нет видимо, но с др. стороны разработчики не могут разобраться;    <br>
-разработчица переписала часть функций, чем упростила алгоритм обработки;<br>
-модель длительности берется из фестивалевской модели языка (каталог languages), без к-го не работают даже английские голоса; <br>
-используется &quot;рыжий&quot; фикс длительности;<br>
-можно сделать воспроизведение анси-текста на кодовой странице 1251, без уникода;<br>
-в RHVoice отсутствует обработка интонации, поэтому русские голоса похожи на монотонное бормотание.<br>
В RHVoice проделана большая работа, но результат еще не достигнут.<br>
Можно обойтись без файлов Фестиваля, доделать модель русского языка на с++, интонацию. Русские голоса должны воспроизводиться так же как и английские с качеством, близким к оригиналу (хотя бы для тренировочных предложений). <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2016-04-03T11:59:48+00:00">03.04.16, 11:59</time></span></span><br>
Я создавал метки RHVoice для русского голоса и воспроизводил их в hts_engine, который одинаково хорошо воспроизводи метки любого языка.  Почти все гласные восп-ся с увеличенной длительностью. Замена исходного файла длительности на мой ничего не изменила. Из чего следует, что парсер RHVoice выдает некорректные метки.<br>
Вся необходимая информация для генерации голоса содержиться в файле меток. Это длительность, ударение, интонация. Можно попытаться подбрать вручную. :)<br>
Остальное зависит от качества тренированной HMM-модели. <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2016-04-03T12:28:31+00:00">03.04.16, 12:28</time></span></span><br>
Sapi-драйвер для английских голосов, без исх. кода. Может отсутствовать синхронизация выделенного и произносимого текста (в панели управления-&gt;речь), пока подделка. Тестировался только на x86, проверен на антивирусе, но лучше запускать на виртуалке.<br>
<a class='tag-url' href='https://www.sendspace.com/file/hp1gbh' target='_blank'>https://www.sendspace.com/file/hp1gbh</a>]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3662664</guid>
        <pubDate>Thu, 31 Mar 2016 14:40:43 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3662664</link>
        <description><![CDATA[amk: <strong class='tag-b'>webcoder88</strong>, ты ты не забыл, что без ключа <strong class='tag-b'>/D</strong> команда <strong class='tag-b'>cd</strong> диск не меняет?<br>
<br>
Вторую строчку в обоих файлах надо писать<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">cd /D %~dp0</div></ol></div></div></div></div>]]></description>
        <author>amk</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3662612</guid>
        <pubDate>Thu, 31 Mar 2016 12:22:57 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3662612</link>
        <description><![CDATA[webcoder88: Обновление для flite+hts_engine-1.02 до flite+hts_engine-1.02.02. Исходный код проекта flite+hts_engine можно взять на гитхабе. <br>
Командная строка для запуска:<br>
flite_hts_engine -v alan -p 240 -s 48000 -a 0.52  input.txt<br>
<span class="b-attach" data-size="60000" data-hits="1087" data-attach-id="49163" data-attach-post-id="3662612">
			<span class="b-attach__title"></span><a class='b-attach-link' href='https://forum.sources.ru/index.php?act=Attach&amp;type=post&amp;id=3662612&amp;attach_id=49163' title='Скачать файл' target='_blank'>flite_hts_engine_1.02.02_upd.part01.rar</a> (, : 1087)
		</span><br>
<span class="b-attach" data-size="54055" data-hits="1100" data-attach-id="49164" data-attach-post-id="3662612">
			<span class="b-attach__title"></span><a class='b-attach-link' href='https://forum.sources.ru/index.php?act=Attach&amp;type=post&amp;id=3662612&amp;attach_id=49164' title='Скачать файл' target='_blank'>flite_hts_engine_1.02.02_upd.part02.rar</a> (, : 1100)
		</span>]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3662106</guid>
        <pubDate>Tue, 29 Mar 2016 05:32:42 +0000</pubDate>
        <title>Sapi для HTS Voice</title>
        <link>https://forum.sources.ru/index.php?showtopic=408468&amp;view=findpost&amp;p=3662106</link>
        <description><![CDATA[webcoder88: В настоящее время в Интернете доступен проект SALB. Описание с его главной стр.<br>
Проект SALB - это sapi-интерфейс для синтезаторов речи, использующих марковские модели голосов, созданных в HTS. Вы можете посмотреть Релиз на <a class='tag-url' href='https://github.com/m-toman/SALB/releases' target='_blank'>https://github.com/m-toman/SALB/releases</a> и  страницу проекта на github-е по адресу <a class='tag-url' href='https://github.com/m-toman/SALB' target='_blank'>https://github.com/m-toman/SALB</a>. И тд.<br>
<br>
Проект использует новые возможности компиляторра 11-й версии (auto и тд), поэтому собирается только в VC++ 2012 и выше.<br>
Я собрал в 2008Express свой проект Flite+hts  на основе Flite 2001 года. sapi-драйвер одновременно воспроизводит английские голоса  от RHVoice c разной частотой дескритизации (16 и 48кГц). &quot;Допипиливается&quot;.<br>
<br>
Предлагаю исправленный вариант register_vox.cpp для обоих проектов (имя в Flite) и командные файлы для регистрации dll, а также для установки и <br>
удаления голосов.<br>
<br>
_register-alan.bat<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">rem запрос прав администратора, см. во вложении.</div><div class="code_line">&nbsp;</div><div class="code_line">cd %~dp0</div><div class="code_line">echo %CD%</div><div class="code_line">&nbsp;</div><div class="code_line">@echo on</div><div class="code_line">regsvr32 &quot;%CD%\FliteCMUKalDiphone.dll&quot;</div><div class="code_line">&quot;%CD%\register-vox.exe&quot; &quot;%CD%\data\voices\Alan&quot; &quot;HTS Voice Alan&quot; &quot;en-us&quot; &quot;Female&quot; &quot;Adult&quot; &quot;%CD%\alan.log&quot;</div><div class="code_line">&nbsp;</div><div class="code_line">@echo off</div><div class="code_line">pause</div></ol></div></div></div></div><br>
<br>
_unregister_Alan.bat<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">rem запрос прав администратора, см. во вложении.</div><div class="code_line">cd %~dp0</div><div class="code_line">echo %CD%</div><div class="code_line">&nbsp;</div><div class="code_line">@echo on</div><div class="code_line">&nbsp;</div><div class="code_line">regsvr32 &quot;/u&quot; &quot;%CD%\FliteCMUKalDiphone.dll&quot;</div><div class="code_line">&quot;%CD%\register-vox.exe&quot; &quot;/u&quot; &quot;HTS Voice Alan&quot; </div><div class="code_line">&nbsp;</div><div class="code_line">@echo off</div><div class="code_line">pause</div></ol></div></div></div></div><br>
<span class="b-attach" data-size="13138" data-hits="1015" data-attach-id="49141" data-attach-post-id="3662106">
			<span class="b-attach__title"></span><a class='b-attach-link' href='https://forum.sources.ru/index.php?act=Attach&amp;type=post&amp;id=3662106&amp;attach_id=49141' title='Скачать файл' target='_blank'>register_vox.rar</a> (, : 1015)
		</span>]]></description>
        <author>webcoder88</author>
        <category>Речевые Технологии</category>
      </item>
	
      </channel>
      </rss>
	