'Unable to set input source' p5.AudioIn()

I am trying to grab my speakers/headphones audio in a p5 sketch I am writing to analyze the sound playing on my system. I can use the AudioIn.getSources() method to return an array of sources, the first of which is listed as the “default” audio device on my computer. I am trying to use AudioIn.setSource() to set the audio source to that first item instead of my onboard mic. However, I am getting the error message ‘unable to set input source’ when executing my sketch. I have tried to set it to the other three sources, giving me the same error message. Does anyone know why that might be?

var audioIn;
var fft;

function setup() {
    createCanvas(256, 256);
    colorMode(HSB);

    //new AudioIn
    audioIn = new p5.AudioIn();

    //get audio sources
    console.log(audioIn.getSources());

    //set source for audioIn to first item in device list, usually the default/speakers in Windows
    audioIn.setSource(0);

    //connect to speakers
    audioIn.connect();
    audioIn.start();

    //new fft object
    fft = new p5.FFT(.9, 64);
}