suppose I have a sample of a snare and that snare is used in a song,¿ there is an algorithm or tool that detects the sound of the snare and subtracts it, that is to say that cancels its phase or eliminates it?.

the result would be the song without the snare sound.

this could also apply to (accordion trumpets or any other instrument)

  • $\begingroup$ what Hilmar said. the problem is that if you hit your snare twice, with exactly the same force, the two sampled recordings will not be the same, even if they sound identical and the envelopes look the same. if you tried subtracting the second snare hit from the first, all you will get is another snare hit. you will not get zero. $\endgroup$ Jul 23, 2019 at 23:04
  • $\begingroup$ You can try some sparse decomposition techniques (NMF, PLCA), assuming that you have access to snare-only track. $\endgroup$
    – jojeck
    Dec 15, 2020 at 10:54
  • $\begingroup$ A fundamental question is how close the snare (or any other) sound that's used in the song is to the sample you have and how much other stuff is going on acoustically. If it's very close (and hitting the same snare twice is definitively totally not close), you can try to use cross-correlation to determine the sound's locations in the song and then subtract the sample at these locations. As others have already mentioned, the sounds usually are very different, resulting in a very hard to solve problem that is still subject to ongoing research. $\endgroup$
    – applesoup
    Apr 14, 2021 at 18:17
  • $\begingroup$ I wrote my PhD thesis on exactly this and it is a very hard problem to solve. The most effective tools to separate stems from stereo are deep learning based, but that is not my area of interest or expertise. $\endgroup$
    – orchi_d
    May 9, 2022 at 20:11

3 Answers 3


This is a good example of a "simple" problem which is easy to describe to very difficult to solve, and I don't see a direct solution but will put somethings here since this question was bumped.

In the communication systems world, there is a notion of interference cancellation. The idea is that a transmitter is trying to communicate with a receiver but there may also be some interference signal(s). You could model like so:

$ r(t) = s(t) + i(t) + w(t) $

where $s(t)$ is the "signal of interest" (your music without the snare drum), $i(t)$ is the interference signal(s) (the snare drum), and $w(t)$ is the noise. Interference cancellation is the process of, at the receiver, estimating the interference, re-creating it, and subtracting it from $r(t)$ so that hopefully you are left with only $s(t)+w(t)$. But, because the cancellation is not perfect, ie. the interference signal is not perfectly re-created, you are actually left with $s(t)+(i(t)-\hat{i}(t))+w(t)$, where $\hat{i}(t)$ is the estimated interference.

This sort of thing seems to suit your needs, so what is the problem? This interference cancellation technique relies heavily, almost entirely, on being able to very accurately estimate the interference signal parameters. And the estimation relies heavily on being able to write out equations for the interference signal. This is something that would be hard to do for a snare drum (I would think), and would give a weird sounding result.

Another option, perhaps if you observe the snare drum occupies frequencies that the rest of the music does not, you may try filtering. I don't think this would be very promising though.

Something else: place the drummer far enough away from the rest of the band, setup your recording studio with a microphone array and place a nice null in the direction of the drummer!...


That's a really hard problem. If you have access to the original snare stem and the amount of post processing (effects, panning, mastering) is moderate you may be able to pull some of it out with an adaptive filter.

There are a few commercial plug ins that do this type of thing, but they all have their strengths and weaknesses so it depends a bit on your specific needs


If your song is generated by trigging known samples (using eg a MIDI sequencer) and no effects (compressor) applied, then the problem should be relatively straight forward.

For the case of real instruments with subtle variations…. Not so much. Some machine learning variant of blind source separation?


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.