1
$\begingroup$

I am working on a problem that requires interpolating between two music files. One music file is very similar to a delayed version of the other.

I would like the 'average' of the two signals to sound like the music delayed an intermediate amount, with mixing between some other properties (like the frequency profile)

If I average them in the time domain, I hear two copies of the music signal, one delayed after the other.

If I average in the frequency domain, get the same thing (linearity of DFT)

If I average the magnitudes and phases separately, I get garbage.

I tried averaging the magnitudes, and then computing the time-delay at each frequency bin from the unwrapped phase. Then, I tried averaging the time delays for each frequency bin, and reconstructing the signal by converting the averaged time delays into phases. This also gave me garbage.

How do you do this?

$\endgroup$
3
  • 2
    $\begingroup$ Why don't you just line them up in time before averaging ? $\endgroup$
    – Hilmar
    Commented Aug 14, 2023 at 11:46
  • $\begingroup$ @Hilmar is right. You don't really want an average of the signals, you most probably want a signal that is delayed by a time which is equal to the average delay between the two files. This is not averaging. You may want to either use some kind of cross-correlation (or other delay finding) technique to align the two first and average them (if this is indeed what you are after) or use some type of Dynamic Warping Technique to make them look as much as possible identical and then average. $\endgroup$
    – ZaellixA
    Commented Aug 14, 2023 at 13:33
  • $\begingroup$ "I would like the 'average' of the two signals to sound like the music delayed an intermediate amount, with mixing between some other properties (like the frequency profile)." You need to be more specific than this if you want good help with your problem. $\endgroup$ Commented Aug 14, 2023 at 18:57

2 Answers 2

1
$\begingroup$

I don't think I thoroughly understand what your actual goal is. By the way, if you sum two copies of the same signal together you get a typical comb effect, that starts to be perceived as a delay when the time delay of the two copies gets higher than around 20ms.

If you just want to average the two signals, you can compute their delay in time domain (trivially, computing the peak of their cross-correlation), align and sum them.

$\endgroup$
2
  • $\begingroup$ Assuming that the delay is constant. $\endgroup$
    – user67664
    Commented Aug 17, 2023 at 8:32
  • $\begingroup$ @YvesDaoust correct, thank you! $\endgroup$
    – northgeist
    Commented Aug 17, 2023 at 8:35
0
$\begingroup$

@Northgeist gave a reasonable reply for actual averaging.

If you mean «morphing» more like morphing an image of a monkey into a human face, then you probably need a more «parametric» description of each song. Like you would get it they were both MIDI files and you gradually adjusted e.g. tempo and pitch from one to the other.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.