# Add sound instead microphone

**URL:** https://discourse.processing.org/t/add-sound-instead-microphone/39880
**Category:** Libraries
**Tags:** homework
**Created:** [November 26, 2022, 4:37am UTC](https://discourse.processing.org/t/add-sound-instead-microphone/39880 "2022-11-26T04:37:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![vrtx](https://avatars.discourse-cdn.com/v4/letter/v/e99b99/32.png) [@vrtx](https://discourse.processing.org/u/vrtx)
#### Post date: [November 26, 2022, 4:37am UTC](https://discourse.processing.org/t/add-sound-instead-microphone/39880/1 "2022-11-26T04:37:51Z")

</div>

Hi there, I am here again…  
Learning, Tks to all of you!  
I found a code exemple and a have change it adding my images and resizing it, resizing as a tool to manage my picture and feet the window.and add some ellipse on the screen.  
1 - Wy the ellipses out side (right side of the canva) don’t get back to the orinal form/size. Small as in the start?  
In the example, the image transform with the sound from microphone.  
2 - Add my music to image react;  
I have being trying to add/upload my own music .to be able to the image react from the computer.

here is the code i have already transfomed.

And after i will add a code form the exemple Transparency2 from processing library in this project.  
Thank you people!

```auto
import ddf.minim.*;

Minim minim;
AudioInput in;
//AudioPlayer som;

PImage img;
int smallPoint, largePoint;

void setup() {
  size(600, 600);

  minim = new Minim(this);
  // use the getLineIn method of the Minim object to get an AudioInput
  in = minim.getLineIn();
  // uncomment this line to *hear* what is being monitored, in addition to seeing it
  in.enableMonitoring();

  
  //som = AudioInput("trance chill.mp3");
  //som.loop();

  img = loadImage("eu elevador2.jpg");
  img.resize(350, 600);
  smallPoint = 2;
  largePoint = 50;
  imageMode(CENTER);
  stroke(#154BE8);
  noStroke();
  background(0);
}

void draw() {

  for (int i = 0; i < in.bufferSize() - 1; i++) {

    ellipse(20, 20, in.left.get(i)*200, in.left.get(i+1)*200); // top left on the image
    ellipse(320, 20, in.right.get(i)*200, in.right.get(i+1)*200);// top righ on the image
    ellipse(500, 500, in.left.get(i)*300, in.left.get(i+1)*300); // bottom right out of the image
    ellipse(500, 50, in.right.get(i)*300, in.right.get(i+1)*300); // top right out of image
    ellipse(500, 300, in.right.get(i)*300, in.left.get(i+1)*300); //middle rigth out image
    ellipse(30, 550, in.right.get(i)*300, in.left.get(i+1)*300); //on the image bottonleft
    fill(217, 21, 232, 150);

    if ((in.left.get(i)*50+in.right.get(i+1)*100/2) > 0) {

      float pointillize = (in.left.get(i)*200+in.left.get(i+1)*200);

      int x = int(random(img.width));
      int y = int(random(img.height));
      color pix = img.get(x, y);
      fill(pix, 128);
      ellipse(x, y, pointillize, pointillize);
    }
  }
}

```

---

<div class="post-metadata">

### Author: ![vrtx](https://avatars.discourse-cdn.com/v4/letter/v/e99b99/32.png) [@vrtx](https://discourse.processing.org/u/vrtx)
#### Post date: [November 26, 2022, 10:19am UTC](https://discourse.processing.org/t/add-sound-instead-microphone/39880/2 "2022-11-26T10:19:44Z")

</div>

this is the same code above. But I put the headphone near the microphne and it made some noise.  
What happened is that every time i copy the original code e criate a new one. with the same picture. Its make the first sound i recordered using a software to capture the screnn. wich is call OBS Studio.

What is happenig?  
even copying from the original code using a new images, diferents ones, the sound appear to be recordered indo the code…  
Can some of you try to check that out please?!

This is with the noise.  
thanks

```auto
import ddf.minim.*;

Minim minim;
AudioInput in;

PImage img;
int smallPoint, largePoint;

void setup() {
  size(600, 600);

  minim = new Minim(this);
  // use the getLineIn method of the Minim object to get an AudioInput
  in = minim.getLineIn();
  // uncomment this line to *hear* what is being monitored, in addition to seeing it
  in.enableMonitoring();

  img = loadImage("eu elevador2.jpg");
   img.resize(350, 600);
  smallPoint = 4;
  largePoint = 40;
  imageMode(CENTER);
  noStroke();
  background(0);
}

void draw() {
  for(int i = 0; i < in.bufferSize() - 1; i++) {
    ellipse(20, 20, in.left.get(i)*200, in.left.get(i+1)*200); // top left on the image
    ellipse(320, 20, in.right.get(i)*200, in.right.get(i+1)*200);// top righ on the image
    ellipse(500, 500, in.left.get(i)*300, in.left.get(i+1)*300); // bottom right out of the image
    ellipse(500, 50, in.right.get(i)*300, in.right.get(i+1)*300); // top right out of image
    ellipse(500, 300, in.right.get(i)*300, in.left.get(i+1)*300); //middle rigth out image
    ellipse(30, 550, in.right.get(i)*300, in.left.get(i+1)*300); //on the image bottonleft
    fill(217, 21, 232, 150);
    if((in.left.get(i)*200+in.left.get(i+1)*200/2) > 0){
      
      float pointillize = (in.left.get(i)*200+in.left.get(i+1)*200);
      
      int x = int(random(img.width));
      int y = int(random(img.height));
      color pix = img.get(x, y);
      fill(pix, 128);
      ellipse(x, y, pointillize, pointillize);
    }
  }
}

```

---

<div class="post-metadata">

### Author: ![vrtx](https://avatars.discourse-cdn.com/v4/letter/v/e99b99/32.png) [@vrtx](https://discourse.processing.org/u/vrtx)
#### Post date: [November 26, 2022, 10:21am UTC](https://discourse.processing.org/t/add-sound-instead-microphone/39880/3 "2022-11-26T10:21:33Z")

</div>

And this is the very original one.

```auto
import ddf.minim.*;

Minim minim;
AudioInput in;

PImage img;
int smallPoint, largePoint;

void setup() {
  size(640, 360);

  minim = new Minim(this);
  // use the getLineIn method of the Minim object to get an AudioInput
  in = minim.getLineIn();
  // uncomment this line to *hear* what is being monitored, in addition to seeing it
  in.enableMonitoring();

  img = loadImage("moonwalk.jpg");
  smallPoint = 4;
  largePoint = 40;
  imageMode(CENTER);
  noStroke();
  background(0);
}

void draw() {
  for(int i = 0; i < in.bufferSize() - 1; i++) {
    //ellipse(20,20,in.left.get(i)*200,in.left.get(i+1)*200);
    //ellipse(320,20,in.right.get(i)*200,in.right.get(i+1)*200);
    if((in.left.get(i)*200+in.left.get(i+1)*200/2) > 0){
      
      float pointillize = (in.left.get(i)*200+in.left.get(i+1)*200);
      
      int x = int(random(img.width));
      int y = int(random(img.height));
      color pix = img.get(x, y);
      fill(pix, 128);
      ellipse(x, y, pointillize, pointillize);
    }
  }
}

```
