Why does slowing down audio introduce aliasing? I have an 8khz mono buffer of samples, and I am trying to manipulate the playback speed of it by modifying the number of samples in it.  When slowing down (a speedScale value of 0.5 for example) then the values are repeated-- a buffer of samples: [0.1, 0.2, 0.3..] becomes [0.1, 0.1, 0.2, 0.2, 0.3, 0.3 ..].  When I do this, although the speed has slowed down correctly, I am noticing aliasing happening.  I was under the impression that repeating samples like this would not require low pass filtering to avoid aliasing.  Am I doing something wrong?

Here's the code for slowing-down/speeding-up:

function process(buffer, speedScale) {
    size = ceil(buffer.size / speedScale);

    counter = 0.0;
    ratio = 1 * speedScale;
    processed = [];

    for (i = 0; i &lt; size; i++) {
        index = floor(counter);
        processed[i] = buffer.samples[index];
        counter += ratio;
    }
    return processed;
}
That's because you are interpolating the signal. Take a look at this figure:



This is zero interpolation, i.e. inserting zeros between samples, but applies to your case too. The replicas at 2*pi are distorting your signal. You can see them in the third graph, at -2pi/L, +2pi/L. So, you need a low pass filter with a cut off frequency pi/L, after expander. 

In your case, the expander's output dtft will be X(w*2) + exp(-jw)*X(w*2), assuming input signal's dtft X(w). So, your extrapolator output will look a bit different, but the idea is the same.