I’ll clean this up more, later… better posted now than not.
Code examples will be linked to originals, or other posts with better versions.
Will resort and organize more.
Summary of items above
key -
x - now in 3.18 (if not before)
0 - not yet
code - can be done in code
? - not enough details to flesh out?
u - unknown
coming - mentioned as in development now
- x - hypot(x,y) - sqrt(xx + yy)
- x - hypot3(x, y, z) - sqrt(xx + yy + z*z)
- x - trunc(n) - removes fractional components for positive or negative numbers. e.g.
- x - frac(n) - just the fractional component, like n % 1. e.g. frac(5.5) == .5 frac(-5.5)
- x - mod(a, b) a modulo b, AKA floored division 2.
0 - friendly palettes
? - Probability stuff
u - Sampling from arbitrary distributions via the inverse CDF process 1
u - Bernoulli state machines normalized to delta (independent of frame rate) for better flickering than random()
? - real constants that don’t incur the speed penalty of accessing a variable.
x - Arctan2
coming - a way to access XY(Z) map coordinates outside of render2d(3d)
coming? - a way to access non-normalized XYZ coordinates outside of render2d(3d)
? - The sound scaling/normalizing functions in some kind of reduced or simpler format
? - sound normalizing (perhaps on the sensor board itself).
? - has2DMap() - true/false
? - has3DMap() - true/false
? - pixelMapDimensions() returns 1, 2, or 3. Even if no map is installed, we’d assume the default pixel map of index/pixelCount.
coming - render should be passed x or I should add render1D(index, x). At some point I will add support for 1D pixel maps too, with a default pixel map where x will be index/pixelCount and would be very easy to upgrade existing patterns.
x - scaling in one or more dimensions
coming - Map walking functions.
This lets you walk through the pixel map outside of a render call and could be used to make a pattern 2D/3D aware yet still only export render or pre-process pixels.
mapPixels(fn) - walk through the pixels with pixel map coordinates. fn is invoked with 4 arguments: (index, x, y, z) though you can specify fewer. If no pixel map is installed, x will be the same as index/pixelCount, and y and z will be 0. For 2D pixel maps z would be 0.
map2DPixels(fn) - walk through the 2D pixel map, if installed (if not, nothing happens). fn is invoked with 3 arguments: (index, x, y).
map3DPixels(fn) - walk through the 3D pixel map, if installed (if not, nothing happens). fn is invoked with 4 arguments: (index, x, y, z).
x - Pixel Map Coordinate Transformation
? - clock functions need something for sub-seconds… if I could call a function like ClockSeconds for smaller values, like for milliseconds, that would be fine.
? - inter-device communication?
? - A real round function, preferably with the ability to limit precision.
? - A playback from memory. Something that will let me pre-calculate (long) patterns and play them back at rates limited only by the hardware.
? - Ability to add an external serial RAM/EPROM or SD for (long) pattern storage.
? - Quadrature Encoder read - the ability to use an encoder as an input device without having to bit-bang in the script.
x - various array functions
? - more info in websocket (like first pixel color)
? - universal/persistant speed slider
? - universal/persistant variables
? - include (for libraries, etc)
? - literal arrays
code - “Perceptual HSV”, phsv(h, s, v).
// Perceptual HSV
function phsv(h, s, v) {
h = wave((h % 1 + (h < 0)) / 2 + .75)
hsv(h, sqrt(s), v * v)
}
code - Seedable deterministic PRNG.
(we have a few of these, I'll link later)
code - Parameterized noise generation
code - vectors (can be done with 2 element array)
? - A unit normal table (Z table). Math.js calls this norm(x).
code - A dimming function where every element in an array is reduced by some amount every time it is called
function fade(amount){
for(m=0;m<strlength;m++){
pixelsb[m]=pixelsb[m]-min(pixelsb[m],amount)
} }
? - allocate an image buffer that could be drawn into.
code - rendering functions that will draw 1D objects of a specific size, color, hue onto an array, like the following
function dots(increment){
increment=increment/100+maxFrequencyMagnitude*100
for(n=0;n<5;n++){
if(Radius[n]<1){
MaxSize[n]=clamp(random(5)+energyAverage*500,2,20)
Positions[n]=floor(random(strlength-MaxSize[n]*2-2)+MaxSize[n])
Radius[n]=1
Color[n]=loval+(maxFrequency)/100+random(0.2)
Expanding[n]=1
}
if(Expanding[n]==1){
Radius[n]+=increment
if(Radius[n]>=MaxSize[n]){Expanding[n]=0;Radius[n]=MaxSize[n]}
}
else{Radius[n]-=increment}
for(i=0;i<Radius[n];i++){
pixelsh[Positions[n]+i]=Color[n]+i/30
pixelsb[Positions[n]+i]=(1-i/MaxSize[n])
pixelsh[Positions[n]-i]=Color[n]+i/30
pixelsb[Positions[n]-i]=(1-i/MaxSize[n])
}
fade(0.05)
}}
code - inoise1d(x), inoise2d(x,y), inoise3d(x,y,z)
code - beatsin/beatsin16
// beatsin( BPM, low, high) returns an value that
// rises and falls in a sine wave, 'BPM' times per minute,
// between the values of 'low' and 'high'.
function beatsin(bpm, low, high) {
return wave(time(0.91552734375/bpm)) * (high - low) + low
}
code - A “pixel morph” function that lets me specify a beginning value, ending value, and transition rate. Generates a smooth(ed) transition between the two values.
code - complex numbers
AS THIS SUMMARY IS UNSTABLE… PLEASE DON’T ADD MORE TO THIS THREAD, maybe it’s time for a new thread?