Re: [Banshee-List] Mirage not working



Sure, here they are. There is only one file to be changed.

The current problem is, that the analyzed track data isn't correctly converted to a byte array.

--- DistanceCalculator.cs       2013-04-05 04:58:23.000000000 +0200
+++ DistanceCalculator.cs       2013-05-22 20:39:16.834218266 +0200
@@ -47,13 +47,20 @@

internal static string notify_string = AddinManager.CurrentLocalizer.GetString ("The Mirage extension is still analyzing your songs. Until its finished, shuffle and fill by similar may not perform properly.");

+        // static members for distance function
+ private static Scms empty_scms = new Scms(Analyzer.MFCC_COEFFICIENTS);
+        private static int scms_size = empty_scms.ToBytes().Count();
+
private static object Distance (object seed_id_obj, object scms_obj)
         {
             BaseSimilarityContext context;
if (!seeds.TryGetValue (Convert.ToInt32 (seed_id_obj), out context)) throw new ArgumentException ("seed_id not found", "seed_id_obj");

-            var scms_bytes = scms_obj as byte[];
+ // copy pointer to byte array using number of bytes from empty scms
+            var scms_bytes = new byte[scms_size];
+ System.Runtime.InteropServices.Marshal.Copy((IntPtr) scms_obj, scms_bytes, 0, scms_size);
+
             if (scms_bytes == null) {
// TODO raise an event to notify the user (one time only) that
                 // there are un-analyzed tracks?
@@ -65,7 +72,8 @@
             Scms.FromBytes (scms_bytes, context.ComparisonScms);
             total_read_ms += (DateTime.Now - start).TotalMilliseconds;

- float distance = context.Distance (context.ComparisonScms).Average ();
+            // using float here throws a cast exception
+ double distance = context.Distance (context.ComparisonScms).Average ();
             total_ms += (DateTime.Now - start).TotalMilliseconds;
             total_count++;


Am 23.05.2013 00:00, schrieb Andres G. Aragoneses:
On 22/05/13 20:32, Jeremy Leonard wrote:
Hello,

executing Banshee in random by similar mode with the --debug-mirage
switch, I always got the same huge average weighted distance for every
song, and the selected songs were not at all similar.


[Info  21:08:57.808] Running Banshee 2.4.1: [Ubuntu 12.04 LTS
(linux-gnu, x86_64) @ 2012-07-17 02:26:43 UTC]

   Avoided artist ids =
   Seed Distances:
   Average weighted distance:
340.282.300.000.000.000.000.000.000.000.000.000.000,0
 >>>>>>>>>>>>>> Total ms spent in Distance func: 0 ms - spent reading: 0
ms; total calls: 0
 >>>>>>>>>>>>>> Distance [min, max] = [3,402823E+38, 0]


After downloading the latest source from git and making some minor code
changes, the distance calculation now seems to work:


[5 Warn  22:15:31.196] Executed in 1450ms SELECT...
   Avoided artist ids = 342, 444, 444, 802
   Seed Distances:
     Skipped/Discarded seeds (weight 0,1)
       distance: 15,9, weighted: 159,2 from artist_id  342, uri
file://...
       distance: 17,6, weighted: 175,9 from artist_id  444, uri
file://...
       distance: 14,4, weighted: 144,2 from artist_id  444, uri
file://...
       distance: 14,2, weighted: 141,7 from artist_id  802, uri
file://...
   Average weighted distance: 155,3
 >>>>>>>>>>>>>> Total ms spent in Distance func: 1226,45199999996 ms -
spent reading: 456,079000000002 ms; total calls: 9591
 >>>>>>>>>>>>>> Distance [min, max] = [3,551699, 4452,018]


Has anyone else noticed this behaviour in other releases/platforms?

Kind regards,
Jeremy

Can you share the code changes you made?

_______________________________________________
banshee-list mailing list
banshee-list gnome org
https://mail.gnome.org/mailman/listinfo/banshee-list  (unsubscribe here)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]