Ubuntu系统下安装Yaafe工具
Yaafe官方安装教程: http://yaafe.sourceforge.net/manual/install.html
1.安装常用工具
sudo apt-get install git
sudo apt-get install zsh
sudo apt-get install curl
sudo apt-get install python-pip
sudo apt-get install cmake-qt-gui
sudo apt-get install g++
注意 git安装可能会报错,git : Depends: liberror-perl but it is not installable
解决方法,输入以下命令,重新安装常用工具即可:
sudo apt-get updata
sudo apt-get upgrade
sudo apt-get install -f
问题:如果出现E:unable to locate package,需要更新源,更新到/etc/apt/source.list,然后再sudo apt-get update
打开source.list文件添加保存以下内容:
#deb cdrom:[Ubuntu 14.04 LTS _Trusty Tahr_ - Release amd64 (20140417)]/ trusty main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty universe
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
deb http://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu trusty partner
# deb-src http://archive.canonical.com/ubuntu trusty partner
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu trusty main
deb-src http://extras.ubuntu.com/ubuntu trusty main
相关链接,传送门:http://bbs.csdn.net/topics/390889987
2. Yaafe获取
mkdir Yaafe
cd Yaafe
git clone https://github.com/Yaafe/Yaafe.git
yaafe使用git的submodule功能来管理它的依赖代码(Eigen)
git submodule init
git submodule update
运行后,Yaafe/exterals/eigen文件夹下会有内容;若无法获取尝试直接下载覆盖:http://pan.baidu.com/s/1jHJcgke
3.下载Yaafe依赖
sudo apt-get install cmake cmake-curses-gui libargtable2-0 libargtable2-dev libsndfile1 libsndfile1-dev libmpg123-0 libmpg123-dev libfftw3-3 libfftw3-dev liblapack-dev libhdf5-serial-dev libhdf5-7:i386 libhdf5-7
4.安装Yaafe
mkdir build
cd build
命令输入:cmake-gui
点击generate实施,成功后关闭图形化界面。
问题:出现error:,下方的白色运行框里寻找问题原因:cannot find hdf5 library
解决方法: 文件搜索 libhdf5.os,找到存放地址
在图形化界面的红色框里,将Name对应HDF5相关的几个变量值修改,
以我自己的为例:
HDF5_HL_LIBRARY /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_hl.os
此条搜索hdf5.h文件, HDF5_INCLUDE_DIR /usr/include/hdf5/serial
HDF5_LIARARY /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.os
修改后重新generate后,界面应该不报错并变成白色。
在build文件夹下命令输入
make
make install
不报错,就是安装成功。
配置环境
export YAAFE_PATH=$INSTALL_DIR/yaafe_extensions
export LD_LIBRARY_PATH=/usr/local/lib
测试Test.py
from yaafelib import *
import sys
def getFeature(path):
fp = FeaturePlan(sample_rate=44100, resample=True, time_start=20,time_limit=40)
fp.addFeature("energy: Energy")
df = fp.getDataFlow()
engine = Engine()
engine.load(df)
afp = AudioFileProcessor()
afp.processFile(engine, path)
features = engine.readAllOutputs()
energy = features.get('energy')
energyMean=energy.mean(axis=0)
energyVar =energy.var(axis=0)
print energyMean[0]
print energyVar[0]
return
if __name__ == '__main__':
path='/home/Downloadsong/5646.mp3'
getFeature(path)
from yaafelib import *
import sys
def getFeature(path):
fp = FeaturePlan(sample_rate=44100, resample=True, time_start=20,time_limit=40)
fp.addFeature("energy: Energy")
df = fp.getDataFlow()
engine = Engine()
engine.load(df)
afp = AudioFileProcessor()
afp.processFile(engine, path)
features = engine.readAllOutputs()
energy = features.get('energy')
energyMean=energy.mean(axis=0)
energyVar =energy.var(axis=0)
print energyMean[0]
print energyVar[0]
return
if __name__ == '__main__':
#print sys.path
path='/home/jason/gra/music/test/rock/nono.mp3'
getFeature(path)
path路径换成你的MP3文件的存储路径即可
问题:error出现no numpy
解决方法:安装
sudo apt-get install build-essential python-dev python-numpy python-setuptools python-scipy libatlas-dev libatlas3-base
sudo apt-get install python-matplotlib
sudo apt-get install python-pip
pip install -U scikit-learn
sudo apt-get install python-numpy
sudo apt-get install python-scipy
sudo apt-get install python-matplotlib
sudo apt-get install python-pandas
sudo apt-get install python-sklearn
相关链接传送门:http://blog.csdn.net/sdhfaka/article/details/22040527
http://blog.csdn.net/Yakumoyukarilan/article/details/51340358
安装参考博客: http://blog.csdn.net/chen0ming123/article/details/50929841