def lin2alaw(cp, size): _check_params(len(cp), size) rv = ffi.new("unsigned char[]", _sample_count(cp, size)) for i, sample in enumerate(_get_lin_samples(cp, size)): rv[i] = lib.st_linear2alaw(sample) return ffi.buffer(rv)[:]