如何在不使用 Aubio 的情况下获得 .wav 文件的平均音高?
Posted
技术标签:
【中文标题】如何在不使用 Aubio 的情况下获得 .wav 文件的平均音高?【英文标题】:How to get the average pitch of a .wav file without using Aubio? 【发布时间】:2020-07-13 01:51:50 【问题描述】:所以,我正在开发一个程序来比较不同 .wav 文件的平均音高。我找到了一个解决方案,它使用 aubio 在 repl.it 上工作,但由于某种原因,每次我这样做
pip install aubio
它给出了大约 50 条红线错误。关于车轮构造的一些东西不起作用。那么,有没有什么办法可以在没有 aubio 的情况下做到这一点?
这是我的错误信息:
C:\Users\GUNDERSON\Desktop\Tourretty>pip3.8 install aubio
Collecting aubio
Using cached aubio-0.4.9.tar.gz (479 kB)
Requirement already satisfied: numpy in c:\users\gunderson\appdata\local\programs\python\python38-32\lib\site-packages (from aubio) (1.19.0)
Building wheels for collected packages: aubio
Building wheel for aubio (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\gunderson\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\GUNDERSON\\AppData\\Local\\Temp\\pip-install-7tmi21r0\\aubio\\setup.py'"'"'; __file__='"'"'C:\\Users\\GUNDERSON\\AppData\\Local\\Temp\\pip-install-7tmi21r0\\aubio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\GUNDERSON\AppData\Local\Temp\pip-wheel-6_sc7w7f'
cwd: C:\Users\GUNDERSON\AppData\Local\Temp\pip-install-7tmi21r0\aubio\
Complete output (32 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-3.8
creating build\lib.win32-3.8\aubio
copying python\lib\aubio\cmd.py -> build\lib.win32-3.8\aubio
copying python\lib\aubio\cut.py -> build\lib.win32-3.8\aubio
copying python\lib\aubio\midiconv.py -> build\lib.win32-3.8\aubio
copying python\lib\aubio\slicing.py -> build\lib.win32-3.8\aubio
copying python\lib\aubio\__init__.py -> build\lib.win32-3.8\aubio
running build_ext
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
checking for aubio = 0.4.9
Running "pkg-config --libs --cflags aubio = 0.4.9" failed: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
Info: aubio 0.4.9 was not found by pkg-config
Info: looking for *optional* additional packages
checking for libavcodec
Running "pkg-config --libs --cflags libavcodec" failed: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
checking for libavformat
Running "pkg-config --libs --cflags libavformat" failed: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
checking for libavutil
Running "pkg-config --libs --cflags libavutil" failed: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
checking for libswresample
Running "pkg-config --libs --cflags libswresample" failed: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
checking for libavresample
Running "pkg-config --libs --cflags libavresample" failed: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
checking for sndfile
Running "pkg-config --libs --cflags sndfile" failed: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
checking for samplerate
Running "pkg-config --libs --cflags samplerate" failed: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
Info: libaubio was not installed or built locally with waf, adding src/
----------------------------------------
ERROR: Failed building wheel for aubio
Running setup.py clean for aubio
Failed to build aubio
Installing collected packages: aubio
Running setup.py install for aubio ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\gunderson\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\GUNDERSON\\AppData\\Local\\Temp\\pip-install-7tmi21r0\\aubio\\setup.py'"'"'; __file__='"'"'C:\\Users\\GUNDERSON\\AppData\\Local\\Temp\\pip-install-7tmi21r0\\aubio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\GUNDERSON\AppData\Local\Temp\pip-record-nxsy7j61\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\gunderson\appdata\local\programs\python\python38-32\Include\aubio'
cwd: C:\Users\GUNDERSON\AppData\Local\Temp\pip-install-7tmi21r0\aubio\
Complete output (24 lines):
running install
running build
running build_py
running build_ext
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
checking for aubio = 0.4.9
Running "pkg-config --libs --cflags aubio = 0.4.9" failed: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
Info: aubio 0.4.9 was not found by pkg-config
Info: looking for *optional* additional packages
checking for libavcodec
Running "pkg-config --libs --cflags libavcodec" failed: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
checking for libavformat
Running "pkg-config --libs --cflags libavformat" failed: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
checking for libavutil
Running "pkg-config --libs --cflags libavutil" failed: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
checking for libswresample
Running "pkg-config --libs --cflags libswresample" failed: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
checking for libavresample
Running "pkg-config --libs --cflags libavresample" failed: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
checking for sndfile
Running "pkg-config --libs --cflags sndfile" failed: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
checking for samplerate
Running "pkg-config --libs --cflags samplerate" failed: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None)
Info: libaubio was not installed or built locally with waf, adding src/
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\gunderson\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\GUNDERSON\\AppData\\Local\\Temp\\pip-install-7tmi21r0\\aubio\\setup.py'"'"'; __file__='"'"'C:\\Users\\GUNDERSON\\AppData\\Local\\Temp\\pip-install-7tmi21r0\\aubio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\GUNDERSON\AppData\Local\Temp\pip-record-nxsy7j61\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\gunderson\appdata\local\programs\python\python38-32\Include\aubio' Check the logs for full command output.
一些附加信息:
我正在使用最新版本的 Python 3 我正在使用 Windows 我确保让安装程序安装路径变量 PIP 已安装 当我用更新命令检查 Wheel 版本时,它说它已经是最新版本了。【问题讨论】:
嘿,欢迎!你能分享错误信息吗?也许那里有一些可以指出解决方案的东西,有人会发现它很有用。 我进行了修改并添加了错误 【参考方案1】:您不应该只是尝试使用 pip 命令,因为它并没有真正构建文件。
Step 1) 下载aubio 的tar.gz。最新版本为 0.4.9,请务必下载。
步骤 2) 提取 tar.gz
第 3 步)转到您的命令提示符/终端并 cd 进入提取创建的文件夹。
步骤 4) 执行 python ./waf 配置命令提示符。这使您的文件准备好进行配置。确保已经有 C++ 编译器。我使用了 Visual Studio 的 MSVC。接下来,在命令提示符下执行 python ./waf build。
第 5 步)您现在应该可以毫无问题地执行 pip install aubio,并且它应该可以正确安装到您的计算机上。
【讨论】:
以上是关于如何在不使用 Aubio 的情况下获得 .wav 文件的平均音高?的主要内容,如果未能解决你的问题,请参考以下文章
如何在不使用 java 的 math.pow 的情况下获得指数