def make_carrier_tone(freq, db, dur, samplerate, caldb=100, calv=0.1):
    """
    Produce a pure tone signal

    :param freq: Frequency of the tone to be produced (Hz)
    :type freq: int
    :param db: Intensity of the tone in dB SPL
    :type db: int
    :param dur: duration (seconds)
    :type dur: float
    :param samplerate: generation frequency of tone (Hz)
    :type samplerate: int
    :param caldb: Reference intensity (dB SPL). Together with calv, provides a reference point for what intensity equals what output voltage level
    :type caldb: int
    :param calv: Reference voltage (V). Together with caldb, provides a reference point for what intensity equals what output voltage level
    :type calv: float
    :returns: tone, timevals -- the signal and the time index values
    """
    if samplerate <= 0:
        raise ValueError("Samplerate must be greater than 0")
    if caldb <= 0:
        raise ValueError("Calibration dB SPL must be greater than 0")

    npts = int(dur * samplerate)
    amp = (10 ** ((db - caldb) / 20) * calv)
    if USE_RMS:
        amp *= 1.414213562373

    if VERBOSE:
        print(
        "current dB: {}, fs: {}, current frequency: {} kHz, AO Amp: {:.6f}".format(db, samplerate, freq / 1000, amp))
        print("cal dB: {}, V at cal dB: {}".format(caldb, calv))

    tone = amp * np.sin((freq * dur) * np.linspace(0, 2 * np.pi, npts))

    timevals = np.arange(npts) / samplerate

    return tone, timevals