waveform calculation