<?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=387305&amp;view=findpost&amp;p=3434361</guid>
        <pubDate>Fri, 21 Mar 2014 20:10:19 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3434361</link>
        <description><![CDATA[nsh: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Анализируем его, получаем набор MFCC векторов по всему файлу, сравниваем с эталоном, если неудачно, делим на несколько частей, опять сравниваем с эталоном, если и опять нет, то делим еще и сравниваем уже с эталонами букв. Какие минусы такой системы?)</div></div><br>
<br>
Да вроде нет минусов. Работать должно неплохо.]]></description>
        <author>nsh</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3431873</guid>
        <pubDate>Sun, 16 Mar 2014 18:24:21 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3431873</link>
        <description><![CDATA[MrKor: Кстати, nsh, что думаете о системе многократного сравнивания, скажем так.<br><br>Допустим, имеется звуковой файл &quot;Привет.wav&quot; <br><br>Анализируем его, получаем набор MFCC векторов по всему файлу, сравниваем с эталоном, если неудачно, делим на несколько частей, опять сравниваем с эталоном, если и опять нет, то делим еще и сравниваем уже с эталонами букв.<br><br>Какие минусы такой системы?)<br><br>Наверняка будет долго работать, но все же)]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3430897</guid>
        <pubDate>Fri, 14 Mar 2014 15:18:52 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3430897</link>
        <description><![CDATA[MrKor: Просто хотелось узнать, а сейчас там все в порядке?)<br><br>Остальной код, напишу, уже придумал кое чего.]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3430527</guid>
        <pubDate>Fri, 14 Mar 2014 07:37:28 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3430527</link>
        <description><![CDATA[nsh: Дальше надо остальной код писать. В чем проблема-то?]]></description>
        <author>nsh</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3429950</guid>
        <pubDate>Thu, 13 Mar 2014 09:34:45 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3429950</link>
        <description><![CDATA[MrKor: Что же дальше?)<br>
<br>
Проект -&gt; <span class="b-attach" data-size="24517" data-hits="166" data-attach-id="36142" data-attach-post-id="3429950">
			<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=3429950&amp;attach_id=36142' title='Скачать файл' target='_blank'>SoundeD.rar</a> (, : 166)
		</span>]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3429705</guid>
        <pubDate>Wed, 12 Mar 2014 16:32:45 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3429705</link>
        <description><![CDATA[MrKor: Вот такие результаты получаю:<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;| -3.4991926718054214 | 1.9694437093558208 | -9.273642067864989 | 8.992553509896249 | -5.435318907995241 | 1.5855762086177776 | 0.9842192881737314 | -3.502275544221704 | 1.818413705659863 | -1.4623546239919465 | -1.191487821368453 | 2.6995279299149963 | -2.975681484559656</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><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;| 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0</div></ol></div></div></div></div><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;| -0.6564014681664422 | 0.7802389891166934 | -0.5337068124193423 | -0.06493042991671547 | 0.8677194640315364 | -1.6509748044712116 | 2.19500447203845 | -2.3579418212099754 | 2.1163660589417583 | -1.5606290284132405 | 0.8517246308393844 | -0.16080061139311216 | -0.38363003286907366</div></ol></div></div></div></div><br>
<br>
<br>
Это из одного файла.Что то сбой чую я во втором массиве...<br>
<br>
Чуть позже выложу код, если необходимо. <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2014-03-12T17:24:43+00:00">12.03.14, 17:24</time></span></span><br>
Построил график в каком то гугло сервисе, вот что получилось, примерно:<br>
<br>
<a class='tag-url' href='http://imgur.com/Q3uCo6T' target='_blank'>http://imgur.com/Q3uCo6T</a><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;| -3.4991926718054214 | 1.9694437093558208 | -9.273642067864989 | 8.992553509896249 | -5.435318907995241 | 1.5855762086177776 | 0.9842192881737314 | -3.502275544221704|1.818413705659863|-1.462354623991946|-1.19148782136845| 2.6995279299149963 | -2.975681484559656</div></ol></div></div></div></div><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;| 1.5043523440403215 | 2.344562533745208 | 3.0548060948902296 | 3.5893221734407432 | 3.9176900825769265 | 4.027299370480302 | 3.9240151371497727 | 3.6309938207747043 | 3.1858045418955365 | 2.636192420068367 | 2.034962909112171 | 1.4345544043083465 | </div><div class="code_line">&nbsp;</div><div class="code_line">0.8818906236179873</div></ol></div></div></div></div><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;| 2.0998034007168607 | 1.492814403340775 | 3.3858159393738045 | 2.8549893292179402 | 1.9577773064511086 | 0.06261290082420551 | -1.2570835235662836 | -1.1431390040840532 | 0.42541655948905943 | 0.45563912379060556 | 1.2673896378430856 | 0.38270850481087354 | -</div><div class="code_line">&nbsp;</div><div class="code_line">0.7609497682647048</div></ol></div></div></div></div>]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3429532</guid>
        <pubDate>Wed, 12 Mar 2014 11:59:26 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3429532</link>
        <description><![CDATA[MrKor: Так тут без задавания - никак, мы же массив создаем:<br>
 double[] inbuf = new double[size];<br>
<br>
Где size , собс-но, его длинна... <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2014-03-12T12:28:38+00:00">12.03.14, 12:28</time></span></span><br>
Хотя, мы же можем поставить длинну такую же, какую имеет начальный массив байт, мы же все потом все равно поделим&#33; <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2014-03-12T12:29:46+00:00">12.03.14, 12:29</time></span></span><br>
Уже проверил, кстати, с длинной, как у начального массива, все отлично работает&#33; И деление происходит.]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3429412</guid>
        <pubDate>Wed, 12 Mar 2014 09:58:50 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3429412</link>
        <description><![CDATA[nsh: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '> могли видеть, что длина inbuf = 512...<br>
После деления на окна у меня создается 1 массив.Так что не знаю...</div></div><br>
<br>
Когда декодируете длина полученного результата должна определяться из длины прочитанных данных, а не жёстко задаваться.]]></description>
        <author>nsh</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3429102</guid>
        <pubDate>Tue, 11 Mar 2014 17:54:31 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3429102</link>
        <description><![CDATA[MrKor: Спасибо&#33;<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">int frame_size = 410;</div><div class="code_line">&nbsp;&nbsp; &nbsp;int frame_shift = 320;</div></ol></div></div></div></div><br>
<br>
Только вот проблемка, если вы смотрели код, то могли видеть, что длина  inbuf = 512...<br>
<br>
После деления на окна у меня создается 1 массив.Так что не знаю...По сути это же тоже самое, что и без этого деления на окна,может ч=стоит где то что то поменять? например, числа..Просто если массив inbuf делать больше, чем 512, то вылезает куча ошибок в MFCC..]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3429047</guid>
        <pubDate>Tue, 11 Mar 2014 16:46:03 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3429047</link>
        <description><![CDATA[nsh: Чтобы не возникало выхода за границы в цикле должно быть такое ограничение:<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;for (int i = 0; i + frame_size &#60; inbuf.length; i = i + frame_shift)</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;&nbsp; &nbsp; &nbsp;for (int i = 0; i &#60; inbuf.length; i = i + frame_shift)</div></ol></div></div></div></div>]]></description>
        <author>nsh</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3427384</guid>
        <pubDate>Sat, 08 Mar 2014 20:10:21 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3427384</link>
        <description><![CDATA[MrKor: А вот если 256 подставить, как значение двум переменных, то все работает&#33;)]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3427233</guid>
        <pubDate>Sat, 08 Mar 2014 12:34:06 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3427233</link>
        <description><![CDATA[MrKor: Попробовал еще раз все сделать, прикрепил в архивчике кодец. <span class="b-attach" data-size="24227" data-hits="164" data-attach-id="36052" data-attach-post-id="3427233">
			<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=3427233&amp;attach_id=36052' title='Скачать файл' target='_blank'>SoundeD.rar</a> (, : 164)
		</span><br>
<br>
Опять ошибка, теперь ошибка java.lang.ArrayIndexOutOfBoundsException, то бишь не существующий элемент массива...<br>
<br>
УЖ не знаю что там и как, разделял frame_size frame_shift  на два, все равно не помогло...<br>
<br>
Преобразование сделал.Метод add не подчеркивает, а метод append подчеркивает. Кстати, если что у меня Java 6, может быть какие-то проблемы могут и из-за этого возникнуть...<br>
<br>
Попробую исправить <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2014-03-08T12:41:19+00:00">08.03.14, 12:41</time></span></span><br>
Кстати, когда я преобразование сделал, то размер основного массива в 8 раз уменьшился.. Может стоит изменить размеры переменных? ( frame_size  frame_shift ) Разделение этих переменных ( 410 и 320) на 8 не помагает..]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3426861</guid>
        <pubDate>Fri, 07 Mar 2014 16:03:06 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3426861</link>
        <description><![CDATA[MrKor: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=387305&view=findpost&p=3426783'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>nsh &#064; <time class="tag-quote__quoted-time" datetime="2014-03-07T13:09:30+00:00">07.03.14, 13:09</time></span><div class='quote '>Сначала нужно преобразовать сигнал в вид float, это Вы уже делали. Потом разбивать на окна. Вы этап преобразования пропустили.</div></div><br>
Аааааа, а я думал сначала разделить, а потом уже делать.Спасибки&#33;<br>
<br>
Попробую сейчас&#33;]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3426783</guid>
        <pubDate>Fri, 07 Mar 2014 13:09:30 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3426783</link>
        <description><![CDATA[nsh: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Прикреплённый файл: SoundeD.rar (23,88 Кбайт, скачиваний: 2)</div></div><br>
<br>
Уже лучше<br>
<br>
Если Вы прочитаете документацию по ArrayStoreException, Вам станет понятно, что причиной ошибки является попытка поместить элемент в массив несовместимого типа. В Вашем случае Вы пытаетесь скопировать из массива типа byte в массив типа float. ТАк нельзя делать.<br>
<br>
Сначала нужно преобразовать сигнал в вид float, это Вы уже делали. Потом разбивать на окна. Вы этап преобразования пропустили.<br>
<br>
Если Eclipse подчеркивает метод add, это означает, что такой метод отсутствует. Нужно поискать похожий метод, для класса ArrayList это append.]]></description>
        <author>nsh</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3426299</guid>
        <pubDate>Thu, 06 Mar 2014 17:50:42 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3426299</link>
        <description><![CDATA[MrKor: ПамПамПам&#33;)<br>
<br>
Вот и программка, поддерживает звукозаписи до 2.25 секунд(можно увеличить), что мне как раз подходит, ибо больше мне пока не надо)<br>
<br>
Файлик прикрепил, завтра попробую соединить все вместе  и провести маленькие тесты)<br>
<br>
Думаю, nsh, вы покруче меня шарите в программной части, поделитесь, пожалуйста&#33; Какие недостатки есть сейчас.<br>
<br>
<span class="b-attach" data-size="4118" data-hits="241" data-attach-id="36024" data-attach-post-id="3426299">
			<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=3426299&amp;attach_id=36024' title='Скачать файл' target='_blank'>example.java</a> (, : 241)
		</span> <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2014-03-06T17:51:51+00:00">06.03.14, 17:51</time></span></span><br>
Её можно улучшить в сотни раз..Чем я и займусь, надо все это сделать автоматом..Чтобы только время можно было вводить, а она тебе массивы отдавала бы))]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3425723</guid>
        <pubDate>Wed, 05 Mar 2014 17:48:12 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3425723</link>
        <description><![CDATA[MrKor: Почти написал программку делящую файл на равные кусочки) Завтра выложу&#33;]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3425001</guid>
        <pubDate>Tue, 04 Mar 2014 16:01:22 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3425001</link>
        <description><![CDATA[MrKor: Вот и архивчик:<br>
<span class="b-attach" data-size="24451" data-hits="185" data-attach-id="35943" data-attach-post-id="0">
			<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=0&amp;attach_id=35943' title='Скачать файл' target='_blank'>SoundeD.rar</a> (, : 185)
		</span><br>
<br>
Надеюсь так будет лучше, example файл там для тестов... <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2014-03-04T16:14:24+00:00">04.03.14, 16:14</time></span></span><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">import java.io.BufferedInputStream;</div><div class="code_line">import java.io.ByteArrayOutputStream;</div><div class="code_line">import java.io.File;</div><div class="code_line">import java.io.FileInputStream;</div><div class="code_line">import java.io.FileNotFoundException;</div><div class="code_line">import java.io.IOException;</div><div class="code_line">import java.io.PrintStream;</div><div class="code_line">import java.util.ArrayList;</div><div class="code_line">&nbsp;</div><div class="code_line">import javax.sound.sampled.AudioFileFormat;</div><div class="code_line">import javax.sound.sampled.AudioFormat;</div><div class="code_line">import javax.sound.sampled.AudioInputStream;</div><div class="code_line">import javax.sound.sampled.AudioSystem;</div><div class="code_line">import javax.sound.sampled.DataLine;</div><div class="code_line">import javax.sound.sampled.LineUnavailableException;</div><div class="code_line">import javax.sound.sampled.TargetDataLine;</div><div class="code_line">import javax.sound.sampled.UnsupportedAudioFileException;</div><div class="code_line">&nbsp;</div><div class="code_line">public class example {</div><div class="code_line">&nbsp;&nbsp; &nbsp;private static AudioFileFormat.Type fileType = AudioFileFormat.Type.WAVE;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private static AudioInputStream audioInputStream;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private static AudioFormat format;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;final static int W = 1024;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private static int BITS_IN_BYTE = 8;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;public static void main(String[] args) {</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;String PatnToFile = &quot;C:\test\mix20&quot; + &quot;.&quot; + fileType;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;File AudioFile = new File(PatnToFile);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ByteArrayOutputStream out = new ByteArrayOutputStream();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;BufferedInputStream in;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;try {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;audioInputStream = AudioSystem.getAudioInputStream(AudioFile);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (UnsupportedAudioFileException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (IOException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;format = audioInputStream.getFormat();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (!AudioSystem.isLineSupported(info)) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;Error&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;TargetDataLine line = null;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;try {</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;line = (TargetDataLine) AudioSystem.getLine(info);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;line.open(format);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (LineUnavailableException ex) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;Error&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;line.start();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;byte[] data = new byte[W * format.getSampleSizeInBits() / BITS_IN_BYTE</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* 2];</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;try {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;in = new BufferedInputStream(new FileInputStream(AudioFile));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int read;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;while ((read = in.read(data)) &#62; 0) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;out.write(data, 0, read);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;out.flush();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (FileNotFoundException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (IOException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;data = out.toByteArray();</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double[] inbuf = new double[W/2];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;decode(data, inbuf);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int frame_shift = 320;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int frame_size = 410;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; ArrayList&#60;float[]&#62; frames = new ArrayList&#60;float[]&#62;();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int i = 0; i &#60; inbuf.length; i = i + frame_shift) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;float[] frame = new float[frame_size];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.arraycopy(inbuf, i, frame, 0, frame_size);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//frames.append(frame); &nbsp; </div><div class="code_line">&nbsp;&nbsp; &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;&nbsp; &nbsp;public static void decode(byte[] input, double[] output) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;assert input.length == 2 * output.length;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int i = 0; i &#60; output.length; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;output[i] = (short) (((0xFF &amp; input[2 * i + 1]) &#60;&#60; 8) | (0xFF &amp; input[2 * i]));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;output[i] /= Short.MAX_VALUE;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
Все равно вылезает эта чортова ошибка... <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2014-03-04T16:15:24+00:00">04.03.14, 16:15</time></span></span><br>
Я думал там был стык байтов с дублями, а оказалось в другом проблемка...]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3424676</guid>
        <pubDate>Tue, 04 Mar 2014 10:17:28 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3424676</link>
        <description><![CDATA[nsh: Уважаемый MrKor. Чтобы получить совет, нужно поработать самому немного. Руками и мозгом. Не ожидайте, что кто-то будет разгребать кашу в Вашей голове.<br>
<br>
Как я уже писал, не нужно выкладывать программу по частям. Части не собираются в полную картину. Доступа на Ваш компьютер у меня нет, в ФСБ  я не работаю, мои штатные телепаты в отпуске. Пока вы не выложите программу целиком <strong class='tag-b'>в полном удобном виде</strong>, тяжело Вам подсказать, что у Вас на компьютере происходит.<br>
<br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Выдает ошибку такую кстати:<br>
Exception in thread &quot;main&quot; java.lang.ArrayStoreException</div></div><br>
<br>
Если выдаётся ошибка, стоит задуматься о её причинах, попытаться понять, почему ошибка возникает, попробовать исправить ситуацию самому. Обычно такие ошибки легко решаются, если чуть-чуть пошевелить мозгами. Решение таких ошибок - основная часть работы программиста, ей нужно учиться.]]></description>
        <author>nsh</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3424064</guid>
        <pubDate>Mon, 03 Mar 2014 15:05:31 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3424064</link>
        <description><![CDATA[MrKor: Провел небольшой тест, все снова плохо...<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;-1 &nbsp; 4 &nbsp; -10 &nbsp; 6 &nbsp; -1 &nbsp; -1 &nbsp; 3 &nbsp; -1 &nbsp; -1 &nbsp; 2 &nbsp; -3 &nbsp; 0 &nbsp; 2</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">&nbsp;&nbsp;-3 &nbsp; 1 &nbsp; -9 &nbsp; 8 &nbsp; -5 &nbsp; 1 &nbsp; 0 &nbsp; -3 &nbsp; 1 &nbsp; -1 &nbsp; -1 &nbsp; 2 &nbsp; -2</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">-3.4991932068498093 1.9694426457336287 -9.273643571223644 8.99255184947278 -5.435321526906497 1.5855738872936378 0.984217953196569 -3.502277131398279 1.8184110813882457 -1.4623570085484268 -1.1914909785382624 2.6995256102639735 -2.9756843183744692</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">final static int W = 320; // Размер окна, как я понял! [ИЗМЕНЕНИЕ]</div><div class="code_line">&nbsp;&nbsp; &nbsp;private static int BITS_IN_BYTE = 8;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;public static void main(String[] args) {</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int nnumberofFilters = 24;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int nlifteringCoefficient = 22;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;boolean oisLifteringEnabled = true;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;boolean oisZeroThCepstralCoefficientCalculated = false;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int nnumberOfMFCCParameters = 13;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double dsamplingFrequency = 16000.0; // Сделал 16000 [ИЗМЕНЕНИЕ]</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int nFFTLength = 512;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (oisZeroThCepstralCoefficientCalculated) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// take in account the zero-th MFCC</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nnumberOfMFCCParameters = nnumberOfMFCCParameters + 1;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} else {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nnumberOfMFCCParameters = nnumberOfMFCCParameters;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;mfcc mfcc = new mfcc(nnumberOfMFCCParameters, dsamplingFrequency,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nnumberofFilters, nFFTLength, oisLifteringEnabled,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlifteringCoefficient, oisZeroThCepstralCoefficientCalculated);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;System.out.println(mfcc.toString());</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;String PatnToFile = &quot;C:\test\hello1.&quot; + fileType;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;File AudioFile = new File(PatnToFile);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ByteArrayOutputStream out = new ByteArrayOutputStream();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;BufferedInputStream in;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;try {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;audioInputStream = AudioSystem.getAudioInputStream(AudioFile);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (UnsupportedAudioFileException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (IOException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;format = audioInputStream.getFormat();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;byte[] data = new byte[W * format.getSampleSizeInBits() / BITS_IN_BYTE*2];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double[] inbuf = new double[W/2];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;try {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;in = new BufferedInputStream(new FileInputStream(AudioFile));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int read;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;while ((read = in.read(data)) &#62; 0) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;out.write(data, 0, read);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;out.flush();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (FileNotFoundException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (IOException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;data = out.toByteArray();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;decode(data, inbuf);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;inbuf[2] = 10;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;inbuf[4] = 14;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double[] dparameters = mfcc.getParameters(inbuf);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;MFCC parameters:&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int i = 0; i &#60; dparameters.length; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.print(&quot; &quot; + dparameters[i]);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int[] mfccresult = new int[dparameters.length];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for(int i = 0; i &#60; dparameters.length; i++){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mfccresult[i] = (int) dparameters[i];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for(int i = 0; i &#60; mfccresult.length;i++){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.print(mfccresult[i]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div></ol></div></div></div></div><br>
<br>
Также убрал ДатаЛайн, пока все)) <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2014-03-03T15:12:47+00:00">03.03.14, 15:12</time></span></span><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;frames.append(frame);</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">frames.add(frame);</div></ol></div></div></div></div> <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2014-03-03T15:14:30+00:00">03.03.14, 15:14</time></span></span><br>
Выдает ошибку такую кстати:<br>
<br>
Exception in thread &quot;main&quot; java.lang.ArrayStoreException<br>
<br>
Ну и с аппендом:<br>
The method append(float[]) is undefined for the type ArrayList&lt;float[]&gt;]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3423202</guid>
        <pubDate>Sun, 02 Mar 2014 14:29:25 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3423202</link>
        <description><![CDATA[MrKor: Спасибо&#33; Да уж попробую на этой пока сделать...<br><br>Почему то подчеркивает вот эту строчку: frames.append(frame); А именно append. Кстати начал получать совсем другие результаты, после ваших советов, попробую сегодня еще записать пару словечек и выложу результаты)]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3422969</guid>
        <pubDate>Sun, 02 Mar 2014 08:07:34 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3422969</link>
        <description><![CDATA[nsh: &gt; там величины их свои брать или из формата добывать<br>
<br>
frame size 410 отсчетов<br>
<br>
frame shift 320 отсчетов<br>
<br>
fft size 512<br>
<br>
sample rate 16000 <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2014-03-02T08:54:48+00:00">02.03.14, 08:54</time></span></span><br>
А вообще лучше более разумную библиотеку взять, например CMUSphinx <a class='tag-url' href='http://cmusphinx.sourceforge.net/wiki/sphinx4' target='_blank'>http://cmusphinx.sourceforge.net/wiki/sphinx4</a>. Код для извлечения MFCC в sphinx4/edu/cmu/sphinx/tools/feature/FeatureFileDumper.java. <br>
<br>
В этом спантусе классов много, а толку от них мало. Видимо, автор перечитал книгу о шаблонах проектирования и наделал кучу сервисов, фасадов и прочего.]]></description>
        <author>nsh</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3422396</guid>
        <pubDate>Sat, 01 Mar 2014 13:08:18 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3422396</link>
        <description><![CDATA[MrKor: Просто у вас там величины их свои брать или из формата добывать?:<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">System.out.println(&quot;=====Info=====&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;System.out.println(format.getFrameSize());</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double sampleSize = format.getSampleSizeInBits()/8;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double FramesCount = data.length / (sampleSize*format.getChannels());</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;System.out.println(FramesCount);</div></ol></div></div></div></div>]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3422371</guid>
        <pubDate>Sat, 01 Mar 2014 12:03:23 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3422371</link>
        <description><![CDATA[MrKor: Уху, спасибки нш&#33; А можно , пожалуйста, уточнить что где в коде, получается перевод в double не нужен уже что ли? А на сколько окон будет нарезка?)<br><br>Как бы не было стыка величин байты с флотами и т д...]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3422128</guid>
        <pubDate>Fri, 28 Feb 2014 21:50:53 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3422128</link>
        <description><![CDATA[nsh: Хорошо, как что-нибудь получите, выкладывайте обновлённый код и результаты.<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; ArrayList&#60;float[]&#62; frames = new ArrayList&#60;float[]&#62;();</div><div class="code_line">&nbsp;&nbsp; for (int i = 0; i &#60; data.length; i = i + frame_shift) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; float[] frame = new float[frame_size];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; System.arraycopy(data, i, frame, 0, frame_size);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; frames.append(frame);</div><div class="code_line">&nbsp;&nbsp; }</div></ol></div></div></div></div>]]></description>
        <author>nsh</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3421184</guid>
        <pubDate>Thu, 27 Feb 2014 17:50:06 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3421184</link>
        <description><![CDATA[MrKor: Или вы имели в виду вывод самого результата в double сделать?)]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3421087</guid>
        <pubDate>Thu, 27 Feb 2014 15:27:31 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3421087</link>
        <description><![CDATA[MrKor: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=387305&view=findpost&p=3420949'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>nsh &#064; <time class="tag-quote__quoted-time" datetime="2014-02-27T13:34:17+00:00">27.02.14, 13:34</time></span><div class='quote '>Размер окна 1024, а должен быть 320<br>
<br>
double dsamplingFrequency в программе 8000.0, а файлы у Вас в 16khz<br>
<br>
На окна звук нужно в программе резать, а не в audacity<br>
<br>
dataline не нужен, его можно убрать<br>
<br>
Программу лучше выкладывать в архиве, чтобы её запустить можно было, а не вставлять в два разных места сразу<br>
<br>
Mel коэффициенты не надо к int приводить, они должны быть с плавающей точностью<br>
<br>
Свой код лучше писать не внутри чужого, а в отдельных файлах. Тогда понятнее будет, где искать ошибку.<br>
<br>
Попробуйте хотя бы какие-то замечания исправить сначала</div></div><br>
<br>
<br>
Исправил размер окна, а почему 320?)<br>
<br>
Пока программно звук резать не умею, вообще как?)<br>
<br>
Может разделить прочитанные байты из него? на равные участки..<br>
<br>
Про мелы пока не вижу что-то..<br>
<br>
Спасибо вам, что помогаете&#33;]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3420949</guid>
        <pubDate>Thu, 27 Feb 2014 13:34:17 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3420949</link>
        <description><![CDATA[nsh: Размер окна 1024, а должен быть 320<br><br>double dsamplingFrequency в программе 8000.0, а файлы у Вас в 16khz<br><br>На окна звук нужно в программе резать, а не в audacity<br><br>dataline не нужен, его можно убрать<br><br>Программу лучше выкладывать в архиве, чтобы её запустить можно было, а не вставлять в два разных места сразу<br><br>Mel коэффициенты не надо к int приводить, они должны быть с плавающей точностью<br><br>Свой код лучше писать не внутри чужого, а в отдельных файлах. Тогда понятнее будет, где искать ошибку.<br><br>Попробуйте хотя бы какие-то замечания исправить сначала]]></description>
        <author>nsh</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3420855</guid>
        <pubDate>Thu, 27 Feb 2014 12:10:44 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3420855</link>
        <description><![CDATA[MrKor: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=387305&view=findpost&p=3420567'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>nsh &#064; <time class="tag-quote__quoted-time" datetime="2014-02-27T08:29:12+00:00">27.02.14, 08:29</time></span><div class='quote '>Зачем странные присваивания вроде inbuf[4] = 14?</div></div><br>
Вот это уже было...<br>
<br>
Вот весь код:<br>
<br>
Часть 1:<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">import java.io.BufferedInputStream;</div><div class="code_line">import java.io.ByteArrayOutputStream;</div><div class="code_line">import java.io.File;</div><div class="code_line">import java.io.FileInputStream;</div><div class="code_line">import java.io.FileNotFoundException;</div><div class="code_line">import java.io.IOException;</div><div class="code_line">&nbsp;</div><div class="code_line">import javax.sound.sampled.AudioFileFormat;</div><div class="code_line">import javax.sound.sampled.AudioFormat;</div><div class="code_line">import javax.sound.sampled.AudioInputStream;</div><div class="code_line">import javax.sound.sampled.AudioSystem;</div><div class="code_line">import javax.sound.sampled.DataLine;</div><div class="code_line">import javax.sound.sampled.LineUnavailableException;</div><div class="code_line">import javax.sound.sampled.TargetDataLine;</div><div class="code_line">import javax.sound.sampled.UnsupportedAudioFileException;</div><div class="code_line">&nbsp;</div><div class="code_line">public class mfcc {</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private static final boolean m_ousePowerInsteadOfMagnitude = false;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private final int m_nnumberOfParameters;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private final double m_dsamplingFrequency;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private final int m_nnumberOfFilters;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private final int m_nFFTLength;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private final int m_nlifteringCoefficient;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private final boolean m_oisLifteringEnabled;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private final double m_dminimumFilterOutput = 1.0;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private final boolean m_oisZeroThCepstralCoefficientCalculated;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private final double m_dlogFilterOutputFloor = 0.0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private int[][] m_nboundariesDFTBins;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private double[][] m_dweights;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private fftt m_fft;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private double[][] m_ddCTMatrix;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private double[] m_dfilterOutput;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private final double[] m_nlifteringMultiplicationFactor;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private final double m_dscalingFactor;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;//Тип файла</div><div class="code_line">&nbsp;&nbsp; &nbsp;private static AudioFileFormat.Type fileType = AudioFileFormat.Type.WAVE;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private static AudioInputStream audioInputStream;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private static AudioFormat format;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;//Размер массива чтения файла</div><div class="code_line">&nbsp;&nbsp; &nbsp;final static int W = 1024;</div><div class="code_line">&nbsp;&nbsp; &nbsp;private static int BITS_IN_BYTE = 8;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;public static void main(String[] args) {</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int nnumberofFilters = 24;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int nlifteringCoefficient = 22;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;boolean oisLifteringEnabled = true;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;boolean oisZeroThCepstralCoefficientCalculated = false;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int nnumberOfMFCCParameters = 13; //Количество коэфицентов</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double dsamplingFrequency = 8000.0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int nFFTLength = 512;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (oisZeroThCepstralCoefficientCalculated) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// take in account the zero-th MFCC</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nnumberOfMFCCParameters = nnumberOfMFCCParameters + 1;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} else {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nnumberOfMFCCParameters = nnumberOfMFCCParameters;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;mfcc mfcc = new mfcc(nnumberOfMFCCParameters, dsamplingFrequency,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nnumberofFilters, nFFTLength, oisLifteringEnabled,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nlifteringCoefficient, oisZeroThCepstralCoefficientCalculated);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;System.out.println(mfcc.toString());</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;&nbsp; &nbsp; &nbsp; &nbsp;//String PatnToFile = &quot;C:\test\music\mix20&quot; + &quot;.&quot; + fileType;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;String PatnToFile = &quot;C:\test\music\05L.wav&quot;;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;File AudioFile = new File(PatnToFile);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ByteArrayOutputStream out = new ByteArrayOutputStream();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;BufferedInputStream in;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;try {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;audioInputStream = AudioSystem.getAudioInputStream(AudioFile);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (UnsupportedAudioFileException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (IOException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;format = audioInputStream.getFormat();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (!AudioSystem.isLineSupported(info)) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;Error&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;TargetDataLine line = null;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;try {</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;line = (TargetDataLine) AudioSystem.getLine(info);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;line.open(format);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (LineUnavailableException ex) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;Error&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;line.start();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;byte[] data = new byte[W * format.getSampleSizeInBits() / BITS_IN_BYTE*2];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double[] inbuf = new double[W/2];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;try {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;in = new BufferedInputStream(new FileInputStream(AudioFile));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int read;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;while ((read = in.read(data)) &#62; 0) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;out.write(data, 0, read);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;out.flush();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (FileNotFoundException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (IOException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;data = out.toByteArray();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;decode(data, inbuf);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;/*</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; * TEST</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; * TEST</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; * TEST</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; */</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;//double[] x = new double[160];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;inbuf[2] = 10;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;inbuf[4] = 14;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double[] dparameters = mfcc.getParameters(inbuf);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;MFCC parameters:&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int i = 0; i &#60; dparameters.length; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.print(&quot; &quot; + dparameters[i]);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int[] mfccresult = new int[dparameters.length];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for(int i = 0; i &#60; dparameters.length; i++){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mfccresult[i] = (int) dparameters[i];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;=====================&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;Результаты: &quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for(int i = 0; i &#60; mfccresult.length;i++){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.print(&quot; &nbsp;| &quot; + mfccresult[i]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</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;&nbsp; &nbsp; * Перевод массива байтов в массив типа double </div><div class="code_line">&nbsp;&nbsp; &nbsp; * на выходе 2048 значений (по стандарту)</div><div class="code_line">&nbsp;&nbsp; &nbsp; */</div><div class="code_line">&nbsp;&nbsp; &nbsp;public static void decode(byte[] input, double[] output) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;assert input.length == 2 * output.length;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int i = 0; i &#60; output.length; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;output[i] = (short) (((0xFF &amp; input[2 * i + 1]) &#60;&#60; 8) | (0xFF &amp; input[2 * i]));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;output[i] /= Short.MAX_VALUE;</div><div class="code_line">&nbsp;&nbsp; &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;&nbsp; &nbsp;public mfcc(int nnumberOfParameters, double dsamplingFrequency,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int nnumberofFilters, int nFFTLength, boolean oisLifteringEnabled,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int nlifteringCoefficient,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;boolean oisZeroThCepstralCoefficientCalculated) {</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;m_oisZeroThCepstralCoefficientCalculated = oisZeroThCepstralCoefficientCalculated;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (m_oisZeroThCepstralCoefficientCalculated) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m_nnumberOfParameters = nnumberOfParameters - 1;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} else {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m_nnumberOfParameters = nnumberOfParameters;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;m_dsamplingFrequency = dsamplingFrequency;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;m_nnumberOfFilters = nnumberofFilters;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;m_nFFTLength = nFFTLength;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;calculateMelBasedFilterBank(dsamplingFrequency, nnumberofFilters,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nFFTLength);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;m_fft = new fftt(m_nFFTLength); // initialize FFT</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;initializeDCTMatrix();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;m_nlifteringCoefficient = nlifteringCoefficient;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;m_oisLifteringEnabled = oisLifteringEnabled;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;m_dfilterOutput = new double[m_nnumberOfFilters];</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;m_dscalingFactor = Math.sqrt(2.0 / m_nnumberOfFilters);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (m_oisLifteringEnabled) {</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int nnumberOfCoefficientsToLift = m_nnumberOfParameters;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m_nlifteringMultiplicationFactor = new double[m_nlifteringCoefficient];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;double dfactor = m_nlifteringCoefficient / 2.0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;double dfactor2 = Math.PI / m_nlifteringCoefficient;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (int i = 0; i &#60; m_nlifteringCoefficient; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m_nlifteringMultiplicationFactor[i] = 1.0 + dfactor</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Math.sin(dfactor2 * (i + 1));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (m_nnumberOfParameters &#62; m_nlifteringCoefficient) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;new Error(</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;Liftering is enabled and the number &quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ &quot;of parameters = &quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ m_nnumberOfParameters</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ &quot;, while &quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ &quot;the liftering coefficient is &quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ m_nlifteringCoefficient</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ &quot;. In this case some cepstrum coefficients would be made &quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ &quot;equal to zero due to liftering, what does not make much &quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ &quot;sense in a speech recognition system. You may want to &quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ &quot;increase the liftering coefficient or decrease the number &quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ &quot;of MFCC parameters.&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} else {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m_nlifteringMultiplicationFactor = null;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;/** Initializes the DCT matrix. */</div><div class="code_line">&nbsp;&nbsp; &nbsp;private void initializeDCTMatrix() {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;m_ddCTMatrix = new double[m_nnumberOfParameters][m_nnumberOfFilters];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int i = 0; i &#60; m_nnumberOfParameters; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (int j = 0; j &#60; m_nnumberOfFilters; j++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m_ddCTMatrix[i][j] = Math.cos((i + 1.0) * (j + 1.0 - 0.5)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* (Math.PI / m_nnumberOfFilters));</div><div class="code_line">&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;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;public static double[] convertHzToMel(double[] dhzFrequencies,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;double dsamplingFrequency) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double[] dmelFrequencies = new double[dhzFrequencies.length];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int k = 0; k &#60; dhzFrequencies.length; k++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dmelFrequencies[k] = 2595.0 * (Math</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.log(1.0 + (dhzFrequencies[k] / 700.0)) / Math.log(10));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return dmelFrequencies;</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;private void calculateMelBasedFilterBank(double dsamplingFrequency,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int nnumberofFilters, int nfftLength) {</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// frequencies for each triangular filter</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double[][] dfrequenciesInMelScale = new double[nnumberofFilters][3];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// the +1 below is due to the sample of frequency pi (or fs/2)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double[] dfftFrequenciesInHz = new double[nfftLength / 2 + 1];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// compute the frequency of each FFT sample (in Hz):</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double ddeltaFrequency = dsamplingFrequency / nfftLength;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int i = 0; i &#60; dfftFrequenciesInHz.length; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dfftFrequenciesInHz[i] = i * ddeltaFrequency;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// convert Hz to Mel</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double[] dfftFrequenciesInMel = this.convertHzToMel(</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dfftFrequenciesInHz, dsamplingFrequency);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// compute the center frequencies. Notice that 2 filters are</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// &quot;artificially&quot; created in the endpoints of the frequency</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// scale, correspondent to 0 and fs/2 Hz.</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double[] dfilterCenterFrequencies = new double[nnumberofFilters + 2];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// implicitly: dfilterCenterFrequencies[0] = 0.0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ddeltaFrequency = dfftFrequenciesInMel[dfftFrequenciesInMel.length - 1]</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/ (nnumberofFilters + 1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int i = 1; i &#60; dfilterCenterFrequencies.length; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dfilterCenterFrequencies[i] = i * ddeltaFrequency;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// initialize member variables</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;m_nboundariesDFTBins = new int[m_nnumberOfFilters][2];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;m_dweights = new double[m_nnumberOfFilters][];</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// notice the loop starts from the filter i=1 because i=0 is the one</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// centered at DC</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int i = 1; i &#60;= nnumberofFilters; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m_nboundariesDFTBins[i - 1][0] = Integer.MAX_VALUE;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// notice the loop below doesn&#39;t include the first and last FFT</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// samples</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (int j = 1; j &#60; dfftFrequenciesInMel.length - 1; j++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// see if frequency j is inside the bandwidth of filter i</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ((dfftFrequenciesInMel[j] &#62;= dfilterCenterFrequencies[i - 1])</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp; (dfftFrequenciesInMel[j] &#60;= dfilterCenterFrequencies[i + 1])) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// the i-1 below is due to the fact that we discard the</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// first filter i=0</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// look for the first DFT sample for this filter</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (j &#60; m_nboundariesDFTBins[i - 1][0]) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m_nboundariesDFTBins[i - 1][0] = j;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// look for the last DFT sample for this filter</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (j &#62; m_nboundariesDFTBins[i - 1][1]) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m_nboundariesDFTBins[i - 1][1] = j;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&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;// check for consistency. The problem below would happen just</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// in case of a big number of MFCC parameters for a small DFT length.</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int i = 0; i &#60; nnumberofFilters; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (m_nboundariesDFTBins[i][0] == m_nboundariesDFTBins[i][1]) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;new Error(</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;Error in MFCC filter bank. In filter &quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ i</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ &quot; the first sample is equal to the last sample !&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ &quot; Try changing some parameters, for example, decreasing the number of filters.&quot;);</div><div class="code_line">&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;&nbsp; &nbsp; &nbsp; &nbsp;// allocate space</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int i = 0; i &#60; nnumberofFilters; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m_dweights[i] = new double[m_nboundariesDFTBins[i][1]</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- m_nboundariesDFTBins[i][0] + 1];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// calculate the weights</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int i = 1; i &#60;= nnumberofFilters; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (int j = m_nboundariesDFTBins[i - 1][0], k = 0; j &#60;= m_nboundariesDFTBins[i - 1][1]; j++, k++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (dfftFrequenciesInMel[j] &#60; dfilterCenterFrequencies[i]) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m_dweights[i - 1][k] = (dfftFrequenciesInMel[j] - dfilterCenterFrequencies[i - 1])</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/ (dfilterCenterFrequencies[i] - dfilterCenterFrequencies[i - 1]);</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;m_dweights[i - 1][k] = 1.0 - ((dfftFrequenciesInMel[j] - dfilterCenterFrequencies[i]) / (dfilterCenterFrequencies[i + 1] - dfilterCenterFrequencies[i]));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&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;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;public double[] getParameters(double[] fspeechFrame) {</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// use mel filter bank</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int i = 0; i &#60; m_nnumberOfFilters; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m_dfilterOutput[i] = 0.0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Notice that the FFT samples at 0 (DC) and fs/2 are not considered</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// on this calculation</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (m_ousePowerInsteadOfMagnitude) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;double[] fpowerSpectrum = m_fft.calculateFFTPower(fspeechFrame);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (int j = m_nboundariesDFTBins[i][0], k = 0; j &#60;= m_nboundariesDFTBins[i][1]; j++, k++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m_dfilterOutput[i] += fpowerSpectrum[j] * m_dweights[i][k];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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;double[] fmagnitudeSpectrum = m_fft</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.calculateFFTMagnitude(fspeechFrame);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (int j = m_nboundariesDFTBins[i][0], k = 0; j &#60;= m_nboundariesDFTBins[i][1]; j++, k++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m_dfilterOutput[i] += fmagnitudeSpectrum[j]</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* m_dweights[i][k];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// ISIP (Mississipi univ.) implementation</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (m_dfilterOutput[i] &#62; m_dminimumFilterOutput) {// floor power to</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; &nbsp;// avoid log(0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m_dfilterOutput[i] = Math.log(m_dfilterOutput[i]); // using ln</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;m_dfilterOutput[i] = m_dlogFilterOutputFloor;</div><div class="code_line">&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; &nbsp; &nbsp; &nbsp;double[] dMFCCParameters = null;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (m_oisZeroThCepstralCoefficientCalculated) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dMFCCParameters = new double[m_nnumberOfParameters + 1];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// calculates zero&#39;th cepstral coefficient and pack it</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// after the MFCC parameters of each frame for the sake</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// of compatibility with HTK</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;double dzeroThCepstralCoefficient = 0.0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (int j = 0; j &#60; m_nnumberOfFilters; j++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dzeroThCepstralCoefficient += m_dfilterOutput[j];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dzeroThCepstralCoefficient *= m_dscalingFactor;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dMFCCParameters[dMFCCParameters.length - 1] = dzeroThCepstralCoefficient;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} else {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// allocate space</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dMFCCParameters = new double[m_nnumberOfParameters];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// cosine transform</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int i = 0; i &#60; m_nnumberOfParameters; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (int j = 0; j &#60; m_nnumberOfFilters; j++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dMFCCParameters[i] += m_dfilterOutput[j] * m_ddCTMatrix[i][j];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// the original equations have the first index as 1</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// could potentially incorporate liftering factor and</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// factor below to save multiplications, but will not</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// do it for the sake of clarity</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dMFCCParameters[i] *= m_dscalingFactor;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (m_oisLifteringEnabled) {</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (int i = 0; i &#60; m_nnumberOfParameters; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dMFCCParameters[i] *= m_nlifteringMultiplicationFactor[i];</div><div class="code_line">&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;&nbsp; &nbsp; &nbsp; &nbsp;return dMFCCParameters;</div><div class="code_line">&nbsp;&nbsp; &nbsp;} // end method</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;/**</div><div class="code_line">&nbsp;&nbsp; &nbsp; * Returns the sampling frequency.</div><div class="code_line">&nbsp;&nbsp; &nbsp; */</div><div class="code_line">&nbsp;&nbsp; &nbsp;public double getSamplingFrequency() {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return this.m_dsamplingFrequency;</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;/**</div><div class="code_line">&nbsp;&nbsp; &nbsp; * Returns the number of points of the Fast Fourier Transform (FFT) used in</div><div class="code_line">&nbsp;&nbsp; &nbsp; * the calculation of this MFCC.</div><div class="code_line">&nbsp;&nbsp; &nbsp; */</div><div class="code_line">&nbsp;&nbsp; &nbsp;public int getFFTLength() {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return m_nFFTLength;</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;/**</div><div class="code_line">&nbsp;&nbsp; &nbsp; * Returns the number of MFCC coefficients, including the 0-th if required</div><div class="code_line">&nbsp;&nbsp; &nbsp; * by user in the object construction.</div><div class="code_line">&nbsp;&nbsp; &nbsp; */</div><div class="code_line">&nbsp;&nbsp; &nbsp;public int getNumberOfCoefficients() {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return (m_oisZeroThCepstralCoefficientCalculated ? (m_nnumberOfParameters + 1)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: m_nnumberOfParameters);</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;/**</div><div class="code_line">&nbsp;&nbsp; &nbsp; * Return a string with all important parameters of this object.</div><div class="code_line">&nbsp;&nbsp; &nbsp; */</div><div class="code_line">&nbsp;&nbsp; &nbsp;public String toString() {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return &quot;MFCC.nnumberOfParameters = &quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ (m_oisZeroThCepstralCoefficientCalculated ? (m_nnumberOfParameters + 1)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: m_nnumberOfParameters) + &quot;\n&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ &quot;MFCC.nnumberOfFilters = &quot; + m_nnumberOfFilters + &quot;\n&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ &quot;MFCC.nFFTLength = &quot; + m_nFFTLength + &quot;\n&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ &quot;MFCC.dsamplingFrequency = &quot; + m_dsamplingFrequency + &quot;\n&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ &quot;MFCC.nlifteringCoefficient = &quot; + m_nlifteringCoefficient</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ &quot;\n&quot; + &quot;MFCC.oisLifteringEnabled = &quot; + m_oisLifteringEnabled</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ &quot;\n&quot; + &quot;MFCC.oisZeroThCepstralCoefficientCalculated = &quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ m_oisZeroThCepstralCoefficientCalculated;</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;public double[] getFilterBankOutputs(double[] fspeechFrame) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double dfilterOutput[] = new double[m_nnumberOfFilters];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int i = 0; i &#60; m_nnumberOfFilters; i++) {</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (m_ousePowerInsteadOfMagnitude) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;double[] fpowerSpectrum = m_fft.calculateFFTPower(fspeechFrame);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (int j = m_nboundariesDFTBins[i][0], k = 0; j &#60;= m_nboundariesDFTBins[i][1]; j++, k++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dfilterOutput[i] += fpowerSpectrum[j] * m_dweights[i][k];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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;double[] fmagnitudeSpectrum = m_fft</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.calculateFFTMagnitude(fspeechFrame);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (int j = m_nboundariesDFTBins[i][0], k = 0; j &#60;= m_nboundariesDFTBins[i][1]; j++, k++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dfilterOutput[i] += fmagnitudeSpectrum[j]</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* m_dweights[i][k];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (dfilterOutput[i] &#62; m_dminimumFilterOutput) {// floor power to</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;// avoid log(0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dfilterOutput[i] = Math.log(dfilterOutput[i]); // using ln</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;dfilterOutput[i] = m_dlogFilterOutputFloor;</div><div class="code_line">&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;return dfilterOutput;</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
<br>
<br>
Вторая часть тут:<br>
<br>
<a class='tag-url' href='http://pastebin.com/sR52wqYR' target='_blank'>http://pastebin.com/sR52wqYR</a><br>
<br>
Не знаю, думал так правильнее будет с помощью ДатаЛайна...<br>
<br>
Звуковых файлов особо и нет)<br>
<br>
Вот пример файла, могу еще выложить многа многа файлов которые аюдасити получил из этого, когда делил на 0.25 секунд.<br>
<br>
Спасибо вам&#33;<br>
<span class="b-attach" data-size="57388" data-hits="440" data-attach-id="35693" data-attach-post-id="3420855">
			<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=3420855&amp;attach_id=35693' title='Скачать файл' target='_blank'>mix21.WAVE</a> (, : 440)
		</span> <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2014-02-27T12:12:18+00:00">27.02.14, 12:12</time></span></span><br>
У меня нет нормального микрофона, честно говоря )) так что подумывал где бы взять хотя бы пару словечек в WAVE формате...]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3420567</guid>
        <pubDate>Thu, 27 Feb 2014 08:29:12 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3420567</link>
        <description><![CDATA[nsh: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Ну так как,nsh, что посоветуете?)<br>
</div></div><br>
<br>
Пока не видно:<br>
<br>
1. Полный код, а не отрывки. Где определена переменная W? где создается объект mfcc? <br>
<br>
2. Чистый код. Зачем открывать DataLine для чтения с микрофона, если можно читать из файла? Зачем странные присваивания вроде inbuf[4] = 14?<br>
<br>
3. Исходные звуковые файлы<br>
<br>
Посоветовать что-нибудь сложно]]></description>
        <author>nsh</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3420219</guid>
        <pubDate>Wed, 26 Feb 2014 14:09:26 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3420219</link>
        <description><![CDATA[MrKor: Ну так как,nsh, что посоветуете?)]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3419670</guid>
        <pubDate>Tue, 25 Feb 2014 18:19:43 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3419670</link>
        <description><![CDATA[MrKor: Так это и есть весь код) код библиотеки + код в моем первом посте)))<br>
<br>
А про файлы я имел в виду, что аюдасити делит когда по промежуткам, создает много файлов, если у меня с 0.25 секунд 6 файлов, то сколько же будет с 0.025...<br>
<br>
Как это потом анализировать.. Ухх))<br>
<br>
В любом случае спасибо вам, nsh, что тяните и помогаете)) <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2014-02-25T18:22:52+00:00">25.02.14, 18:22</time></span></span><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;public static void decode(byte[] input, double[] output) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;assert input.length == 2 * output.length;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int i = 0; i &#60; output.length; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;output[i] = (short) (((0xFF &amp; input[2 * i + 1]) &#60;&#60; 8) | (0xFF &amp; input[2 * i]));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;output[i] /= Short.MAX_VALUE;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&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">inbuf[2] = 10;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;inbuf[4] = 14;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double[] dparameters = mfcc.getParameters(inbuf);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;MFCC parameters:&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (int i = 0; i &#60; dparameters.length; i++) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.print(&quot; &quot; + dparameters[i]);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int[] mfccresult = new int[dparameters.length];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for(int i = 0; i &#60; dparameters.length; i++){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mfccresult[i] = (int) dparameters[i];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for(int i = 0; i &#60; mfccresult.length;i++){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.print(mfccresult[i]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div></ol></div></div></div></div><br>
<br>
Это весь код.]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3419580</guid>
        <pubDate>Tue, 25 Feb 2014 15:37:47 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3419580</link>
        <description><![CDATA[nsh: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Не знаю, авсоь там и есть какая то ошибочка... <br>
</div></div><br>
<br>
Свой код надо показывать, а не код библиотеки. В библиотеках обычно ошибки есть, но не такие значительные.<br>
Ошибки прежде всего в собственном коде нужно искать.<br>
<br>
Файлы используемые тоже стоит выложить.<br>
<br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Ого, это сколько же файлов получится....<br>
</div></div><br>
<br>
Файлов будет столько же. Строк будет больше.]]></description>
        <author>nsh</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3419233</guid>
        <pubDate>Tue, 25 Feb 2014 09:52:08 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3419233</link>
        <description><![CDATA[MrKor: Уху спасибо nsh&#33; Делал с помощью вот этой библиотеки: <br>
<a class='tag-url' href='http://code.ohloh.net/file?fid=EQDSocdzPtNlf-nRUf8gcdkdRlY&cid=McwjmT5nA9o&s=&fp=10078&mp&projSelected=true#L0' target='_blank'>http://code.ohloh.net/file?fid=EQDSocdzPtN...elected=true#L0</a><br>
<br>
Не знаю, авсоь там и есть какая то ошибочка... <br>
<br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=387305&view=findpost&p=3419146'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>nsh &#064; <time class="tag-quote__quoted-time" datetime="2014-02-25T07:50:43+00:00">25.02.14, 07:50</time></span><div class='quote '>Для анализа речи каждая строчка должна быть в 10 раз меньше - 0.025 секунды.</div></div><br>
<br>
Ого, это сколько же файлов получится....<br>
<br>
Ведь каждый еще и прогнать надо..<br>
<br>
Ну не знаю,вроде одинаковых моментов в звуковых файлах нет, просто милисекунды перед началом записи и перед завершением я же молчу)) Вот он это молчание анализирует и выдает одинаковые участки векторов.]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3419146</guid>
        <pubDate>Tue, 25 Feb 2014 07:50:43 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3419146</link>
        <description><![CDATA[nsh: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Но вот почему он читает именно тишину, даю код &quot;чтения&quot;, может быть гуру подскажут что он выдает:<br>
</div></div><br>
<br>
Что в файле есть, то и читает. Ничего необычного в этом нет<br>
<br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>В принципе мне понятно, почему такое творится одинаковые результаты это &quot;тишина&quot;<br>
</div></div><br>
<br>
Если в файле нет одинаковых кусков в начале и конце, то одинаковые результаты это не тишина, а ошибка в коде. <br>
<br>
Чтобы получить помощь по коду,нужно этот код показать.<br>
<br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Каждая строчка это 0.25 секунды</div></div><br>
<br>
Для анализа речи каждая строчка должна быть в 10 раз меньше - 0.025 секунды.]]></description>
        <author>nsh</author>
        <category>Речевые Технологии</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3418982</guid>
        <pubDate>Mon, 24 Feb 2014 17:56:27 +0000</pubDate>
        <title>Проблема сравнительного анализа MFCC векторов&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=387305&amp;view=findpost&amp;p=3418982</link>
        <description><![CDATA[MrKor: Здравствуйте, форумчане&#33;<br>
<br>
Возникла проблема..<br>
<br>
Записываю речевые сигналы, анализирую их программой(в основном там библиотека MFCC Java)<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; -1 &nbsp; 4 &nbsp; -10 &nbsp; 6 &nbsp; -1 &nbsp; -1 &nbsp; 3 &nbsp; -1 &nbsp; -1 &nbsp; 2 &nbsp; -3 &nbsp; 0 &nbsp; 2</div></ol></div></div></div></div><br>
<br>
Хотя.. я анализирую целый звуковой файл, возможно поможет деление на кусочки, жаль я не очень это умею)) Но попробуем. <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2014-02-24T18:42:03+00:00">24.02.14, 18:42</time></span></span><br>
Записал слова привет и москва, результаты ниже:<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;&nbsp;| -1 &nbsp;| 4 &nbsp;| -10 &nbsp;| 6 &nbsp;| -1 &nbsp;| -1 &nbsp;| 3 &nbsp;| -1 &nbsp;| -1 &nbsp;| 2 &nbsp;| -3 &nbsp;| 0 &nbsp;| 2</div><div class="code_line">&nbsp;&nbsp;| -1 &nbsp;| 4 &nbsp;| -10 &nbsp;| 6 &nbsp;| -1 &nbsp;| -1 &nbsp;| 3 &nbsp;| -1 &nbsp;| -1 &nbsp;| 2 &nbsp;| -3 &nbsp;| 0 &nbsp;| 2</div><div class="code_line">&nbsp;&nbsp;| -1 &nbsp;| 5 &nbsp;| -10 &nbsp;| 7 &nbsp;| 0 &nbsp; | -1 &nbsp;| 4 &nbsp;| -1 &nbsp;| 0 &nbsp; | 3 &nbsp;| -2 &nbsp;| 0 &nbsp;| 3</div><div class="code_line">&nbsp;&nbsp;| 0 &nbsp; | 5 &nbsp;| -10 &nbsp;| 5 &nbsp;| -2 &nbsp;| -3 &nbsp;| 0 &nbsp;| -7 &nbsp;| -4 &nbsp;| 1 &nbsp;| -1 &nbsp;| 1 &nbsp;| 1</div><div class="code_line">&nbsp;&nbsp;| 0 &nbsp; | 6 &nbsp;| -9 &nbsp; | 7 &nbsp;| 0 &nbsp; | -2 &nbsp;| 3 &nbsp;| -1 &nbsp;| -1 &nbsp;| 2 &nbsp;| -4 &nbsp;| -2 | 1</div><div class="code_line">&nbsp;&nbsp;| 0 &nbsp; | 3 &nbsp;| -11 &nbsp;| 1 &nbsp;| -4 &nbsp;| 2 &nbsp; | 5 &nbsp;| -1 &nbsp;| 0 &nbsp; | 1 &nbsp;| -5 &nbsp;| -2 | -1</div><div class="code_line">&nbsp;&nbsp;| -1 &nbsp;| 4 &nbsp;| -10 &nbsp;| 6 &nbsp;| -1 &nbsp;| -1 &nbsp;| 3 &nbsp;| -1 &nbsp;| -1 &nbsp;| 3 &nbsp;| -3 &nbsp;| 0 &nbsp;| 2</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;| -1 &nbsp;| 4 &nbsp;| -10 &nbsp;| 6 &nbsp;| -1 &nbsp;| -1 &nbsp;| 3 &nbsp;| -1 &nbsp;| -1 &nbsp;| 2 &nbsp;| -3 &nbsp;| 0 &nbsp;| 2</div><div class="code_line">&nbsp;&nbsp;| -1 &nbsp;| 4 &nbsp;| -10 &nbsp;| 6 &nbsp;| -1 &nbsp;| -1 &nbsp;| 3 &nbsp;| -1 &nbsp;| -1 &nbsp;| 2 &nbsp;| -3 &nbsp;| 0 &nbsp;| 2</div><div class="code_line">&nbsp;&nbsp;| 0 &nbsp; | 5 &nbsp;| -9 &nbsp; | 8 &nbsp;| 0 &nbsp; | -2 &nbsp;| 2 &nbsp;| 0 &nbsp; | 0 &nbsp; | 3 &nbsp;| -2 &nbsp;| 0 &nbsp;| 3</div><div class="code_line">&nbsp;&nbsp;| 0 &nbsp; | 6 &nbsp;| -8 &nbsp; | 9 &nbsp;| 0 &nbsp; | -3 &nbsp;| 2 &nbsp;| -3 &nbsp;| -3 &nbsp;| 0 &nbsp;| -6 &nbsp;| -3 | 0</div><div class="code_line">&nbsp;&nbsp;| -1 &nbsp;| 4 &nbsp;| -10 &nbsp;| 6 &nbsp;| -1 &nbsp;| -1 &nbsp;| 3 &nbsp;| -1 &nbsp;| -1 &nbsp;| 2 &nbsp;| -3 &nbsp;| 0 &nbsp;| 2</div></ol></div></div></div></div><br>
<br>
В принципе мне понятно, почему такое творится одинаковые результаты это &quot;тишина&quot;<br>
Каждая строчка это 0.25 секунды.Видно что в первом случае я говорил примерно 0.75 секунды, на втором половина секунды oO<br>
<br>
Но вот почему он читает именно тишину, даю код &quot;чтения&quot;, может быть гуру подскажут что он выдает:<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;String PatnToFile = &quot;C:\test\music\05L.wav&quot;;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;File AudioFile = new File(PatnToFile);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ByteArrayOutputStream out = new ByteArrayOutputStream();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;BufferedInputStream in;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;try {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;audioInputStream = AudioSystem.getAudioInputStream(AudioFile);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (UnsupportedAudioFileException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (IOException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;format = audioInputStream.getFormat();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (!AudioSystem.isLineSupported(info)) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;Error&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;TargetDataLine line = null;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;try {</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;line = (TargetDataLine) AudioSystem.getLine(info);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;line.open(format);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (LineUnavailableException ex) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;Error&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;line.start();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;byte[] data = new byte[W * format.getSampleSizeInBits() / BITS_IN_BYTE*2];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double[] inbuf = new double[W/2];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;try {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;in = new BufferedInputStream(new FileInputStream(AudioFile));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int read;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;while ((read = in.read(data)) &#62; 0) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;out.write(data, 0, read);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;out.flush();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (FileNotFoundException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (IOException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;data = out.toByteArray();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;decode(data, inbuf);</div></ol></div></div></div></div><br>
<br>
Где звуковой файл, собс, записанная речь. <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2014-02-24T18:42:42+00:00">24.02.14, 18:42</time></span></span><br>
Заранее спасибо за ответы&#33;]]></description>
        <author>MrKor</author>
        <category>Речевые Технологии</category>
      </item>
	
      </channel>
      </rss>
	