shithub: aubio

Download patch

ref: dedeffcb077ac7dbac6f54eb1a4dbdcfc1d98d28
parent: 1e1a2c996181cb8b12f6a464e18b1ac5afa4e250
author: Paul Brossier <piem@piem.org>
date: Tue Nov 19 21:50:37 EST 2013

python/demos/demo_sink_create_woodblock.py: fix wavetable

--- a/python/demos/demo_sink_create_woodblock.py
+++ b/python/demos/demo_sink_create_woodblock.py
@@ -32,7 +32,11 @@
 # compute sinetone at floating point period
 for i in range(duration):
     x = int((i % period) / float(period) * tablelen)
-    sinetone[i] = (sinetable[x] + sinetable[x+1]) / 2
+    idx = int(x)
+    frac = x - idx
+    a = sinetable[idx]
+    b = sinetable[idx + 1]
+    sinetone[i] = a + frac * (b -a)
 
 # apply some envelope
 float_ramp = arange(duration, dtype = 'float32')
@@ -39,7 +43,7 @@
 sinetone *= exp( - e * float_ramp / duration / decay)
 sinetone[:attack] *= exp( e * ( float_ramp[:attack] / attack - 1 ) )
 
-if 0:
+if 1:
     import matplotlib.pyplot as plt
     plt.plot(sinetone)
     plt.show()