<i id='f0H5Q'><tr id='f0H5Q'><dt id='f0H5Q'><q id='f0H5Q'><span id='f0H5Q'><b id='f0H5Q'><form id='f0H5Q'><ins id='f0H5Q'></ins><ul id='f0H5Q'></ul><sub id='f0H5Q'></sub></form><legend id='f0H5Q'></legend><bdo id='f0H5Q'><pre id='f0H5Q'><center id='f0H5Q'></center></pre></bdo></b><th id='f0H5Q'></th></span></q></dt></tr></i><div id='f0H5Q'><tfoot id='f0H5Q'></tfoot><dl id='f0H5Q'><fieldset id='f0H5Q'></fieldset></dl></div>

    1. <legend id='f0H5Q'><style id='f0H5Q'><dir id='f0H5Q'><q id='f0H5Q'></q></dir></style></legend>
        <bdo id='f0H5Q'></bdo><ul id='f0H5Q'></ul>

        <tfoot id='f0H5Q'></tfoot>

        <small id='f0H5Q'></small><noframes id='f0H5Q'>

        在 Python 中打开一个波形文件:未知格式:49. 出了什

        时间:2023-10-08

          <bdo id='kydZW'></bdo><ul id='kydZW'></ul>

          <tfoot id='kydZW'></tfoot>

            1. <i id='kydZW'><tr id='kydZW'><dt id='kydZW'><q id='kydZW'><span id='kydZW'><b id='kydZW'><form id='kydZW'><ins id='kydZW'></ins><ul id='kydZW'></ul><sub id='kydZW'></sub></form><legend id='kydZW'></legend><bdo id='kydZW'><pre id='kydZW'><center id='kydZW'></center></pre></bdo></b><th id='kydZW'></th></span></q></dt></tr></i><div id='kydZW'><tfoot id='kydZW'></tfoot><dl id='kydZW'><fieldset id='kydZW'></fieldset></dl></div>

              <small id='kydZW'></small><noframes id='kydZW'>

                  <tbody id='kydZW'></tbody>

                • <legend id='kydZW'><style id='kydZW'><dir id='kydZW'><q id='kydZW'></q></dir></style></legend>

                • 本文介绍了在 Python 中打开一个波形文件:未知格式:49. 出了什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我尝试使用 wave 模块打开一个波形文件,但无论我尝试什么,都会遇到相同的错误.出现错误的行如下:

                  I try to open a wave file with the wave module, but I keep getting the same error whatever I try. The line with the error is the following:

                  wav = wave.open(f)
                  

                  这是错误信息:

                  Traceback (most recent call last):
                    File "annotate.py", line 47, in <module>
                      play(file)
                    File "annotate.py", line 33, in play
                      wav = wave.open(f)
                    File "C:Program Files (x86)Pythonlibwave.py", line 498, in open
                      return Wave_read(f)
                    File "C:Program Files (x86)Pythonlibwave.py", line 163, in __init__
                      self.initfp(f)
                    File "C:Program Files (x86)Pythonlibwave.py", line 143, in initfp
                      self._read_fmt_chunk(chunk)
                    File "C:Program Files (x86)Pythonlibwave.py", line 269, in _read_fmt_chunk
                      raise Error('unknown format: %r' % (wFormatTag,))
                  wave.Error: unknown format: 49
                  

                  String f 是 .WAV 文件的路径,在我的任何媒体播放器中播放时都可以使用.

                  String f is a path to a .WAV file and it works when played in any of my media players.

                  我当然已经导入了 wave 模块.我尝试将 f 作为相对路径和绝对路径.我尝试用wav"替换WAV".

                  I have of course imported the wave module. I tried f both as a relative and an absolute path. I tried replacing "WAV" by "wav".

                  错误是由什么引起的?

                  推荐答案

                  Python 的 wave 模块适用于特定类型的 WAV:PCM (WAVE_FORMAT_PCM: 0x0001).

                  Python's wave module works with a specific type of WAV: PCM (WAVE_FORMAT_PCM: 0x0001).

                  在您的情况下,您使用的是 WAVE_FORMAT_GSM610 [0x0031 = hex(49)] 类型的 WAV.

                  In your case, you're using a WAV of type WAVE_FORMAT_GSM610 [0x0031 = hex(49)].

                  您可以使用 Audacity 之类的程序或一些库来转换编解码器以更改 WAV 文件的类型.

                  You can use a program like Audacity or some lib for converting codecs to change the type of the WAV file.

                  您可以在此处查看 WAV 类型列表:https://www.videolan.org/developers/vlc/doc/doxygen/html/vlc__codecs_8h.html

                  You can see a list of WAV types here: https://www.videolan.org/developers/vlc/doc/doxygen/html/vlc__codecs_8h.html

                  Python的wave模块源码:https://github.com/python/cpython/blob/master/Lib/wave.py

                  Python's wave module source code: https://github.com/python/cpython/blob/master/Lib/wave.py

                  这篇关于在 Python 中打开一个波形文件:未知格式:49. 出了什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 Python 中的数字列表中添加前导零 下一篇:在 Python 中将变量的每一项打印在单独的行上

                  相关文章

                  最新文章

                • <small id='Ndsz8'></small><noframes id='Ndsz8'>

                • <legend id='Ndsz8'><style id='Ndsz8'><dir id='Ndsz8'><q id='Ndsz8'></q></dir></style></legend>

                  <i id='Ndsz8'><tr id='Ndsz8'><dt id='Ndsz8'><q id='Ndsz8'><span id='Ndsz8'><b id='Ndsz8'><form id='Ndsz8'><ins id='Ndsz8'></ins><ul id='Ndsz8'></ul><sub id='Ndsz8'></sub></form><legend id='Ndsz8'></legend><bdo id='Ndsz8'><pre id='Ndsz8'><center id='Ndsz8'></center></pre></bdo></b><th id='Ndsz8'></th></span></q></dt></tr></i><div id='Ndsz8'><tfoot id='Ndsz8'></tfoot><dl id='Ndsz8'><fieldset id='Ndsz8'></fieldset></dl></div>
                    <bdo id='Ndsz8'></bdo><ul id='Ndsz8'></ul>
                    <tfoot id='Ndsz8'></tfoot>