rewrite the resampling loop; speex resampler seems to glitch when given a small number of samples, which the previous code would do sometimes