  Magnetometers based on ensembles of nitrogen-vacancy centres are a promising
platform for continuously sensing static and low-frequency magnetic fields.
Their combination with phase-sensitive (lock-in) detection creates a highly
versatile sensor with a sensitivity that is proportional to the derivative of
the optical magnetic resonance lock-in spectrum, which is in turn dependant on
the lock-in modulation parameters. Here we study the dependence of the lock-in
spectral slope on the modulation of the spin-driving microwave field. Given the
presence of the intrinsic nitrogen hyperfine spin transitions, we
experimentally show that when the ratio between the hyperfine linewidth and
their separation is $\gtrsim 1/4$, square-wave based frequency modulation
generates the steepest slope at modulation depths exceeding the separation of
the hyperfine lines, compared to sine-wave based modulation. We formulate a
model for calculating lock-in spectra which shows excellent agreement with our
experiments, and which shows that an optimum slope is achieved when the
linewidth/separation ratio is $\lesssim 1/4$ and the modulation depth is less
then the resonance linewidth, irrespective of the modulation function used.
