Waveform compression