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

📄 csdn技术中心 wave 文件采样率转换.htm

📁 音频采样率转换相关
💻 HTM
📖 第 1 页 / 共 3 页
字号:
                  Blog </TD></TR>
              <TR>
                <TD align=middle bgColor=#003399 height=16><FONT 
                  color=#ffffff>关键字</FONT></TD>
                <TD width=500>&nbsp; <SPAN 
                  id=ArticleTitle1_ArticleTitle1_lblKeywords>音频</SPAN></TD></TR>
              <TR>
                <TD align=middle bgColor=#003399 height=16><FONT 
                  color=#ffffff>出处</FONT></TD>
                <TD>&nbsp; <SPAN 
                  id=ArticleTitle1_ArticleTitle1_lblSource></SPAN></TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD width=10></TD>
          <TD><SPAN id=ArticleContent1_ArticleContent1_lblContent>&nbsp; 
            <P class=MsoNormal><SPAN lang=EN-US>Wave</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">格式音频文件采样率转换</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN-LEFT: 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN 
            lang=EN-US 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一、</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">此转换方法为文件转换方式,需要对现在的文件分析的基础上生成新的音频文件。</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN-LEFT: 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN 
            lang=EN-US 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">二、</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法占用时间比较多,但速度在允许范围之内</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN-LEFT: 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN 
            lang=EN-US 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">三、</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">分析文件与写入新文件的时候是按字节操作</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN-LEFT: 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><SPAN 
            lang=EN-US 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">四、</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">本方法转换生成的新文件的精度只能为</SPAN><SPAN 
            lang=EN-US>16</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">位,如果需要其他的精度,需要另外进行精度转换。</SPAN></P>
            <P class=MsoNormal><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">操作流程:</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN-LEFT: 18pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo2; tab-stops: list 18.0pt"><SPAN 
            lang=EN-US 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一、</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">分析源文件的头结构,取得源文件的采样率、声道数、数据长度、数据流量等参数。</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN-LEFT: 18pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo2; tab-stops: list 18.0pt"><SPAN 
            lang=EN-US 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">二、</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">根据文件头结构生成新文件的头结构,确定各项参数,其中采样率由用户自行指定。</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN-LEFT: 18pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo2; tab-stops: list 18.0pt"><SPAN 
            lang=EN-US 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">三、</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">根据源文件的采样率与声道数确定转换的循环次数。</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN-LEFT: 18pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo2; tab-stops: list 18.0pt"><SPAN 
            lang=EN-US 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">四、</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对源文件的语音数据进行获取与转换,转换公式:</SPAN></P>
            <P class=MsoNormal style="TEXT-INDENT: 18pt"><SPAN 
            lang=EN-US>(((itmp &lt;&lt;8)+itmp)-32768) &lt;&lt; 16</SPAN></P>
            <P class=MsoNormal style="TEXT-INDENT: 18pt"><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其中,</SPAN><SPAN 
            lang=EN-US>itmp</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为取得的双字节数据。</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN-LEFT: 18pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo2; tab-stops: list 18.0pt"><SPAN 
            lang=EN-US 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">五、</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将转换后的数据传给需要写入的文件,再次进行转换,公式如下:</SPAN></P>
            <P class=MsoNormal style="MARGIN-LEFT: 18pt"><SPAN 
            lang=EN-US>1</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN 
            lang=EN-US>c = (((c + 0x80000000) &gt;&gt; 16) &amp; 0xFFFF) ^ 
            0x8000;</SPAN></P>
            <P class=MsoNormal style="MARGIN-LEFT: 18pt"><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其中</SPAN><SPAN 
            lang=EN-US>c</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为传入的采样率数据</SPAN></P>
            <P class=MsoNormal style="MARGIN-LEFT: 18pt"><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">需要将上面转换的数据进行字节转换,公式如下:</SPAN></P>
            <P class=MsoNormal style="MARGIN-LEFT: 18pt"><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第一个字节</SPAN><SPAN 
            lang=EN-US>c&amp;0xFF</SPAN></P>
            <P class=MsoNormal style="MARGIN-LEFT: 18pt"><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第二个字节</SPAN><SPAN 
            lang=EN-US>c&gt;&gt;8</SPAN></P>
            <P class=MsoNormal style="MARGIN-LEFT: 18pt"><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将第一字节与第二字节依次写入新生成的文件</SPAN><SPAN 
            lang=EN-US>.</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN-LEFT: 18pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo2; tab-stops: list 18.0pt"><SPAN 
            lang=EN-US 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">六、</SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对源文件与目标文件进行循环操作,只到源文件末尾。</SPAN></P></SPAN><BR>
            <DIV 
            style="FONT-SIZE: 14px; LINE-HEIGHT: 25px"><STRONG>作者Blog:</STRONG><A 
            id=ArticleContent1_ArticleContent1_AuthorBlogLink 
            href="http://blog.csdn.net/WhiteCloud/" 
            target=_blank>http://blog.csdn.net/WhiteCloud/</A></DIV>
            <DIV 
            style="FONT-SIZE: 14px; COLOR: #900; LINE-HEIGHT: 25px"><STRONG>相关文章</STRONG></DIV>
            <TABLE id=ArticleContent1_ArticleContent1_RelatedArticles 
            cellSpacing=0 border=0>
              <TBODY>
              <TR>
                <TD><A href="http://dev.csdn.net/article/09/09788.shtm">wave 
                  文件采样率转换</A> </TD></TR>
              <TR>
                <TD><A 
                  href="http://dev.csdn.net/article/09/09783.shtm">windows音频处理</A> 
                </TD></TR>
              <TR>
                <TD><A 
                  href="http://dev.csdn.net/article/09/09782.shtm">声音文件介绍</A> 
              </TD></TR>
              <TR>
                <TD><A 
                  href="http://dev.csdn.net/article/09/09780.shtm">wave函数介绍</A> 
                </TD></TR>
              <TR>
                <TD><A 
                  href="http://dev.csdn.net/article/09/09779.shtm">vc编辑wave音频文件</A> 
                </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><A name=#Comment></A>
      <TABLE cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD>
            <TABLE cellSpacing=0 cellPadding=0 width="100%" align=center 
            bgColor=#006699 border=0>
              <TBODY>
              <TR bgColor=#006699>
                <TD id=white align=middle width=556 bgColor=#006699><FONT 
                  color=#ffffff>对该文的评论</FONT> </TD></TR></TBODY></TABLE>
            <TABLE cellSpacing=1 cellPadding=2 width="100%" align=center 
            bgColor=#666666 border=0>
              <TBODY>
              <TR>
                <TD bgColor=#cccccc colSpan=3><SPAN 
                  style="COLOR: #990000"><IMG height=16 hspace=1 src="" 
                  width=16> </SPAN><SPAN 
                  id=CommnetList1_CommnetList1_rpCommentList__ctl0_lblUserName>sender</SPAN> 
                  <I>( <SPAN 
                  id=CommnetList1_CommnetList1_rpCommentList__ctl0_lblPostTime>2001-08-21</SPAN>)</I> 
                </TD></TR>
              <TR>
                <TD width=532 bgColor=#ffffff colSpan=3><SPAN 
                  id=CommnetList1_CommnetList1_rpCommentList__ctl0_lblContent>这种方法保真度太低,连线性插值都比不上。<BR>还是先去看看SOX里面的转换方法吧。</SPAN> 
                </TD></TR></TBODY></TABLE>
            <DIV align=right><A id=CommnetList1_CommnetList1_Morelink 
            href="http://comment.csdn.net/Comment.aspx?c=2&amp;s=9788">【评论】</A> 
            <A id=CommnetList1_CommnetList1_Hyperlink1 
            href="javascript:window.close();">【关闭】</A> <A 
            href="mailto:webmaster@csdn.net">【报告bug】</A> 
      </DIV><BR></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></FORM><!-- 版权 -->
<DIV align=center>
<SCRIPT language=JavaScript src="CSDN技术中心 wave 文件采样率转换.files/footer_gb.js" 
type=text/javascript></SCRIPT>
</DIV><!-- /版权 -->
<SCRIPT>
      document.write("<img src=http://count.csdn.net/count/pageview1.asp?columnid=4&itemid=11 border=0 width=0 height=0>");
    </SCRIPT>

<SCRIPT>document.write("<img src=http://counter.csdn.net/pv.aspx?id=37 border=0 width=0 height=0>");</SCRIPT>

<SCRIPT language=JavaScript src=""></SCRIPT>
</BODY></HTML>

⌨️ 快捷键说明

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