>>11662871OP.
This is exactly what you need to understand what you're doing right here.
You need to produce waves that cancel out at 180degrees (so opposite waves).
Waves = sound.
i.e. if I have a positive peak of a wave that goes to +1, you would need a wave that goes to -1 to cancel out that wave.
Different instruments or sounds are at different frequencies, so you can cancel out a specific sound at a frequency if you know the negative inverse.