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

**URL:** <https://discourse.processing.org/t/unable-to-set-input-source-p5-audioin/17373>\
**Category:** Libraries\
**Created:** [January 27, 2020, 1:09pm UTC](https://discourse.processing.org/t/unable-to-set-input-source-p5-audioin/17373 "2020-01-27T13:09:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucca](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lucca/32/3139_2.png) [@Lucca](https://discourse.processing.org/u/Lucca)\
**Post date:** [January 27, 2020, 1:09pm UTC](https://discourse.processing.org/t/unable-to-set-input-source-p5-audioin/17373/1 "2020-01-27T13:09:40Z")

</div>

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?

```auto
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);
}

```
