A method for counteracting the occlusion effect of an electronic device delivering an audio signal to the ear, like a hearing aid or an active ear protector, where the electronic device includes a transmission path with an external microphone or input line which receives a signal from the environment and an signal processor and a receiver which receives processes signal from the signal from the signal processor and delivers sound signals to the ear, whereby an ear piece is inserted into the ear canal and totally or partially blocks the canal. The sound conditions in the cavity between the ear piece and the tympanic membrane are directly or indirectly determined, and whenever condition leading to occlusion problems are determined, the transmission characteristics of the transmission path or the receiver changes in order to counteract the occlusion effect.