The Ninja of feudal Japan were skilled in the unorthodox arts of war — they were excellent assassins. No matter how large or skilled the Shogun's army of Samurai he was still vulnerable to Ninja attack.
Castles built for conventional feudal warfare had defenses such as high walls and moats that are useless against a Ninja. So how do you defend a castle from Ninja?
One way developed by the Shogun (Tokugawa) was Nightingale Floors — floors that make a loud chirping sound when you walk on them. Nijo Castle (the primary Kyoto residence of the Tokugawa Shoguns) is full of them.
Nightingale floors are designed so that the flooring nails rub against a metal clamp, causing chirping noises. The noises are activated at the slightest pressure on the floor boards.
These are security devices aimed specifically at ninja assassins. The nightingale floors of Nijo Castle are fully functional today — continuing to chirp hundreds of years after their construction. They're a hit with the tourists who can resist taking a peak under the floor boards.