def ulaw2lin(cp, size): _check_size(size) rv = ffi.new("unsigned char[]", len(cp) * size) result = ffi.buffer(rv) for i, value in enumerate(cp): sample = lib.st_ulaw2linear16(ord(value)) _put_lin_sample(result, size, i, sample) return result[:]