private static int GetBestHit(byte[] audio, DataBase dataBase, int shiftCount) { byte[] tmp = null; int max = 4096; int step = max / shiftCount; int maxScore = -1; int bestId = -1; for (int i = 0; i < max; i += step) { tmp = new byte[audio.Length - i]; Array.Copy(audio, i, tmp, 0, tmp.Length); Dictionary<int, List<int>> results = dataBase.IndexSong(tmp, 0, tmp.Length); int score = 0; int id = dataBase.GetBestHitBySpanMatch(results, ref score, false); if (score > maxScore) { maxScore = score; bestId = id; } } Console.WriteLine("Max score : {0}", maxScore); return bestId; }