def convert_audiofile_to_audiofile(inputfilepath, outputfilepath,
    outputformat=None, inputformat=None):
    """ Convert an audiofile into a new audiofile with a different format

    Parameters
    ----------
    inputfilepath: string
    outputfilepath: string
    outputformat: dictionary, None (default)
        A dictionary of parameters that the conversion library (sox) uses to
        determine the output format (in addition to filename extension). Valid
        keys are: file_type, rate, bits, channels, encoding, comments,
        append_comments.
    inputformat: dictionary, None (default)
        A dictionary of parameters that the conversion library (sox) uses to
        determine the input format. This is primarily useful when dealing
        with audio files without a file extension. Overwrites any previously
        set input file arguments. If this function is not explicitly called the
        input format is inferred rom the file extension or the file's header.
        Valid keys are file_type, rate, bits, channels, encoding,
        ignore_length.

    Examples
    --------
    >>>convert_audiofile('noise.wav', 'noise.mp3')
    >>>convert_audiofile('noise.wav', 'noise_16bits.wav',
    ...                  outputformat={'bits: 16'})
    >>>convert_audiofile('noise', 'noise.mp3',
    ...                  inputformat={'filetype': 'wav')

    """
    import sox
    tfm = sox.Transformer(inputfilepath, outputfilepath)
    if outputformat is not None:
        tfm.set_output_format(**outputformat)
    if inputformat is not None:
        tfm.set_input_format(**inputformat)
    tfm.build()
