summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2014-05-17 21:29:53 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2014-05-17 21:29:53 +0200
commitbcb9f8b3ae7d477a35e2baa48c5f5bcff2d98986 (patch)
tree309b57b1ad4abb89e133b08ddebabbbdd06a03c3 /src
parent0e048dee411cc20beb2a8667e5bb339f9b7fb939 (diff)
parent488070f321b1fb24bb0a7022c321c574fd4b06ac (diff)
Merge branch 'master' into resample
Pull in changes from master.
Diffstat (limited to 'src')
-rw-r--r--src/powerlist.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/powerlist.cc b/src/powerlist.cc
index 1888733..6fc77ad 100644
--- a/src/powerlist.cc
+++ b/src/powerlist.cc
@@ -32,6 +32,14 @@
#include <hugin.hpp>
+/**
+ * Minimum sample set size.
+ * Smaller means wider 'velocity groups'.
+ * Limited by sample set size, ie. only kicks in if sample set size is smaller
+ * than this number.
+ */
+#define MIN_SAMPLE_SET_SIZE 26
+
// Enable to calculate power on old samples without power attribute
//#define AUTO_CALCULATE_POWER
@@ -213,8 +221,13 @@ Sample *PowerList::get(level_t level)
float power_span = power_max - power_min;
- // Spread out at most 1.5 samples away from center
- float stddev = power_span / samples.size() * 1.5;
+ // Width is limited to at least 10. Fioxes problem with instrument with a
+ // sample set smaller than MIN_SAMPLE_SET_SIZE.
+ float width = fmax(samples.size(), MIN_SAMPLE_SET_SIZE);
+
+ // Spread out at most ~2 samples away from center if all samples have a
+ // uniform distribution over the power spectrum (which they probably don't).
+ float stddev = power_span / width;
// Cut off mean value with stddev/2 in both ends in order to make room for
// downwards expansion on velocity 0 and upwards expansion on velocity 1.