Code for playing sounds on placing magnets