# Minim Exercise HELP

**URL:** https://discourse.processing.org/t/minim-exercise-help/9492
**Category:** Libraries
**Created:** [March 20, 2019, 8:01pm UTC](https://discourse.processing.org/t/minim-exercise-help/9492 "2019-03-20T20:01:53Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![JoseBri93](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@JoseBri93](https://discourse.processing.org/u/JoseBri93)
#### Post date: [March 20, 2019, 8:01pm UTC](https://discourse.processing.org/t/minim-exercise-help/9492/1 "2019-03-20T20:01:54Z")

</div>

Hi Everybody!  
I’ve just started playing with Minim Library and I’m struggling with an exercise i found here ([http://responsivedesign.de/wp-content/uploads/2016/05/tutorial-06\_processing-soundmapping2.pdf](http://responsivedesign.de/wp-content/uploads/2016/05/tutorial-06_processing-soundmapping2.pdf)). In a few words, it transforms audio data (a music file) into graphic animation. Based on that, my goal is to record audio as my input data (which i did somehow) and let the graphics go all the X-axis and descends by steps. I can’t see where im missing so i’d appreciate your help very much.

```auto
import ddf.minim.*;

Minim minim;
AudioInput in;

int spacing = 16;
int border = spacing*6;
int amplification = 10;
int y = spacing;
float ySteps;

void setup() {
  size(800,800);
  background(255);
  strokeWeight(1);
  noFill();
  
  minim = new Minim(this);
  in = minim.getLineIn();
}

void draw() {
  int screenSize = int((width-2*border)*(height-1.5*border)/spacing); //seteo bordes
  int x = int(map(in.bufferSize() -1, 0, in.sampleRate(), 0, screenSize));
  
  ySteps = x/(width-2*border);
  x -= (width-2*border)*ySteps;
  
  float frequency = in.mix.get(int(x))*spacing*amplification;
  
  for(int i = 0; i < in.bufferSize() -1; i++) {
    ellipse(x+border, y*ySteps+border, frequency, frequency);
  }
}

```

---

<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: [March 25, 2019, 1:44am UTC](https://discourse.processing.org/t/minim-exercise-help/9492/2 "2019-03-25T01:44:17Z")

</div>

> [@JoseBri93](#):
>
> go all the X-axis and descends by steps.

Do you mean that you want the output to wrap around and move down by a line – like a typewriter or a text box?

Here is a simple example of wrapping cursor logic. It also jumps from the bottom of the page to the top.

```auto
/**
 * discourse.processing.org/t/audio-visualization-minim-exercise/9492
 * 2019-03-24 Processing 3.4
 **/

CursorBox point;

void setup() {
  size(400, 400);
  float margin=40;
  point = new CursorBox(margin, margin, width-2*margin, height-2*margin);
  point.step = new PVector(20, 20);
}

void draw() {
  point.render();
  point.advance();
}

class CursorBox {
  PVector cursor;
  PVector step;
  float x;
  float y;
  float w;
  float h;

  CursorBox(float x, float y, float w, float h) {
    this.x = x;
    this.y = y;
    this.w = w;
    this.h = h;
    cursor = new PVector(0, 0);
    step = new PVector(10, 10);
  }

  void advance() {
    cursor.x += step.x;
    this.bounds();
  }

  void bounds() {
    if (cursor.x > w) { // carriage return
      cursor.x = 0;
      cursor.y += step.y;
    }
    if (cursor.y > h) {
      cursor.y = 0;
    }
  }

  void render() {
    ellipse(cursor.x + x, cursor.y + y, random(step.x), random(step.y));
  }
}

```

![cursorbox-frame](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/a54393fa8d052dee914e92bab76ee448377ea702.png)

---

<div class="post-metadata">

### Author: ![JoseBri93](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@JoseBri93](https://discourse.processing.org/u/JoseBri93)
#### Post date: [March 29, 2019, 4:13am UTC](https://discourse.processing.org/t/minim-exercise-help/9492/3 "2019-03-29T04:13:18Z")

</div>

Thanks Jeremy! I’ll re-write my code. I havent found the problem with my sketch but i will i guess

---

<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: [March 29, 2019, 4:41am UTC](https://discourse.processing.org/t/minim-exercise-help/9492/4 "2019-03-29T04:41:41Z")

</div>

Are you just trying to run sketch\_06\_01 from the PDF? What specifically is the problem you are having? Do you have an audio file in the sketch folder?

---

<div class="post-metadata">

### Author: ![JoseBri93](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@JoseBri93](https://discourse.processing.org/u/JoseBri93)
#### Post date: [March 29, 2019, 5:35am UTC](https://discourse.processing.org/t/minim-exercise-help/9492/5 "2019-03-29T05:35:39Z")

</div>

No, my sketch is a variation from the example of the PDF. In my sketch, im trying to move figures down by a line in the x-axis. The frequency values of my audio input(a record source) will affect the figures size as they continue moving by a line and descends by steps in y-axis. I hope i’ve been clear in my answer.

---

<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: [March 29, 2019, 3:09pm UTC](https://discourse.processing.org/t/minim-exercise-help/9492/6 "2019-03-29T15:09:58Z")

</div>

Okay, so your goal is for figures to fall like rain, in y?  
Or to move in x+y, like going down stairs?

---

<div class="post-metadata">

### Author: ![JoseBri93](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@JoseBri93](https://discourse.processing.org/u/JoseBri93)
#### Post date: [March 29, 2019, 6:30pm UTC](https://discourse.processing.org/t/minim-exercise-help/9492/7 "2019-03-29T18:30:08Z")

</div>

Yes, the second one. like you said earlier before, i want the output to wrap around and move down by a line — like a typewriter. like Yours example. Its just that i dont know how to apply that skecth into mine 😕
