|
PlaylistGeneration
How songs are added to the playlist
Each feature vector produced during FeatureExtraction contains 64 floats and is saved as a '.vec' text file (using the marsyas::realvec.write() function). To find the best matching song, a separate program (fcompare) reads in each of these files and computes the Euclidean distance between vectors. The vector that is closest is returned as the best match. Simple? Yes. Potentially time-consuming? Yes, although it is fast enough on my computer that gprof can't measure the amount of time it takes to go through ~2500 vectors and find the top match. To prevent the same song from being added to the playlist more than once, a list of the current songs is passed to the fcompare program. If a particular vector is in this list, it is excluded from the comparison. I like this system, as it is very easy to switch between using the first song as the basis for comparison ("In the mood" mode) and using the last song on the list as the basis for comparison ("Evolution" mode). However, there is a major flaw which should probably be addressed at one point - since the fcompare function is called from Python using subprocess.Popen, the length of the command-line arguments is finite. I haven't run into the cap yet (even after letting the playlist run to 60 or so songs), but I'm sure that it exists. |
Sign in to add a comment