# Help with incorporating mic inputs into my visuals

**URL:** https://discourse.processing.org/t/help-with-incorporating-mic-inputs-into-my-visuals/33448
**Category:** Coding Questions
**Created:** [November 10, 2021, 9:46pm UTC](https://discourse.processing.org/t/help-with-incorporating-mic-inputs-into-my-visuals/33448 "2021-11-10T21:46:45Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![YourLocalGrandma](https://avatars.discourse-cdn.com/v4/letter/y/c4cdca/32.png) [@YourLocalGrandma](https://discourse.processing.org/u/YourLocalGrandma)
#### Post date: [November 10, 2021, 9:46pm UTC](https://discourse.processing.org/t/help-with-incorporating-mic-inputs-into-my-visuals/33448/1 "2021-11-10T21:46:45Z")

</div>

Hi Guys, would love it if someone could point me in the right direction here because I’m very stuck. My goal is to use the mic inputs to move the amplitude of the lines across the screen, creating sort of a sound visualisation on top of the camera thing. Been struggling big time with keeping the camera effect whilst trying to implement this, so any help would be greatly appreciated!

This is my code so far 🙂

```auto
import processing.video.*;
import processing.sound.*;

Capture cam;
AudioIn input;
Amplitude analyzer;

void setup()
{
  size(displayWidth, displayHeight);
  stroke(255);
  strokeWeight(2);
  noFill();
  smooth(4);
  pixelDensity(displayDensity());

  input = new AudioIn(this, 0);
  input.start();
  analyzer = new Amplitude(this);
  analyzer.input(input);

  String[] cameras = Capture.list();
  cam = new Capture(this, displayWidth, displayHeight);
  cam.start();
}

void draw() {
  background(50);
  cam.read();
  cam.loadPixels();

  float vol = analyzer.analyze();
  float loud = vol*200;
  println(loud);

  for (int y = 0; y < cam.height; y +=11) // replacing the 11 with loud (using volume*50 not volume*200), the whole thing crashes
  {
    beginShape();
    for (int x = 0; x < cam.width; x += 7)
    {
      int pixel = cam.pixels[x + y*cam.width];
      float c = map(blue(pixel), 0, 255, 0, 20); //so far I have replaced the 20 here with loud, which sort of works but isnt really what im looking for.

      curveVertex(x, y-c); //replacing x, y or c with loud doesnt work either.
    }
    endShape();
  }
}

```
