⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 audio_ostream.aspx.htm

📁 识别语音的C代码! 还有教程说明.大家自己看看吧!
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<div class="MI" id="Section60"><a href="http://www.codeproject.com/KB/books/">Book Chapters</a></div>
<div class="MI" id="Section61"><a href="http://www.codeproject.com/KB/book-reviews/">Book Reviews</a></div>
<div class="MI" id="Section109"><a href="http://www.codeproject.com/KB/hardware-review/">Hardware Reviews</a></div>
<div class="MI" id="Section63"><a href="http://www.codeproject.com/KB/interviews/">Interviews</a></div>
<div class="MI" id="Section62"><a href="http://www.codeproject.com/KB/scrapbook/">Scrapbook</a></div>
<div class="MI" id="Section48"><a href="http://www.codeproject.com/KB/system/">Hardware &amp; System</a></div>
</div>
<div class="MenuChapter"><a href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=12" onclick="return ToggleMenu('Chapter12');">Third Party Products</a></div>
<div class="MenuSectionBlock" id="Chapter12" style="display: none;">
<div class="MI" id="Section65"><a href="http://www.codeproject.com/KB/showcase/">Product Showcase</a></div>
<div class="MI" id="Section124"><a href="http://www.codeproject.com/KB/solution-center/">Solution Center</a></div>
</div>
</div>
<br>
<div class="MenuCat">Feature Zones</div>
<div class="MenuChapter"><a href="http://www.codeproject.com/Zones/IBM">IBM DeveloperWorks</a></div>
<div class="MenuChapter"><a href="http://www.codeproject.com/Zones/WhitePapers">WhitePapers</a></div>
<div class="MenuChapter"><a href="http://www.codeproject.com/Zones/CodeGeneration">Code Generation</a></div>
<div class="MenuChapter"><a href="http://www.codeproject.com/Zones/QuestSQL">Quest SQL Zone</a></div>
<br>

			
			<iframe src="audio_ostream.aspx_files/ServeThirdParty_003.htm" scrolling="no" width="160" frameborder="0" height="600"></iframe>		
			<img src="audio_ostream.aspx_files/t.gif" alt="" width="160" height="1">
		</td>
		<td class="ArticlePane" valign="top">

			
<table class="SearchHeaderBar" width="100%" cellspacing="0">
<tbody><tr>
<td style="white-space: nowrap; width: 60%;" valign="middle" align="right">
<form method="get" action="/info/search.aspx" name="Search" style="margin: 0pt;">
<b>Search &nbsp;</b>
<input class="SmallText" name="artkw" style="width: 200px;">
<select class="SmallText" style="font-weight: bold;" name="sbo">
<option value="kw">Articles</option>
<!--<option value="au">Authors</option>-->
<option value="fm">Messages</option>
</select>
<input class="SmallText" style="font-weight: bold;" value=" Go! " type="submit"> &nbsp;
</form>
</td>

<td class="TinyText" style="white-space: nowrap;">
<a href="http://www.codeproject.com/info/search.aspx">Advanced Search</a><br>
<a href="http://www.codeproject.com/script/Content/SiteMap.aspx">Sitemap</a>

</td>
</tr>
</tbody></table>

			<span id="ctl00_ResultMessage"></span>
			
			<div id="ctl00_ArtDiv">
			<table width="100%" border="0" cellpadding="0" cellspacing="0">	
			<tbody><tr valign="top">
				<td valign="top">
				    
<table>

</table>



					
<div class="SmallText" style="white-space: nowrap;">
<img src="audio_ostream.aspx_files/print.gif" alt="print" style="vertical-align: middle;" width="16" height="16">
<a id="ctl00_ArticleHeaderLinks_PrintLnk" href="http://www.codeproject.com/KB/audio-video/audio_ostream.aspx?display=Print">Print</a> &nbsp;

<img src="audio_ostream.aspx_files/report.gif" alt="Broken Article?" style="vertical-align: middle;" width="16" height="16">
<a id="ctl00_ArticleHeaderLinks_BrokenLnk" href="http://www.codeproject.com/script/Articles/Report.aspx?aid=17897">Report Article</a> &nbsp;

 &nbsp;
 &nbsp;

<img src="audio_ostream.aspx_files/discuss.gif" alt="Discuss" style="vertical-align: middle;" width="15" height="16">
<a href="#_comments">Discuss</a> &nbsp;

<img src="audio_ostream.aspx_files/mail.gif" alt="Recommend Article" style="vertical-align: middle;" width="16" height="16">
<a id="ctl00_ArticleHeaderLinks_Recommend" href="http://www.codeproject.com/script/common/TellFriend.aspx?obtid=2&amp;obid=17897">Send to a friend</a>	
</div>
				</td>
				<td style="text-align: right; white-space: nowrap; width: 100px;">
				<table id="CurRat"><tbody><tr><td>            
<table><tbody><tr>
<td style="white-space: nowrap;" class="SmallText" align="right"> 
<span id="ctl00_ArticleRating_VoteLabel">19 votes for this Article.</span></td>
<td><table border="1" cellpadding="0" cellspacing="0">
			<tbody><tr>
				<td width="20" bgcolor="White" height="7"><img src="audio_ostream.aspx_files/red.gif" width="20" align="center" border="0" height="7"></td>
				<td width="20" bgcolor="White" height="7"><img src="audio_ostream.aspx_files/red.gif" width="20" align="center" border="0" height="7"></td>
				<td width="20" bgcolor="White" height="7"><img src="audio_ostream.aspx_files/red.gif" width="20" align="center" border="0" height="7"></td>
				<td width="20" bgcolor="White" height="7"><img src="audio_ostream.aspx_files/red.gif" width="20" align="center" border="0" height="7"></td>
				<td width="20" bgcolor="White" height="7" nowrap="nowrap"><img src="audio_ostream.aspx_files/red.gif" width="16" align="center" border="0" height="7"></td>
			</tr>
		</tbody></table>
		</td>
</tr>
<tr id="ctl00_ArticleRating_PopularityRow">
			<td colspan="2" class="SmallText" align="right">
<a id="ctl00_ArticleRating_PopularityLnk" title="Calculated as rating x Log10(# votes)" href="http://www.codeproject.com/script/Articles/TopArticles.aspx?ta_so=1">Popularity: 6.11</a>
<span id="ctl00_ArticleRating_PopularityLbl"></span><span id="ratingVal">Rating: <b>4.78</b> out of 5</span></td>
		</tr>
		
</tbody></table>



</td>
				<td>            
<div>
<table class="HistTable" title="Voting Distribution. Recent data only"><tbody><tr><td><img src="audio_ostream.aspx_files/t.htm" alt="0 votes, 0.0%" title="0 votes, 0.0%" width="10" border="0" height="1"><br>1</td>
<td><img src="audio_ostream.aspx_files/t.htm" alt="0 votes, 0.0%" title="0 votes, 0.0%" width="10" border="0" height="1"><br>2</td>
<td><img src="audio_ostream.aspx_files/pollcol.gif" alt="2 votes, 10.5%" title="2 votes, 10.5%" width="10" border="0" height="2"><br>3</td>
<td><img src="audio_ostream.aspx_files/pollcol.gif" alt="1 vote, 5.3%" title="1 vote, 5.3%" width="10" border="0" height="1"><br>4</td>
<td><img src="audio_ostream.aspx_files/pollcol.gif" alt="16 votes, 84.2%" title="16 votes, 84.2%" width="10" border="0" height="20"><br>5</td>
</tr></tbody></table>
</div>



</td></tr></tbody></table>
				</td>
			</tr>
			</tbody></table>
			
			
			
			
						
			
			
			
			
			
			
			
			
			<span id="intelliTXT">
			<div id="contentdiv">
			
			<!-- Main Page Contents Start -->
			

<!-- Article Starts -->

<ul class="download">
<li><a href="http://www.codeproject.com/KB/audio-video/audio_ostream/audio_ostream_demo.zip">Download demo project - 3.3 Kb </a></li>

<li><a href="http://www.codeproject.com/KB/audio-video/audio_ostream/audio_ostream_src.zip">Download source - 1.1 Kb</a> </li>
</ul>

<p><img src="audio_ostream.aspx_files/audio_ostream.png" alt="Screenshot - audio_ostream.png" width="206" height="200"></p>

<h2>Introduction</h2>

<p>In this article I'll show you how to add Text-to-Speech (TTS) capabilities to your program.</p>

<p>You'll be able to do it with, essentially, 1 line of code, using the familiar standard <code>ostream</code> syntax.</p>

<p>Additionally, I'll show how using open source C++ tools can make
your code short (my whole code is less than 50 lines), reliable, more
robust and more general than the original APIs.</p>

<p>What I'll show:</p>

<ul>
<li>How to add simple TTS to your program. </li>

  <li>A simple use of <a href="http://synesis.com.au/software/comstl/">COMSTL</a> 
    and various other <a href="http://synesis.com.au/software/stlsoft/">STLSoft</a> 
    components. </li>

<li>A simple example of how to use <a href="http://www.boost.org/libs/iostreams/doc/index.html">boost::iostreams</a> </li>
</ul>

<h2>Background</h2>

<p>I recently had to add audio outputs to a program (running on Windows).</p>

<p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=5e86ec97-40a7-453f-b0ee-6583171b4530&amp;DisplayLang=en">Microsoft's SAPI SDK</a>
provides a COM interface through which wide character strings can be
spoken via SAPI's TTS engine. The Code Project has many articles
explaining how to use SAPI to varying degrees of complexity. So why
another?</p>

<p>Well, there were some additional features that I wanted that did not exist in those articles.</p>

<ol>
<li>As little or no COM hassle. Ideally, it should work within the simplest Console application. </li>

<li>Full (transparent) support for types other than wide-char. e.g. <code><span class="code-keyword">char</span>*</code>, <code>std::<span class="code-SDKkeyword">string</span></code>s and even <code><span class="code-keyword">int</span></code>s, <code><span class="code-keyword">float</span></code>s, etc. </li>

<li>Intuitive (or at least familiar) syntax </li>
</ol>

<p>To achieve these goals I developed <code>audio_ostream</code>.</p>

<p><code>audio_ostream</code> is a full-fledged <code>std::ostream</code> which supports any type that has an <code><span class="code-keyword">operator</span><span class="code-keyword">&lt;</span><span class="code-keyword">&lt;</span>()</code>.</p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -