Hi, here is the problem i have to simplify my array:
first, i must talk about the context, i got an audiostreamplayer with a stream data.
the complete data.size() = 1 102 192 !
from those data, i want to draw some lines... to get a preview of my sound
as you can imagine, i cannot use so much data, so i try to simplify by getting 1/1000.
here is the code of a Node2D (parent of the audiostreamPlayer)...with all data !
func _draw():
var vibe = $AudioStreamPlayer
var data = vibe.stream.data
var x = 15
for i in data:
# draw = (from..., to..., color, width)
draw_line(Vector2(x,400), Vector2(x,i/2), Color(0,0,0,1), 2)
x +=3
which make the draw function unusable. and this is only from my test soundfiles, i would get some larger ones, so i need to find the way to smooth/reduce.
how can i reduce the amount of data to be draw ?
EDIT: i have tried :
data.compress(0)
try also various compression modes:
https://docs.godotengine.org/en/3.1/classes/class_file.html#enum-file-compressionmode
but this is reducing only to 770 000, which is not enough in any case
i also found this, but it doesnt help so much:
https://godotengine.org/qa/26934/large-arrays-over-65536-containing-poolbytearrays-crash-game
conclusion... i really need to reduce the amount of data sent to be draw :)