audfprint icon indicating copy to clipboard operation
audfprint copied to clipboard

Question about concatenate afpk files

Open NahuBocco opened this issue 2 years ago • 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 ?

NahuBocco avatar Jan 04 '23 18:01 NahuBocco

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.

dpwe avatar Jan 04 '23 23:01 dpwe

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!

NahuBocco avatar Jan 05 '23 12:01 NahuBocco