def get_num_of_rows(dur, n_rows, sr):
    """Return total number of samples. If dur is set, return dur*sr, if num_samples is set, return num_samples, 
    if both set, raise an AttributeError. Only use one of the two. 
    """
    if dur and n_rows is None:
        return int(dur * sr)
    elif dur is None and n_rows is None:
        return int(sr)
    elif n_rows and dur is None:
        return int(n_rows)
    else:
        raise AttributeError(
            'Only use either dur or n_rows to specify the number of rows of the signal.'
            )
