'Returns a PortAudio format constant for the specified `width`.
:param width: The desired sample width in bytes (1, 2, 3, or 4)
:param unsigned: For 1 byte width, specifies signed or unsigned format.
:raises ValueError: for invalid `width`
:rtype: A |PaSampleFormat| constant.'

def get_format_from_width(self, width, unsigned=True):

    if (width == 1):
        if unsigned:
            return paUInt8
        else:
            return paInt8
    elif (width == 2):
        return paInt16
    elif (width == 3):
        return paInt24
    elif (width == 4):
        return paFloat32
    else:
        raise ValueError(('Invalid    width:    %d' % width))
