A device for generating a magnetic field, the device comprises a coil configured to respond to an electric current, a magnetic core comprising poles configured to generate a magnetic field close to the poles, wherein the magnetic field makes a paramagnetic gas component vibrate and emit an acoustic signal, wherein the magnetic core is surrounded at least partly by the coil, and a substrate at least partly covered by the magnetic core and the coil.