Audiolab是一个使用numpy数组的音频文件IO的python包。它支持许多不同的音频格式,包括wav,aiff,au,flac,ogg,htk。它还支持输出到音频设备(仅限Mac OS X和Linux)。
为简单起见,提供了类似matlab的API,用于简单的导入/导出; 还提供更完整的API。
pip install scikits.audiolab
提示报错
[root@localhost audiolab]# pip install scikits.audiolab -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
Looking in indexes: http://pypi.douban.com/simple
Collecting scikits.audiolab
Downloading http://pypi.doubanio.com/packages/b0/d8/d9babf3e4fa3ac8094e1783415bf60015a696779f4da4c70ae6141aa5e3a/scikits.audiolab-0.11.0.tar.gz (892kB)
|████████████████████████████████| 901kB 1.3MB/s
ERROR: Command errored out with exit status 1:
command: /root/anaconda3/envs/speechvalley/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kuux06xf/scikits.audiolab/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kuux06xf/scikits.audiolab/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /tmp/pip-install-kuux06xf/scikits.audiolab/
Complete output (49 lines):
SndfileInfo:
customize UnixCCompiler
libraries sndfile not found in /root/anaconda3/envs/speechvalley/lib
customize UnixCCompiler
libraries sndfile not found in /usr/local/lib64
customize UnixCCompiler
libraries sndfile not found in /usr/local/lib
customize UnixCCompiler
libraries sndfile not found in /usr/lib64
customize UnixCCompiler
libraries sndfile not found in /usr/lib
customize UnixCCompiler
libraries sndfile not found in /usr/lib/
Traceback (most recent call last):
File "scikits/audiolab/pysndfile/setup.py", line 20, in configuration
sf_config = sf_info.get_info(2)
File "/root/anaconda3/envs/speechvalley/lib/python3.5/site-packages/numpy/distutils/system_info.py", line 645, in get_info
raise self.notfounderror(self.notfounderror.__doc__)
numpy.distutils.system_info.NotFoundError: Some third-party program or library is not found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-kuux06xf/scikits.audiolab/setup.py", line 85, in
classifiers=CLASSIFIERS)
File "/root/anaconda3/envs/speechvalley/lib/python3.5/site-packages/numpy/distutils/core.py", line 137, in setup
config = configuration()
File "/tmp/pip-install-kuux06xf/scikits.audiolab/setup.py", line 71, in configuration
config.add_subpackage(DISTNAME)
File "/root/anaconda3/envs/speechvalley/lib/python3.5/site-packages/numpy/distutils/misc_util.py", line 1036, in add_subpackage
caller_level = 2)
File "/root/anaconda3/envs/speechvalley/lib/python3.5/site-packages/numpy/distutils/misc_util.py", line 1005, in get_subpackage
caller_level = caller_level + 1)
File "/root/anaconda3/envs/speechvalley/lib/python3.5/site-packages/numpy/distutils/misc_util.py", line 942, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "scikits/audiolab/setup.py", line 10, in configuration
confgr.add_subpackage('pysndfile')
File "/root/anaconda3/envs/speechvalley/lib/python3.5/site-packages/numpy/distutils/misc_util.py", line 1036, in add_subpackage
caller_level = 2)
File "/root/anaconda3/envs/speechvalley/lib/python3.5/site-packages/numpy/distutils/misc_util.py", line 1005, in get_subpackage
caller_level = caller_level + 1)
File "/root/anaconda3/envs/speechvalley/lib/python3.5/site-packages/numpy/distutils/misc_util.py", line 942, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "scikits/audiolab/pysndfile/setup.py", line 25, in configuration
site.cfg file, in section [sndfile].""")
numpy.distutils.system_info.NotFoundError: sndfile (http://www.mega-nerd.com/libsndfile/) library not found.
Directories to search for the libraries can be specified in the
site.cfg file, in section [sndfile].
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
提示需要安装sndfile。
下载audiolab:
# wget https://files.pythonhosted.org/packages/b0/d8/d9babf3e4fa3ac8094e1783415bf60015a696779f4da4c70ae6141aa5e3a/scikits.audiolab-0.11.0.tar.gz
解压后通过python3 setup.py install安装出错,也是提示没有找到sndfile
下载libsndfile
#wget http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28.tar.gz
解压并安装:
# tar xzvf libsndfile-1.0.28.tar.gz
# cd libsndfile-1.0.28
# .configure
# make
# make install
centos下的site.cfg文件:
[root@localhost audiolab]# cat site.cfg
[sndfile]
include_dirs = /usr/local/include
library_dirs = /usr/local/lib/
sndfile_libs = sndfile
Ubuntu下的site.cfg文件:
[sndfile]
include_dirs = /usr/include
library_dirs = /usr/lib/x86_64-linux-gnu/
sndfile_libs = sndfile
在audiolab目录下,再次执行python setup.py install 可以了。
audiolab官网:
http://cournape.github.io/audiolab/
libsndfile官网:
http://www.mega-nerd.com/libsndfile