[sdiy] Random Timbre Synth

Scott Gravenhorst music.maker at gte.net
Sat Aug 20 18:24:03 CEST 2011


Joel B <onephatcat at earthlink.net> wrote:
>Hi Scott, 
>
>Question about your Spline function:
>
>y = ( x - 1 ) * x * ( x + 1 ) 
>
>How does this get you the points in between known point x1,y1 and 
>known point x2,y2? I've been trying to figure out some things 
>like this for both a game I am working on (computing curved 
>attack vectors) and for a simple synthesis program I'm working on 
>(figuring out how to draw & scale smooth waveforms on the screen) 
>
>How are you getting from the starting y position to the 
>destination y position, since that formula doesn't seem to take 
>into account either, but just generates a y based on an x value, 
>but you are somehow using this formula to connect two points on 
>the y axis over time (or distance) 

Hopefully, I won't mumble-bumble this explanation...

First, I restrict the cubic function's operation to go from one peak to
the other.  This means x is restricted to -0.58 <= x <= 0.58.  This and
the peak Y values are scaled so that the spline output is -1.0 < y < 1.0.

The x difference for the two points, (x1,y1) and (x2,y2) is calculated.
 The x span for a full spline is 1.16, this value is divided by the x
difference to give an x increment value used in the point generation
process.

The original y1 and y2 values are used to calculate a y offset and a
sign value.  Since the Y values are pre-adjusted to be forced
symmetrical about the x axis, the offset is used to restore their
original positions.  The sign value is used to flip the spline.

-- ScottG
_______________________________________________________________________
-- Scott Gravenhorst
-- FPGA MIDI Synthesizer Information: 
   jovianpyx.dyndns.org:8080/public/FPGA_synth/
-- FatMan: 
   jovianpyx.dyndns.org:8080/public/fatman/
-- NonFatMan: 
   jovianpyx.dyndns.org:8080/public/electronics/
-- When the going gets tough, the tough use the command line.




More information about the Synth-diy mailing list