dpwe/audfprint

Question about concatenate afpk files

Opened this issue · 2 comments

Hi @dpwe , first of all, congratz for this awsome tool for python.

I have question:
Supouse that i have two afpk files of A.wav and B.wav, where A and B are consecutive audio chunks in time.
Then, afpk files contains

A.afpk -> audfprintpeakV00--bytes of afpk A--
B.afpk -> audfprintpeakV00--bytes of afpk B--

If i concatenate the data inside the files in this way:
AB.afpk -> audfprintpeakV00--bytes of afpk A----bytes of afpk B--

This is equivalent to afpk extracted from A.wav concatenated with B.wav ?

dpwe commented

Sadly no, I think. Each peak is recorded as a (time index, bin index) pair, and the time indices are absolute (and maybe assumed monotonic). If you appended the wav files, B would begin at a time corresponding to the end of A, whereas B analyzed alone will begin at time zero.

You could modify the afpk format to write (delta-from-previous-time, bin), and then re-accumulate the times when reading back. Then it would probably work.

Oh okay, probably ill make a function to "merge" afpks that take as arggument the offstet time between recorded files
Thank you very much, I really appreciate your answer!