Environment: Siren
Instances of of Function and its subclasses represent abstractions of 1- or n-dimensional functions of 1 variable (e.g., time).
Examples are a ramp from 0 to 1 such as:
[(LinearFunction from: #((0 0) (1 2))) at: 0.33]
or a spline that traces a sine-like path centered around 1:
[(SplineFunction from: #((0 1) (0.33 2) (0.67 0) (1 1))) at: 0.35]
InstanceVariables:
ui
data
the data values or breakpoints of the function
domain
range
edit: extent
Open a function view on the receiver.
updateSelector
processing
Answer an averaged version of the receiver of the given size.
freeData
Release the receiver's 'data'.
maxTo: size win: wsize
Answer a version of the receiver of the given size taking the maximum value of each window.
sampledTo: size
Answer a down-sampled version of the receiver of the given size.
smoothed
Answer a version of the receiver smoothed to about 32 points.
updateRange
accessing
Add the argument to the receiver's point collection.
at: anIndex
Answer the value at the given index (between 0 and 1 -or- 1 and data size).
at: anIndex put: aValue
Put the given value at the given index (between 0 and 1).
atX: anIndex
Answer the value at the given index (between 0 and 1).
data
Answer the receiver's 'data'.
data: anObject
Set the receiver's instance variable 'data' to be anObject.
dataClass
Answer the class of the elements in the receiver's data collection.
domain
Answer the receiver's 'domain'.
domain: anObject
Set the receiver's instance variable 'domain' to be anObject.
duration
Answer the domain of the receiver's collection of breakpoints.
nextXMoreThan: delta from: thisIndex
Answer the next X value after index whose Y value is more than delta from the value at thisIndex
nextXMoreThan: delta from: thisIndex step: step
Answer the next X value after thisIndex whose Y value is more than delta from the value at thisIndex
offset: offVal
Set the receiver's 'offset'.
pointAt: index
Answer the given value in the receiver's breakpoint collection.
pointAt: index put: value
Assign the given values in the receiver's breakpoint collection.
points
Answer the receiver's 'data'.
range
Answer the receiver's 'range'.
range: anObject
Set the receiver's instance variable 'range' to be anObject.
realPointAt: index
Answer the given value in the receiver's breakpoint collection (this is not overridden in ExpSeg).
sampleAt: anIndex
Answer the value at the given index (between 0 and 1).
scale
Answer the receiver's 'scale'.
scale: scaleVal
Set the receiver's 'scale'.
selection
size
Answer the size of the receiver's collection of breakpoints.
printing
Format and print the receiver on the argument.
storeOn: aStream
Format and print the receiver on the argument.
enumerating
Evaluate aBlock with each of the receiver's elements as the argument.
Answer the first element for which aBlock evaluates to true.
do: aBlock
Evaluate aBlock with each of the receiver's elements as the argument.
isEmpty
initialize-release
Initialize the receiver for the given size.
geometry
Answer whether or not the receiver has a function breakpoint near the given x value.
indexOfPointNearestX: anXValue
Answer the receiver`s point nearest the given x value.
arithmetic
Answer a function graph with the argument multiplied by the receiver
+ aFcnOrNum
Answer a function graph with the argument added to the receiver
- aFcnOrNum
Answer a function graph with the argument subtracted from the receiver
/ aFcnOrNum
Answer a function graph with the receiver divided by the argument
MetaClass: Function class
standard functions
Answer a exponential attack/decay/sustain/release envelope.
exponentialADSR2
Answer a exponential attack/decay/sustain/release envelope.
linearADSR1
Answer a linear attact/decat/sustain/release envelope.
linearADSR2
Answer a linear attact/decat/sustain/release envelope.
spline
Answer a generic spline curve.
sumOfSines
Answer a simple Fourier summation.
instance creation
Answer a default instance of the receiver class.
from: anArray
Answer a function with the given array of collections, points, or data values.
fromFile: fName
Load 1 or more functions from a text file.
new
Answer an instance of the receiver class.
ofSize: size
Answer an instance of the receiver class of the requested size.
randomOfSize: size from: low to: high
Answer a function with the given number of data points in the given range.
randomWalkSize: size from: low to: high
Answer a function with the given number of data points in the given range.
readFloatsFrom: filename
Answer a function with the given points.
examples
Function usage example; read a function from a binary file and view it.
fileExample
Function usage example; read a function from a binary file and view it.
functionFileExample
Function usage example; read a function from a binary file and view it.
functionPlayExample
Function usage example; make a roll-type eventList and apply a crescendo/decrescendo to it
functionViewExample
Function usage example; make a z-z function and view it.
maxedFunctionFileExample
Function usage example; read a function from a binary file and view it.
randomViewExample
Function usage example; make a random walk fcn and view it.
randomViewExample2
Function usage example; make a random walk fcn and view it.
class constants
Answer the default size for the instances' storage array.