Package com.moncruist.audiorecogn.model

Examples of com.moncruist.audiorecogn.model.Match


            log.log(Level.INFO, "Search start");
            int idx = 0;
            while (cursor.hasNext()) {
                //log.log(Level.INFO, String.format("Search idx %d", idx));
                DBObject dbo = cursor.next();
                Match newMatch = Match.fromDBObject(dbo);
                ArrayList arr = (ArrayList) dbo.get("hash");


                double[][] music = new double[arr.size()][hash[0].length];
                for(int i = 0; i < arr.size(); i++) {
                    ArrayList<Double> arr2 = (ArrayList<Double>)arr.get(i);
                    for(int j = 0; j < arr2.size(); j++)
                        music[i][j] = arr2.get(j);
                }
                int music_len = music.length;


//                if(newMatch.getTitle().equals("Tie You Up (The Pain Of Love)")) {
//                log.log(Level.INFO, String.format("Music length %d", music_len));
//                for(int i = 0; i < music_len; i++) {
//                    String str = "[";
//                    for(int j = 0; j < music[i].length; j++)
//                        str += Double.toString(music[i][j]) + " ";
//                    str += "]";
//                    log.log(Level.INFO, str);
//                }
//                }

                double score = Double.MAX_VALUE;
                for(int i = 0; i < music_len - hash_len; i++) {
                    double sum = 0.0;
                    for(int j = 0; j < hash_len; j++) {
                        sum += SearchUtils.distance(music[i+j], hash[j], min_max);
                    }
                    if(sum < score)
                        score = sum;
                }

                newMatch.setScore(score);
                newMatch.setClassScore(clresult);
                if(newMatch.getTitle().equals("Tie You Up (The Pain Of Love)"))
                    log.log(Level.INFO, String.format("Tie You Up (The Pain Of Love) match %f", newMatch.getScore()));
                if(matches.size() < 10) {
                    matches.add(newMatch);
                    Collections.sort(matches, new MatchComparator());
                }
                else {
View Full Code Here


        if (musicCollection != null) {
            ArrayList<Match> matches = new ArrayList<Match>();
            DBCursor cursor = musicCollection.find();
            while(cursor.hasNext()) {
                DBObject obj = cursor.next();
                Match m = Match.fromDBObject(obj);
                m.setScore(-1.0);
                m.setClassScore(null);
                matches.add(m);
            }
            return matches;
        } else {
            return new ArrayList<Match>();
View Full Code Here

TOP

Related Classes of com.moncruist.audiorecogn.model.Match

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.