<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Голосовая активация клавиши]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=8061&amp;type=atom" />
	<updated>2013-02-10T15:05:54Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=8061</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Голосовая активация клавиши]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69322#p69322" />
			<content type="html"><![CDATA[<p>Правильнее так:<br /></p><div class="codebox"><pre><code>#Persistent
OnExit, Exit

silent := 0
maxSilentDuration := 1000
timer := 100

if MicrophoneOpen()
    throw Exception(&quot;Could not open microphone&quot;)

SetTimer CheckMicrophoneLevel, % timer
return

CheckMicrophoneLevel:
    if MicrophoneLevel() &gt; silent {
        Send {F9}

        loop {
            Sleep timer

            if MicrophoneLevel() &gt; silent {
                silentDuration := 0
                continue
            }

            silentDuration += timer
        }
        until silentDuration &gt;= maxSilentDuration

        Send {F9}
    }
    return

Exit:
    MicrophoneClose()
    ExitApp

MicrophoneLevel() {
    VarSetCapacity(value, 32, 0)
    if MCISendString(&quot;status ScriptMicrophone level&quot;, &amp;value, 16)
        return false
    return StrGet(&amp;value, 16) - 1
}

MicrophoneOpen() {
    return MCISendString(&quot;open new alias ScriptMicrophone type waveaudio wait&quot;)
}

MicrophoneClose() {
    return MCISendString(&quot;close ScriptMicrophone wait&quot;)
}

MCISendString(ByRef command, returnString := 0, bufSize := 0, hwndCallback := 0) {
    return DllCall(&quot;winmm\mciSendString&quot;, &quot;Str&quot;, command , &quot;UPtr&quot;, returnString, &quot;UInt&quot;, bufSize, &quot;UPtr&quot;, hwndCallback)
}</code></pre></div><p>Подразумевается, что между словами в фразе бывает не более секунды тишины.<br />Пауза задаётся переменной maxSilentDuration</p>]]></content>
			<author>
				<name><![CDATA[creature.ws]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26105</uri>
			</author>
			<updated>2013-02-10T15:05:54Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69322#p69322</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Голосовая активация клавиши]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69320#p69320" />
			<content type="html"><![CDATA[<p>А я понял sleep это задержка,и её надо ставить на 2000.Тогда не пропадают слова.</p>]]></content>
			<author>
				<name><![CDATA[takem94]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=29582</uri>
			</author>
			<updated>2013-02-10T14:30:56Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69320#p69320</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Голосовая активация клавиши]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69319#p69319" />
			<content type="html"><![CDATA[<p>Оно с самого начала «работало», теперь — работает «как вам нужно»</p>]]></content>
			<author>
				<name><![CDATA[creature.ws]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26105</uri>
			</author>
			<updated>2013-02-10T13:54:03Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69319#p69319</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Голосовая активация клавиши]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69318#p69318" />
			<content type="html"><![CDATA[<p>Заработало когда поставил 750 в sleep.Спасибо большое за Вашу помощь!</p>]]></content>
			<author>
				<name><![CDATA[takem94]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=29582</uri>
			</author>
			<updated>2013-02-10T13:52:32Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69318#p69318</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Голосовая активация клавиши]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69317#p69317" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Error at line 29.</p></blockquote></div><p>Используйте актуальную версию autohotkey.</p><div class="quotebox"><blockquote><p>Проблема вся в том что когда я…</p></blockquote></div><p>Начав говорить, сохраняйте один уровень громкости, не допускайте пауз <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p><p>Найдите в коде строку Sleep 20, измените её на Sleep 1000<br />После этого изменения, запись, включенная отправкой нажатия F9, будет приостановлена повторным нажатием F9 если через 1 секунду после начала записи, уровень сигнала, снимаемого с микрофона, будет ниже установленного уровня «тишины».</p>]]></content>
			<author>
				<name><![CDATA[creature.ws]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26105</uri>
			</author>
			<updated>2013-02-10T13:42:00Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69317#p69317</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Голосовая активация клавиши]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69316#p69316" />
			<content type="html"><![CDATA[<p>Нужно ввести задержку на определение &quot;тишины&quot;.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2013-02-10T13:36:18Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69316#p69316</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Голосовая активация клавиши]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69315#p69315" />
			<content type="html"><![CDATA[<p>Проблема вся в том что когда я начинаю говорить,скрипт начинает без остановки нажимать заданную клавишу и из-за этого пауза то снимается,то ставится и в видео все глючит.По этому нужно четка ограничить количество нажатий до 2-ух,а то при 3-ех нажатиях запись с паузы слетает.</p>]]></content>
			<author>
				<name><![CDATA[takem94]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=29582</uri>
			</author>
			<updated>2013-02-10T13:35:08Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69315#p69315</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Голосовая активация клавиши]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69314#p69314" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Error at line 29.

Line Text: MCISendString(ByRef command, returnString := 0, bufSize := 0, hwndCallback := 0)
Error: Missing comma

The program will exit.</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2013-02-10T13:33:57Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69314#p69314</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Голосовая активация клавиши]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69313#p69313" />
			<content type="html"><![CDATA[<p>Код к x64 не привязан. Не работать нечему.</p><p>Посмотрите, что возвращает MCISendString(&quot;status ScriptMicrophone level&quot;, &amp;value, 16) в MicrophoneLevel().<br />Уточните, что значит «не работает».</p>]]></content>
			<author>
				<name><![CDATA[creature.ws]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26105</uri>
			</author>
			<updated>2013-02-10T13:27:49Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69313#p69313</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Голосовая активация клавиши]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69312#p69312" />
			<content type="html"><![CDATA[<p>А что нужно изменять если на x86 системе xp\7 не работает?</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2013-02-10T13:19:34Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69312#p69312</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Голосовая активация клавиши]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69311#p69311" />
			<content type="html"><![CDATA[<p>Это же форум, незачем на почту писать.<br />Переменная silent определяет значение уровня «тишины», увеличивая число в этой переменной вы повышаете «порог срабатывания».</p><p>Код, приведенный ниже, отображает во всплывающем окне текущий «уровень» микрофона, запустите, оцените визуально (по отображаемому в окне числу) насколько высок уровень шума в помещении, установите значение переменной silent в коде из сообщения #2 выше порогового «значения тишины» для вашего микрофона и помещения, сохраните отредактированный код из сообщения #2.<br /></p><div class="codebox"><pre><code>OnExit, Exit
MicrophoneOpen()

loop {
    Tooltip % MicrophoneLevel()
    Sleep 40
}

Exit:
    MicrophoneClose()
    ExitApp

MicrophoneLevel() {
    VarSetCapacity(value, 32, 0)
    if MCISendString(&quot;status ScriptMicrophone level&quot;, &amp;value, 16)
        return false
    return StrGet(&amp;value, 16) - 1
}

MicrophoneOpen() {
    return MCISendString(&quot;open new alias ScriptMicrophone type waveaudio wait&quot;)
}

MicrophoneClose() {
    return MCISendString(&quot;close ScriptMicrophone wait&quot;)
}

MCISendString(ByRef command, returnString := 0, bufSize := 0, hwndCallback := 0) {
    return DllCall(&quot;winmm\mciSendString&quot;, &quot;Str&quot;, command , &quot;UPtr&quot;, returnString, &quot;UInt&quot;, bufSize, &quot;UPtr&quot;, hwndCallback)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[creature.ws]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26105</uri>
			</author>
			<updated>2013-02-10T12:25:14Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69311#p69311</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Голосовая активация клавиши]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69292#p69292" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>#Persistent
OnExit, Exit

silent := 0
maxSilentDuration := 1000
timer := 100

if MicrophoneOpen()
    throw Exception(&quot;Could not open microphone&quot;)

SetTimer CheckMicrophoneLevel, % timer
return

CheckMicrophoneLevel:
    if MicrophoneLevel() &gt; silent {
        Send {F9}

        loop {
            Sleep timer

            if MicrophoneLevel() &gt; silent {
                silentDuration := 0
                continue
            }

            silentDuration += timer
        }
        until silentDuration &gt;= maxSilentDuration

        Send {F9}
    }
    return

Exit:
    MicrophoneClose()
    ExitApp

MicrophoneLevel() {
    VarSetCapacity(value, 32, 0)
    if MCISendString(&quot;status ScriptMicrophone level&quot;, &amp;value, 16)
        return false
    return StrGet(&amp;value, 16) - 1
}

MicrophoneOpen() {
    return MCISendString(&quot;open new alias ScriptMicrophone type waveaudio wait&quot;)
}

MicrophoneClose() {
    return MCISendString(&quot;close ScriptMicrophone wait&quot;)
}

MCISendString(ByRef command, returnString := 0, bufSize := 0, hwndCallback := 0) {
    return DllCall(&quot;winmm\mciSendString&quot;, &quot;Str&quot;, command , &quot;UPtr&quot;, returnString, &quot;UInt&quot;, bufSize, &quot;UPtr&quot;, hwndCallback)
}
</code></pre></div><div class="quotebox"><blockquote><p>сколько это будет стоить</p></blockquote></div><p>330, каждому.</p>]]></content>
			<author>
				<name><![CDATA[creature.ws]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26105</uri>
			</author>
			<updated>2013-02-10T04:37:02Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69292#p69292</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Голосовая активация клавиши]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69281#p69281" />
			<content type="html"><![CDATA[<p>Нужен скрипт который следил бы за микрофоном и при срабатывание(то есть изменения шкалы) нажимал клавишу &quot;F9&quot;.Это нужно для записи видео без моментов где я молчу.Точнее когда я говорю скрипт срабатывает и нажимает клавишу, и когда я заканчиваю говорить клавиша еше раз нажимается чтоб поставить видео на пазу.<br />Вот пример такого скрипта:<a href="http://www.autohotkey.com/board/topic/84272-seismographic-software/?hl=microphone">http://www.autohotkey.com/board/topic/8 … microphone</a><br />Но в этом скрипте при разговоре начинается запись звука,нужно это поменять на нажатие клавиши.<br />Кто сможет написать такой скрипт и сколько это будет стоить?</p>]]></content>
			<author>
				<name><![CDATA[takem94]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=29582</uri>
			</author>
			<updated>2013-02-09T15:25:45Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69281#p69281</id>
		</entry>
</feed>
