Make sure to use List[int] as described in the error message. Afterwards, you would run into another type mismatch, since the value is expected as a float and lastly you would have to annotate the inputs since n_max would be expected as a Tensor otherwise.
This should work:
@torch.jit.script
def pad_audio(tensor, n_max=50000):
    # type: (Tensor, int)  -> Tensor
    diff_pad = int(n_max - len(tensor))
    tensor = F.pad(tensor, [int(diff_pad/2), diff_pad - int(diff_pad/2)], 'constant', 0.)
    return tensor