Bob Cowdery: I don't know what your bug is, but this is bad D code: > r = lib_speex_encode(cast(short*)smpls, cast(char*)bytes); Use the "ptr" field of D arrays: r = lib_speex_encode(smpls.ptr, bytes.ptr); Bye, bearophile