The chemical reactions and pathways involving vanillin, an aromatic hydrocarbon which occurs naturally in black vanilla bean pods and can be obtained as a by-product of the pulp and paper industry by the oxidative breakdown of lignin.