ttm / pyo

Automatically exported from code.google.com/p/pyo
GNU General Public License v3.0
0 stars 0 forks source link

Interpolation involving last point in LinTable #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Try the following code:

from pyo import *
s = Server().boot().start()

table = LinTable([(0,0.),(3,.75),(4,1.)], 4)
# the following has similar behavior, although I think it might be more 
"correct":
#table = LinTable([(0,0.),(3,.75),(4,1.)], 5)

sig = Sig(0)
val = Pointer(table, sig)
sine = Sine(freq=440*(2**val), mul=.5).out()

table.graph()
sig.ctrl()
s.gui()

What is the expected output? What do you see instead?
As the Sig slider is moved from 0. to 1., the output of this LinTable should 
slide between 0. and 1. linearly, as is shown in the graph.  Instead, it 
reaches 1. when the Sig is at .75, sits at 1. from .75 to .99..., then becomes 
0. again when Sig reaches 1.  The sine wave in the example code is just used to 
sonify the output of the Pointer.

What version of the product are you using? On what operating system?
pyo 0.6.6 on OS X 10.8.3

Please provide any additional information below.
I've noticed similar behavior using Lookup.

Original issue reported on code.google.com by bennymar...@gmail.com on 9 May 2013 at 10:53

GoogleCodeExporter commented 9 years ago
Hi Benny,

Yes, the commented table (size=5) is the correct one, you are not allowed to 
write value on the guard point (position 4 in a table of size 4, beginning at 
0). The guardpoint is added automatically to allow linear interpolation and it 
is always a copy of the first point of the table (to wrap around without 
glitch). If you don't want the wrap around interpolation, you just have to 
scale the index of the Pointer. For the table of size 5, sig should be:

sig = Sig(0, mul=4./5)

Hope that helps!

Original comment by belan...@gmail.com on 15 May 2013 at 12:38

GoogleCodeExporter commented 9 years ago
Thanks, Olivier, for your reply.  That makes a lot of sense!  This issue is 
resolved.

Benny

Original comment by bennymar...@gmail.com on 19 May 2013 at 6:05

GoogleCodeExporter commented 9 years ago

Original comment by belan...@gmail.com on 21 May 2013 at 3:11