One embodiment of the present invention sets forth an earplug for selectively providing sound to a user. The earplug includes a microphone, a processing unit, and a speaker. The microphone is configured to acquire ambient sound. The processing unit is configured to determine that a first sound included in the ambient sound is associated with a first set of sound parameters and, in response, generate a first cancellation signal associated with the first sound. The processing unit is further configured to determine that a second sound included in the ambient sound is associated with a second set of sound parameters and, in response, generate a second signal to cause the second sound to be produced. The speaker is configured to produce one or more sound waves based on the first cancellation signal to cancel the first sound from the ambient sound and produce the second sound based on the second signal.