java - comparing wav files -


i have (mostly) working program compare 2 wav files, see if smaller 1 in bigger one. done in java.

i first making sure both wav files in canonical wave format. byte array of data out of them using audioinputstream. take out data in chunks of frame rate (such right now: 4096 bytes). take first chunk of smaller input, , go through chunks of same size in larger input.

i take these chunks , create double arrays same data. fft's , use correlate function find peak in resulting array of correlation coefficients. go next chunk of smaller input, , see if similar peak appears.

this works, peaks obvious when files same, , of time results correct. not false positives. do, however, false negatives.

this because i'm not sure how "align" data. smaller file come point in larger file. of time, caught via chunking method this. sometimes, if files different, , no peak found, though files should return high correlation.

if take 1 of files false negatives (no peak), , tweak them around bit, snipping away @ end or beginning of them few thousand bytes, , run program again, finds peak , clear match. thus, work, somehow not finding peak correlation obvious. correlation function have translates ffts match, think cover everything, not covering of data.

i'm not sure how "align" chunk of smaller file wherever occurs in larger file correlate function picks on correlation occurs. works, need eliminate false negatives. advice?

use convolution filter compare 2 waveforms. tell if , match occurs. fast algorithms compute convolutions available.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -