Need help on playing WAV Chunks sent by my python server

Hello!

For days, i’ve been trying to make a video player and the video part is already good enough! but theres just one thing missing, audio.

This is the only thing i need, ive tried searching around the devforum, ive tried using github lua wav parsers and i just cannot get it right, all i hear is inaudible noise.

I’m not trying to make it high quality, i need something that you can actually hear and understand. I’m using the movie shrek just to test it out and if i can hear the intro it’s already good enough.

Please, it has been months since ive began doing this type of stuff and being stopped because of the audio part. If it’s not possible then there could be another way.

I would be super glad if any of you gave me atleast a answer or an example of how i could pull this off. Thanks!

Python side:

def ReturnAudio():
    def generate():
        stuffseconds = int(request.headers["seconds"])
        secondsstuff = int(request.headers["ogseconds"])
        audio = VideoFileClip(url).audio
        audio_chunk = audio.subclipped(-secondsstuff + stuffseconds, stuffseconds)
        arraychunk = audio_chunk.to_soundarray(fps=8000)
        print(-secondsstuff + stuffseconds, stuffseconds)
        audio.close()
        return orjson.dumps({"data": arraychunk.tolist()})
    return generate()

Roblox side (CODE MIGHT NOT MAKE EVERYONE HAPPY):

local chunk = game.Workspace.Stats.chunksize.Value --its set to 160

local dataset = {}

local sounds = {}

game.ReplicatedStorage.SendAudio.OnClientEvent:Connect(function(data)
	if #sounds == 0 then
		for p = 1,#data.data/chunk do
			local thing = game.ReplicatedStorage["440HZ"]:Clone()
			thing.Parent = game.Workspace.Screen
			table.insert(sounds,thing)
		end
	end
	
	table.insert(dataset,data)
end)

task.wait(10) --delay to make sure theres enough data

while true do
	if dataset and dataset[1] and dataset[1].data then
		local thisset = dataset[1]
		for i = 1,chunk do
			local data = thisset.data
			for p = 1,#data/chunk do
				local sound = sounds[p]
				sound.Volume = 1 + ((data[p * i][1] / 440) * 440)
				sound.PlaybackSpeed = 1 + ((data[p * i][2] / 440) * 440)
				sound:Play()
			end
			task.wait(1/8000)
		end
		
		table.remove(dataset,1)
	end
	task.wait()
end