Advertisement
An_random_user

AUDIOAPI

Jun 26th, 2024 (edited)
490
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.49 KB | None | 0 0
  1. local encoder = dfpwm.make_encoder()
  2. local decoder = dfpwm.make_decoder()
  3. local callback_onframe = callback_onframe or function()end
  4. local out = fs.open(output, "wb")
  5. for input in io.lines(input, 16 * 1024 * 2) do
  6.   local decoded = decoder(input)
  7.   local output = {}
  8.  
  9.   for i = 1, #decoded, 2 do
  10.     local value_1, value_2 = decoded[i], decoded[i + 1]
  11.     output[(i + 1) / 2] = (value_1 + value_2) / 2
  12.   end
  13.  
  14.   out.write(encoder(output))
  15.   callback_onframe()
  16.   sleep(0)
  17. end
  18. out.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement