mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-29 02:04:28 +00:00
freq balancing, and also sum math shit lol!
This commit is contained in:
parent
33ed47bbf5
commit
ec959f5d83
|
@ -86,9 +86,18 @@ class ABotVis extends FlxTypedSpriteGroup<FlxSprite>
|
|||
|
||||
for (i in 0...group.members.length)
|
||||
{
|
||||
var getSliceShit = function(s:Int)
|
||||
{
|
||||
var powShit = FlxMath.remapToRange(s, 0, group.members.length, 0, CoolUtil.coolBaseLog(10, freqShit[0].length));
|
||||
return Math.round(Math.pow(10, powShit));
|
||||
};
|
||||
|
||||
// var powShit:Float = getSliceShit(i);
|
||||
var hzSliced:Int = getSliceShit(i);
|
||||
|
||||
var sliceLength:Int = Std.int(freqShit[0].length / group.members.length);
|
||||
|
||||
var volSlice = freqShit[0].slice(Std.int(sliceLength * i), Std.int(sliceLength * i) + sliceLength);
|
||||
var volSlice = freqShit[0].slice(hzSliced, getSliceShit(i + 1));
|
||||
|
||||
var avgVel:Float = 0;
|
||||
|
||||
|
|
|
@ -28,6 +28,11 @@ class CoolUtil
|
|||
return difficultyArray[PlayState.storyDifficulty];
|
||||
}
|
||||
|
||||
public static function coolBaseLog(base:Float, fin:Float):Float
|
||||
{
|
||||
return Math.log(fin) / Math.log(base);
|
||||
}
|
||||
|
||||
public static function coolTextFile(path:String):Array<String>
|
||||
{
|
||||
var daList:Array<String> = [];
|
||||
|
|
|
@ -41,7 +41,7 @@ class VisShit
|
|||
final binSize = fs / fftN;
|
||||
final indexToFreq = function(k:Int)
|
||||
{
|
||||
var powShit:Float = FlxMath.remapToRange(k, 0, halfN, 0, 4.3); // 4.3 is almost 20khz
|
||||
var powShit:Float = FlxMath.remapToRange(k, 0, halfN, 0, CoolUtil.coolBaseLog(10, halfN)); // 4.3 is almost the log of 20Khz or so. Close enuf lol
|
||||
|
||||
return 1.0 * (Math.pow(10, powShit)); // we need the `1.0` to avoid overflows
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue