changeset 174:237d41a0f69d

Introduce shift sparsity
author Chris Cannam
date Wed, 21 May 2014 14:41:53 +0100
parents 26d054291412
children abfd19f5cc1a
files src/EM.cpp src/EM.h
diffstat 2 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/EM.cpp	Wed May 21 12:15:29 2014 +0100
+++ b/src/EM.cpp	Wed May 21 14:41:53 2014 +0100
@@ -39,9 +39,8 @@
     m_binCount(pack->templateHeight),
     m_sourceCount(pack->templates.size()),
     m_pitchSparsity(1.1),
-    //!!! note: slightly less source sparsity might help; also
-    //!!! consider a modest shift sparsity e.g. 1.1
-    m_sourceSparsity(1.3),
+    m_shiftSparsity(1.1),
+    m_sourceSparsity(1.2),
     m_lowestPitch(pack->lowestNote),
     m_highestPitch(pack->highestNote)
 {
@@ -255,7 +254,16 @@
     if (m_pitchSparsity != 1.0) {
         for (int n = 0; n < m_noteCount; ++n) {
             m_updatePitches[n] = 
-                pow(m_updatePitches[n], m_pitchSparsity);
+                powf(m_updatePitches[n], m_pitchSparsity);
+        }
+    }
+
+    if (m_shifts && m_shiftSparsity != 1.0) {
+        for (int i = 0; i < m_shiftCount; ++i) {
+            for (int n = 0; n < m_noteCount; ++n) {
+                m_updateShifts[i][n] =
+                    powf(m_updateShifts[i][n], m_shiftSparsity);
+            }
         }
     }
 
@@ -263,7 +271,7 @@
         for (int i = 0; i < m_sourceCount; ++i) {
             for (int n = 0; n < m_noteCount; ++n) {
                 m_updateSources[i][n] =
-                    pow(m_updateSources[i][n], m_sourceSparsity);
+                    powf(m_updateSources[i][n], m_sourceSparsity);
             }
         }
     }
--- a/src/EM.h	Wed May 21 12:15:29 2014 +0100
+++ b/src/EM.h	Wed May 21 14:41:53 2014 +0100
@@ -91,6 +91,7 @@
     const int m_sourceCount;
     
     const float m_pitchSparsity;
+    const float m_shiftSparsity;
     const float m_sourceSparsity;
 
     const int m_lowestPitch;