# Adding the Spout code to my sketch (audio input visualizer)

**URL:** <https://discourse.processing.org/t/adding-the-spout-code-to-my-sketch-audio-input-visualizer/14531>\
**Category:** Libraries\
**Created:** [October 8, 2019, 8:08pm UTC](https://discourse.processing.org/t/adding-the-spout-code-to-my-sketch-audio-input-visualizer/14531 "2019-10-08T20:08:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![addybart](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@addybart](https://discourse.processing.org/u/addybart)\
**Post date:** [October 8, 2019, 8:08pm UTC](https://discourse.processing.org/t/adding-the-spout-code-to-my-sketch-audio-input-visualizer/14531/1 "2019-10-08T20:08:17Z")

</div>

Hello there. I’m new to Processing and struggling to add the Spout code to my sketch (an audio input visualizer) to get it to show up in Resolume 6.

I can get the Spout demo to work in Resolume but it’s pure guesswork as to what parts of the code I should paste into my sketch, and where it belongs. I’ve tried looking at the code in a few other examples but it hasn’t helped clarify things.

I’m unsure what else to do to progress further with this. Could someone give me a hand? This is what I’ve got:

```auto
/**
* This sketch demonstrates how to monitor the currently active audio input 
* of the computer using an AudioInput. What you will actually 
* be monitoring depends on the current settings of the machine the sketch is running on. 
* Typically, you will be monitoring the built-in microphone, but if running on a desktop
* it's feasible that the user may have the actual audio output of the computer 
* as the active audio input, or something else entirely.
* <p>
* Press 'm' to toggle monitoring on and off.
* <p>
* When you run your sketch as an applet you will need to sign it in order to get an input.
* <p>
* For more information about Minim and additional features, 
* visit http://code.compartmental.net/minim/ 
*/

import ddf.minim.*;

Minim minim;
AudioInput in;

void setup()
{
size(1920, 1080, P3D);

minim = new Minim(this);

// use the getLineIn method of the Minim object to get an AudioInput
in = minim.getLineIn();
}

void draw()
{
background(0);
stroke(255);

// draw the waveforms so we can see what we are monitoring
for(int i = 0; i < in.bufferSize() - 1; i++)
{
line( i, 450 + in.left.get(i)*50, i+1, 450 + in.left.get(i+1)*150 );
line( i, 550 + in.right.get(i)*50, i+1, 550 + in.right.get(i+1)*150 );
}

String monitoringState = in.isMonitoring() ? "enabled" : "disabled";
text( "Input monitoring is currently " + monitoringState + ".", 5, 15 );
}

void keyPressed()
{
if ( key == 'm' || key == 'M' )
{
if ( in.isMonitoring() )
{
in.disableMonitoring();
}
else
{
in.enableMonitoring();
}
}
}

```

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [October 19, 2019, 3:42am UTC](https://discourse.processing.org/t/adding-the-spout-code-to-my-sketch-audio-input-visualizer/14531/2 "2019-10-19T03:42:03Z")

</div>

OP found information for a solution here:

[https://resolume.com/forum/viewtopic.php?f=12&t=13824&p=77106#p77106](https://resolume.com/forum/viewtopic.php?f=12&t=13824&p=77106#p77106)
