diff --git a/bin/runall.sh b/bin/runall.sh new file mode 100755 index 0000000..a2218cd --- /dev/null +++ b/bin/runall.sh @@ -0,0 +1,5 @@ +#!/bin/bash +for file in ./cut_5s/*.wav ; do +# echo ${file} + ./recog $file +done diff --git a/src/build.cpp b/src/build.cpp index 7d1902e..e90e0d3 100644 --- a/src/build.cpp +++ b/src/build.cpp @@ -50,13 +50,13 @@ int ProcessBuildRes(const char *szResDir, const char *szResPath){ if (!(S_IFDIR &statbuf.st_mode)) // 判断下一级成员不是目录 { strcpy(FileName, entry->d_name); - printf("%d: %s ",index , FileName); // 输出属性不是目录的成员 myhash.AddSongList(FileName); char FilePath[80] = ""; strcat(FilePath, szResDir); strcat(FilePath, FileName); - printf("%s\n",FilePath); // 输出属性不是目录的成员 + /* printf("%s\n",FilePath); // 输出属性不是目录的成员 */ fingerprint.ExtractPair(FilePath, myhash, 0, (float)0.98, index, 0); + printf("%d: %s 建库成功.\n",index , FileName); // 输出属性不是目录的成员 fingerprint.UnInit(); index ++; } @@ -79,7 +79,8 @@ int main( int argc, char **argv ) { Initialize(); - ProcessBuildRes("./samples/", "./database"); + //ADD your own paths here!!! + ProcessBuildRes("YOUT_PATH_OF_MUSIC_FILES", "YOUR_PATH_OF_DATABASE_FILE"); unInitialize(); return 0; } diff --git a/src/hash.cpp b/src/hash.cpp index 024682a..3f6dc28 100644 --- a/src/hash.cpp +++ b/src/hash.cpp @@ -132,7 +132,8 @@ void THash::File2Hash(const char *filename){ fp = fopen(filename, "rb"); char *chp; fread(&song_num, sizeof(size_t), 1, fp); - printf("Totally %zu songs.\n", song_num); + printf("------------\n"); + printf("数据库中共有 %zu 首歌的特征数据.\n", song_num); for (size_t i = 0; i