pearsonkyle / Signal-Alignment

Algorithms to align 1D signals via cross correlation and likelihood maximization.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Time/memory complexity

AmitMY opened this issue · comments

First I'd point out that the citation link in the readme:

Pearson K. A., et al., 2019, AJ, 157, 21

Is not working.

Second, I like the idea of this work, and I was wondering if you can add complexity information for the alignment methods?

Finally, does the alignment process depends on how dis-aligned the signals are? I can heuristically align them to be roughly 50,000 points misaligned, rather than a million I start with. (How much the initialization of the chi square alignment affects the time)

For context:
I have two audio files, one recorded by a microphone, one synthesized using a MIDI file and I want to align them. This means the files have 44,000 data points per second, and are roughly 300 seconds long, meaning 13,200,000 data points overall.

Hi Amit, try these two links for the paper:
https://arxiv.org/abs/1811.02060
https://iopscience.iop.org/article/10.3847/1538-3881/aaf1ae/meta

I'm not entirely sure what you mean by complexity information for these methods. You're welcome to add some metrics to the code and submit it as a pull request if you'd like to contribute.

The alignment method, particularly the chi-squared method is very dependent on the initial condition since it uses a gradient-based optimization algorithm. I like to use the Fourier space method to estimate a prior for the chi-squared method. The final offset is dependent on the shape of the data and initialization to varying degrees depending on your signal.

For your problem, you'll want to estimate a lag time in between the two signals using either of the methods. The MIDI and microphone signal must have similar looking waveforms in order to align them properly. Otherwise, you'll end up aligning two arbitrary peaks or something. Depending on how large of an offset you expect I would suggest making the region of interest 2-3x larger than the offset