  We present a protocol for directly detecting time-dependent magnetic field
waveforms with a quantum two-level system. Our method is based on a
differential refocusing of segments of the waveform using spin echoes. The
sequence can be repeated to increase the sensitivity to small signals. The
frequency bandwidth is intrinsically limited by the duration of the refocusing
pulses. We demonstrate detection of arbitrary waveforms with $\sim 20 {\rm ns}$
time resolution and $\sim 4\mu{\rm T}/\sqrt{\rm Hz}$ field sensitivity using
the electronic spin of a single nitrogen-vacancy center in diamond.
