View Single Post
Old 08-22-2019, 07:32 AM   #10
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 2,525
Default

Slightly easier check I suggested before:
Code:
local file1=io.open("e:\\1.wav", "rb")
if file1 then 
  content1=file:read("*all")
  len1=content1:len()
  file:close()
end

local file2=io.open("e:\\2.wav", "rb")
if file2 then 
  local content2=file:read("*all")
  local len2=content2:len()
  file2:close()
end

test_byte1 = math.floor(math.random()*math.min(len1,len2))
test_byte2 = math.floor(math.random()*math.min(len1,len2))
test_byte3 = math.floor(math.random()*math.min(len1,len2))
local diff =  content1:byte(test_byte1)==content2:byte(test_byte1) 
              and content1:byte(test_byte2)==content2:byte(test_byte2) 
              and content1:byte(test_byte3)==content2:byte(test_byte3) 
              and len1==len2

if diff then msg("They are same") else msg("They are the different") end
__________________
SoundCloud | MPL Scripts discussion | ReaPack | Donate
mpl is offline   Reply With Quote