<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://zxdd.com/index.php?action=history&amp;feed=atom&amp;title=SpeechRecognition</id>
	<title>SpeechRecognition - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://zxdd.com/index.php?action=history&amp;feed=atom&amp;title=SpeechRecognition"/>
	<link rel="alternate" type="text/html" href="https://zxdd.com/index.php?title=SpeechRecognition&amp;action=history"/>
	<updated>2026-06-02T22:39:50Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>https://zxdd.com/index.php?title=SpeechRecognition&amp;diff=1487&amp;oldid=prev</id>
		<title>Eric：​/* 保存音频文件 */</title>
		<link rel="alternate" type="text/html" href="https://zxdd.com/index.php?title=SpeechRecognition&amp;diff=1487&amp;oldid=prev"/>
		<updated>2024-02-23T02:10:31Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;保存音频文件&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2024年2月23日 (五) 02:10的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l33&quot;&gt;第33行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第33行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     # timeout：指定等待时间（秒），默认None一直等待。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     # timeout：指定等待时间（秒），默认None一直等待。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     # phrase_time_limit：最长输入时间（秒），默认None没有时间限制。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     # phrase_time_limit：最长输入时间（秒），默认None没有时间限制。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     audio = r.listen(source, timeout=15, phrase_time_limit=&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;4&lt;/del&gt;)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     audio = r.listen(source, timeout=15, phrase_time_limit=&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;50&lt;/ins&gt;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# 存储为wav格式，还可以存储为raw，aiff和flac格式。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# 存储为wav格式，还可以存储为raw，aiff和flac格式。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l43&quot;&gt;第43行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第43行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|[https://github.com/Uberi/speech_recognition/blob/master/examples/write_audio.py GitHub：speech_recognition/examples/write_audio.py ]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|[https://github.com/Uberi/speech_recognition/blob/master/examples/write_audio.py GitHub：speech_recognition/examples/write_audio.py ]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==资源==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==资源==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===官网===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===官网===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki_lbt:diff::1.12:old-1486:rev-1487 --&gt;
&lt;/table&gt;</summary>
		<author><name>Eric</name></author>
	</entry>
	<entry>
		<id>https://zxdd.com/index.php?title=SpeechRecognition&amp;diff=1486&amp;oldid=prev</id>
		<title>Eric：​创建页面，内容为“SpeechRecognition是一个开源的Python 语音识别库，支持多个语音识别引擎和API，可以在线和离线识别。  ==简介== ===时间轴===  ===安装=== 使用pip安装：  pip install SpeechRecognition  {{了解更多 |[https://pypi.org/project/SpeechRecognition/ PyPi：SpeechRecognition] }} ==快速入门==  ==语音识别引擎== SpeechRecognition支持下面的在线或离线的语音识别引擎。  {{了解更多 |[https://githu…”</title>
		<link rel="alternate" type="text/html" href="https://zxdd.com/index.php?title=SpeechRecognition&amp;diff=1486&amp;oldid=prev"/>
		<updated>2024-02-23T01:58:43Z</updated>

		<summary type="html">&lt;p&gt;创建页面，内容为“SpeechRecognition是一个开源的&lt;a href=&quot;/Python&quot; title=&quot;Python&quot;&gt;Python&lt;/a&gt; 语音识别库，支持多个语音识别引擎和API，可以在线和离线识别。  ==简介== ===时间轴===  ===安装=== 使用&lt;a href=&quot;/Pip&quot; title=&quot;Pip&quot;&gt;pip&lt;/a&gt;安装：  pip install SpeechRecognition  {{了解更多 |[https://pypi.org/project/SpeechRecognition/ PyPi：SpeechRecognition] }} ==快速入门==  ==语音识别引擎== SpeechRecognition支持下面的在线或离线的语音识别引擎。  {{了解更多 |[https://githu…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;SpeechRecognition是一个开源的[[Python]] 语音识别库，支持多个语音识别引擎和API，可以在线和离线识别。&lt;br /&gt;
&lt;br /&gt;
==简介==&lt;br /&gt;
===时间轴===&lt;br /&gt;
&lt;br /&gt;
===安装===&lt;br /&gt;
使用[[pip]]安装：&lt;br /&gt;
 pip install SpeechRecognition&lt;br /&gt;
&lt;br /&gt;
{{了解更多&lt;br /&gt;
|[https://pypi.org/project/SpeechRecognition/ PyPi：SpeechRecognition]&lt;br /&gt;
}}&lt;br /&gt;
==快速入门==&lt;br /&gt;
&lt;br /&gt;
==语音识别引擎==&lt;br /&gt;
SpeechRecognition支持下面的在线或离线的语音识别引擎。&lt;br /&gt;
&lt;br /&gt;
{{了解更多&lt;br /&gt;
|[https://github.com/Uberi/speech_recognition#readme GitHub：SpeechRecognition]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==示例==&lt;br /&gt;
&lt;br /&gt;
===保存音频文件===&lt;br /&gt;
以下示例，通过麦克风录音，保持为音频文件。录音使用到[[PyAudio]]，需要先安装。&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; &amp;gt;&lt;br /&gt;
import speech_recognition as sr&lt;br /&gt;
&lt;br /&gt;
# 从麦克风获取音频&lt;br /&gt;
r = sr.Recognizer()&lt;br /&gt;
with sr.Microphone() as source:&lt;br /&gt;
    print(&amp;quot;可以开始说话了。&amp;quot;)&lt;br /&gt;
    # timeout：指定等待时间（秒），默认None一直等待。&lt;br /&gt;
    # phrase_time_limit：最长输入时间（秒），默认None没有时间限制。&lt;br /&gt;
    audio = r.listen(source, timeout=15, phrase_time_limit=4)&lt;br /&gt;
&lt;br /&gt;
# 存储为wav格式，还可以存储为raw，aiff和flac格式。&lt;br /&gt;
with open(&amp;quot;microphone-results.wav&amp;quot;, &amp;quot;wb&amp;quot;) as f:&lt;br /&gt;
    f.write(audio.get_wav_data())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{了解更多&lt;br /&gt;
|[https://github.com/Uberi/speech_recognition/blob/master/examples/write_audio.py GitHub：speech_recognition/examples/write_audio.py ]&lt;br /&gt;
}}&lt;br /&gt;
==资源==&lt;br /&gt;
===官网===&lt;br /&gt;
*SpeechRecognition 官网： https://github.com/Uberi/speech_recognition&lt;br /&gt;
*PyPi：https://pypi.org/project/SpeechRecognition/&lt;br /&gt;
&lt;br /&gt;
===网站===&lt;br /&gt;
&lt;br /&gt;
===文章===&lt;/div&gt;</summary>
		<author><name>Eric</name></author>
	</entry>
</feed>