To shut out sounds, the thing that seems to work for me is to play thunderstorm sounds. Because it's got a high degree of randomness across the frequency spectrum, and its spectrum varies over short timescales, external noise is masked even if it's still audible - because the brain can easily fit it into the thunderstorm pattern. Whereas if I'm annoyed by something, my brain will pick it out from behind music in listening to, even if it's quieter.
When I'm hearing someone else's thump thump music and my ear buds aren't sufficient to block it, that's the only thing I've found to work.
It's real rain noise - if you pay attention to it, you can hear the drops - but it's overall a nice white noise that isn't the "boring" white noise.
> ... Our recording has been performed in the silence of the night, in a huge space - namely the Harau Valley in Sumatra - and in the absence of any wind, as to produce the most even noise one can get.
I built a white noise site which has a load of sounds which can help in a similar way (including thunder): https://ambiph.one
I find the 'bass rumble' and brown noise particularly useful for masking external noise, which I guess is pretty similar to a thunderstorm frequency-wise
When I'm hearing someone else's thump thump music and my ear buds aren't sufficient to block it, that's the only thing I've found to work.