Wallpaper Engine

Wallpaper Engine

Customizable Module Visualizer
ShiroSFX 19 Dec, 2020 @ 12:16pm
Visualizer: Bar Number
Hello,

How do you do for to have values for 64+ bar with the same channel (left or right) ?
Create fake value with random position ?

How do you choose the value of the bar when it's less than 64 ?
< >
Showing 1-3 of 3 comments
Arthesian  [developer] 19 Dec, 2020 @ 2:15pm 
interpolation:

so let's say we have the values:

[1,9,5,3] (=> this represents the audio data)

but instead of 4 points, we want 7 points (that's the easiest example)

then it becomes:

[1, 5, 9, 7, 5, 4, 3] ( we just averaged the numbers in between the existing data set, to calculate the numbers in between )

Now, if you would like to create a data set from 64 to 65, you can just put in into a formula, where it would take something like where the second value would be between the first and second, at 64/65*100% value etc.
Arthesian  [developer] 19 Dec, 2020 @ 2:22pm 
_.interpolate = function(array, newLength) {
var newData = [];
var data = array;

// If the Smooth library is available, use it instead for better results
if (!!Smooth) {
var s = Smooth(data, { method: Smooth.METHOD_CUBIC, scaleTo: newLength });
for (var i = 0; i < newLength; i++) {
newData = s(i);
}
} else {
var linearInterpolate = function(before, after, atPoint) {
return before + (after - before) * atPoint;
};

var springFactor = Number((data.length - 1) / (newLength - 1));

// assign first value
newData[0] = data[0];
for (var i = 1; i < newLength - 1; i++) {
var tmp = i * springFactor;
var before = Number(Math.floor(tmp)).toFixed();
var after = Number(Math.ceil(tmp)).toFixed();
var atPoint = tmp - before;
newData = linearInterpolate(data[before], data[after], atPoint);
}
// assign last value
newData[newLength - 1] = data[data.length - 1];
}

// Return the new array
return newData;
}




This is how it's impemented in JavaScript in the Wallpaper :P The ''Smooth'' Library, will also take the difference between the numbers into account, and 'smooths' it out using the Qubic Quadratic method. ( the fallback would be like I described in my first post )
ShiroSFX 20 Dec, 2020 @ 4:47am 
Ok i understand i will try on my side :)

Thanks for the reply, have a good day :happymeat:
< >
Showing 1-3 of 3 comments
Per page: 1530 50