# How to recover signal repeated throughout other signal?

I have an audio signal that contains, at various time offsets, various other short audio signals, often repeated, in addition to other audio content. Here is an example of how that could look like:

   0  1  2  3  4  5  6  7  8  9
A: x        x              x
B: x                       x
C:       x  x


This terrible representation shows that A and B appear at 0 seconds, C appears at 2 seconds, A and C appear at 3 seconds and so on. These signals will additionally be scaled at every occurrence (their amplitude could be different at each occurrence) and possibly have an amplitude envelope applied to them.

Is there an algorithm to recover that takes all the position of the occurrences and recovers (to the best of its ability) A, B, and C?

To be more explicit in the task I have to solve, I have an old electronic music track I produced, but I lost the project file. Like most electronic music, it's a mix of synthesized (pseudoperiodic) sounds, electronic drums hits (called, confusingly, samples), vocals, effects and maybe some acoustic instrument. All those signals get summed together and processed in a "mastering chain": the thing relevant to this problem is that dynamic processing is applied to increase the average loudness, and saturation (in the case of this track, just soft clipping) is added to squeeze another bit of volume.

I need to change one of the drum hits. I don't need to recover it perfectly, because even if a bit of the old drum hit and a bit of noise is still there, the new drum hit that I'm going to replace it with will cover it.

• PS: I don't actually know much about signal processing, but I've stumbled on it after having this problem and I'm starting to study it. Fire away whatever math wizardry is needed and I'll be happy to study more! Also feel free to tell me if this is dumb and impossible :P – user29639 Jul 9 '17 at 16:00
• that representation isn't terrible at all :) What does the "scale" within "will […] be scaled at every occurence" mean? – Marcus Müller Jul 9 '17 at 16:03
• It means that at 0 seconds it could be A, while at 3 seconds it could be 0.8 * A. How do I write that more properly? – user29639 Jul 9 '17 at 16:07
• "it's amplitude could be different at each occurrence", but reading it again, I might be the only one who would not understand it like that the first time :) – Marcus Müller Jul 9 '17 at 16:12
• You can perhaps attack this using non-negative matrix factorization. Please see this question: dsp.stackexchange.com/questions/35878/… and script here: nbviewer.jupyter.org/gist/ingle/… – Atul Ingle Jul 9 '17 at 16:54