To keep fish from becoming psychotic, it's highly recommended to use external HOB tank filters where the hum and vibration of the aquarium filter and electric pump is more isolated outside the tank.
Sound that’s generated underwater stays underwater; very little sound passes from water to air. So you won't hear much when your loud filter motor is underwater. When your head is out of the water and you listen to a sound made underwater, you don’t hear much. But if you put your head under the water, the sound becomes much louder.
You also feel more of a sound when you’re underwater. Above the surface, the sound waves only vibrate your eardrum (unless the sound is very loud). When your head is submerged, your skull also vibrates with the sound because it's close to the same density and elasticity as water. Below the surface, sound waves pass directly through the water and into your head. These are all significant considerations for fish.
Water is a good conductor of sound. For starters, sound can travel through water up to five times faster than it travels through air. When a sound is carried to you through the air, you judge the location of its source by comparing when the sound reaches one ear versus the other. But when you’re under water, the sound travels so fast that it reaches both ears at almost the same time.