def float_wav_to_short(wav):
    """
    Given a float waveform, return a short waveform.
    The input waveform will be clamped between -1 and 1.
    """
    return (wav.clamp(-1, 1) * (2**15 - 1)).short()