Class: FourierSummation

Environment: Siren
Superclass: Siren.Function
Category: Music-Functions
Instance variables: myForm myArray lazy
Indexed variables: objects

Instances of FourierSummation are functions that interpret their points as 3-element arrays (harmonic, amplitude, phase), and sum sine waves into their data array based on the fourier summation of these components.

Instance variables:
myForm my function plot--default size = 1024@180
myArray my value array--default length = 1024
lazy do I cache my values (eager) or cmopute them on the fly (lazy)?

Example:
| fcn |
fcn := FourierSummation from: #((1 1 0) (3 0.3 0) (5 0.2 0)
(7 0.15 0) (9 0.11 0) (11 0.09 0)).
Transcript show: (fcn at: 0.14) printString; cr.

initialize-release

initialize: size
Initialize the receiver for the given size.

computing

computeCurve
Compute the block by sine summation--set the values in the cached array.

computeValueAt: anIndex
Compute the answer by sine summation.

accessing

add: a3DPoint
Add the argument to the receiver's point collection.

at: theIndex
Answer the value from my array--assume an index in the range 0 to 1

MetaClass: FourierSummation class

instance creation

default
Answer a default instance of the receiver class.

from: anArrayOfZPoints
Answer a sum-of-sines function with the given points.

examples

fourierExample
Make a Sine summation that approaches a square wave

fourierViewExample
Make a Sine summation that approaches a square wave and open a view on it.