diff yeti/silvet.yeti @ 24:0e8ee830b5ee

Normalise source distributions row-wise (per note)
author Chris Cannam
date Mon, 31 Mar 2014 12:46:24 +0100
parents 990b8b8b7e25
children 80f02ff5d37a
line wrap: on
line diff
--- a/yeti/silvet.yeti	Fri Mar 28 15:38:07 2014 +0000
+++ b/yeti/silvet.yeti	Mon Mar 31 12:46:24 2014 +0100
@@ -123,6 +123,18 @@
 
 println "Instruments: \(map do i: (d.instruments[i]) done instruments)";
 
+normalise v =
+   (s = vec.sum v;
+    if s > 0 then vec.divideBy s v 
+    else v
+    fi);
+
+if not (empty? sounding) then
+   p = head sounding;
+   i = head instruments;
+   w = mat.getColumn p d.templates[i];
+   \() (plot.plot [ Vector w, Vector (normalise col), Caption "Template for instrument \(d.instruments[i]), pitch \(p), against normalised source distribution" ]);
+fi;
 
 ();