近期要做一个音乐相关的client。当中一个功能是音乐识别。搜索了一些资料选择Echoprint来开发。Echoprint是开源免费的,并且多种client都支持能节约非常多时间,今天主要下载和编译源代码以及測试。
(备注:我的开发环境是Mac,所以以下以及之后都是Mac的环境)
1、官网
官网地址:http://echoprint.me
2、安装依赖环境
- 首先安装HomeBrew
- 安装依赖库
brew install ffmpeg boost taglib
安装的文件夹都在/usr/local/Cellar
3、下载源代码
git clone -b release-4.12 git://github.com/echonest/echoprint-codegen.git
adsl-172-10-1-12:~ zhangjie$ cd echoprint-codegen
adsl-172-10-1-12:echoprint-codegen zhangjie$ cd src/
adsl-172-10-1-12:src zhangjie$ vim Makefile
改动当中变量BOOST_CFLAGS为你当前安装的boost文件夹BOOST_CFLAGS=-I/usr/local/Cellar/boost/1.58.0/include
改动34 libcodegen: $(MODULES_LIB)
35 ifeq ($(UNAME),Darwin)
36 libtool -dynamic -flat_namespace -install_name libcodegen.$(VERSION).dylib -lSystem -compatibility_version $(VERSION_COMPAT)
37 -macosx_version_min 10.6 -current_version $(VERSION) -o libcodegen.$(VERSION).dylib -undefined suppress
38 $(MODULES_LIB) -framework vecLib -framework Accelerate
39 else
40 $(CXX) -shared -fPIC -Wl,-soname,$(SONAME) -o $(LIBNAME).$(VERSION) $(MODULES_LIB) -lz
41 endif
假设38行中有-framework vecLib则去掉变为例如以下:
34 libcodegen: $(MODULES_LIB)
35 ifeq ($(UNAME),Darwin)
36 libtool -dynamic -flat_namespace -install_name libcodegen.$(VERSION).dylib -lSystem -compatibility_version $(VERSION_COMPAT)
37 -macosx_version_min 10.6 -current_version $(VERSION) -o libcodegen.$(VERSION).dylib -undefined suppress
38 $(MODULES_LIB) -framework Accelerate
39 else
40 $(CXX) -shared -fPIC -Wl,-soname,$(SONAME) -o $(LIBNAME).$(VERSION) $(MODULES_LIB) -lz
41 endif
4、编译
adsl-172-10-1-12:src zhangjie$ vim Makefile
adsl-172-10-1-12:src zhangjie$ make
g++ -Wall -I/usr/local/Cellar/boost/1.58.0/include `taglib-config --cflags` -fPIC -O3 -DBOOST_UBLAS_NDEBUG -DNDEBUG -c -o Codegen.o Codegen.cxx
In file included from Codegen.cxx:12:
In file included from ./AudioBufferInput.h:14:
./AudioStreamInput.h:53:10: warning: 'StdinStreamInput::ProcessFile' hides overloaded virtual function [-Woverloaded-virtual]
bool ProcessFile(const char* filename){ return ProcessStandardInput();}
^
./AudioStreamInput.h:26:18: note: hidden overloaded virtual function 'AudioStreamInput::ProcessFile' declared here: different number of parameters (3 vs 1)
virtual bool ProcessFile(const char* filename, int offset_s=0, int seconds=0);
^
1 warning generated.
g++ -Wall -I/usr/local/Cellar/boost/1.58.0/include `taglib-config --cflags` -fPIC -O3 -DBOOST_UBLAS_NDEBUG -DNDEBUG -c -o Fingerprint.o Fingerprint.cxx
g++ -Wall -I/usr/local/Cellar/boost/1.58.0/include `taglib-config --cflags` -fPIC -O3 -DBOOST_UBLAS_NDEBUG -DNDEBUG -c -o MatrixUtility.o MatrixUtility.cxx
g++ -Wall -I/usr/local/Cellar/boost/1.58.0/include `taglib-config --cflags` -fPIC -O3 -DBOOST_UBLAS_NDEBUG -DNDEBUG -c -o SubbandAnalysis.o SubbandAnalysis.cxx
In file included from SubbandAnalysis.cxx:8:
./AudioStreamInput.h:53:10: warning: 'StdinStreamInput::ProcessFile' hides overloaded virtual function [-Woverloaded-virtual]
bool ProcessFile(const char* filename){ return ProcessStandardInput();}
^
./AudioStreamInput.h:26:18: note: hidden overloaded virtual function 'AudioStreamInput::ProcessFile' declared here: different number of parameters (3 vs 1)
virtual bool ProcessFile(const char* filename, int offset_s=0, int seconds=0);
^
1 warning generated.
g++ -Wall -I/usr/local/Cellar/boost/1.58.0/include `taglib-config --cflags` -fPIC -O3 -DBOOST_UBLAS_NDEBUG -DNDEBUG -c -o Whitening.o Whitening.cxx
shell脚本--eval执行shell命令
shell脚本--CGI获取请求数据(GET / POST)
shell脚本--编写CGI代码(shell结合html)以及环境变量
shell脚本--初识CGI
数据表记录包含表索引和数值,请对表索引相同的记录进行合并,即将相同索引的数值进行求和运算,输出按照key值升序进行输出。
写出一个程序,接受一个正浮点数值,输出该数值的近似整数值。如果小数点后数值大于等于5,向上取整;小于5,则向下取整。
输入一个正整数,按照从小到大的顺序输出它的所有质数的因子(如180的质数因子为2 2 3 3 5 )
写出一个程序,接受一个十六进制的数值字符串,输出该数值的十进制字符串。(多组同时输入 )
字符串分隔 ->连续输入字符串,请按长度为8拆分每个字符串后输出到新的字符串数组; •长度不是8整数倍的字符串请在后面补数字0,空字符串不处理。