# A question about the import of minim files

**URL:** <https://discourse.processing.org/t/a-question-about-the-import-of-minim-files/16542>\
**Category:** Libraries\
**Created:** [December 21, 2019, 7:10am UTC](https://discourse.processing.org/t/a-question-about-the-import-of-minim-files/16542 "2019-12-21T07:10:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![xianyu](https://avatars.discourse-cdn.com/v4/letter/x/5f9b8f/32.png) [@xianyu](https://discourse.processing.org/u/xianyu)\
**Post date:** [December 21, 2019, 7:10am UTC](https://discourse.processing.org/t/a-question-about-the-import-of-minim-files/16542/1 "2019-12-21T07:10:00Z")

</div>

Hi!  
I am a beginner in processing. I had some problems when importing audio files using minim. The file name and location looks correct. Below is my code.

```auto
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;

Minim minim;
AudioPlayer song;

void setup()
{
  size(200,200);
  
  minim= new Minim( this );
  
  song = minim.loadFile("music-1.mp3",2048);
  
  song.play();
  
}
void draw()
{

}

```

Many thanks .!

 ![截屏2019-12-21下午3.15.48](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/ff43936817c01b5c4be220b1e541e4e98754c7af.png)

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 21, 2019, 7:27am UTC](https://discourse.processing.org/t/a-question-about-the-import-of-minim-files/16542/2 "2019-12-21T07:27:37Z")

</div>

> [@xianyu](#):
>
> The file name and location looks correct.

what is the real file location?  
could be sketch dir or data dir

what is the real file name?  
“music\_1.mp3”

---

<div class="post-metadata">

**Author:** ![xianyu](https://avatars.discourse-cdn.com/v4/letter/x/5f9b8f/32.png) [@xianyu](https://discourse.processing.org/u/xianyu)\
**Post date:** [December 21, 2019, 8:45am UTC](https://discourse.processing.org/t/a-question-about-the-import-of-minim-files/16542/3 "2019-12-21T08:45:17Z")

</div>

Files in the date folder, I just tried to use the microphone for input.  
Also have this problem.  
I don’t know if it is related to the macOS (catalina) I use.  
I hope it’s not a computer problem  
Thanks

```auto
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;

Minim minim;
AudioInput microphone;

void setup()
{
  size(500,500);
  
  minim= new Minim( this );
  
  microphone= minim.getLineIn();
  
}
void draw()
{
  float backgroundCol = microphone.mix.level() * 255.0 ;

  background(backgroundCol,backgroundCol,backgroundCol);
  
}

```

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 21, 2019, 9:10am UTC](https://discourse.processing.org/t/a-question-about-the-import-of-minim-files/16542/4 "2019-12-21T09:10:21Z")

</div>

if that is a problem about  
// a incompatible system / .vs. / a processing version //  
please not use any OWN code …  
just try using existing examples  
and tell us what works and what not

- mic
- camera
- file
- …

see also  
(eg. `Processing.app/Contents/Info.plist` )

---

<div class="post-metadata">

**Author:** ![xianyu](https://avatars.discourse-cdn.com/v4/letter/x/5f9b8f/32.png) [@xianyu](https://discourse.processing.org/u/xianyu)\
**Post date:** [December 21, 2019, 9:39am UTC](https://discourse.processing.org/t/a-question-about-the-import-of-minim-files/16542/5 "2019-12-21T09:39:24Z")

</div>

I just tried several cases on the processing official website  
Mostly no problem  
But the errors are basically in the aspect of file import  
No code error was detected before clicking Run  
but “NullPointerException” will be prompted when clicking Run  
and the running window cannot be closed

For example: Load and Display Image, film and mic  
ps: My first language is not English, so please forgive me for looking strange in my word

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 21, 2019, 10:53am UTC](https://discourse.processing.org/t/a-question-about-the-import-of-minim-files/16542/6 "2019-12-21T10:53:47Z")

</div>

no, my only point was, as long you test / post own code  
( also even you only copy from somewhere …)

10 people will read it / 5 people might even copy paste and test it /  
but never have the actual by you use file available…

what a waste of time if it is not code but system related…

when i say example i mean like:  
PDE / File / Examples / Contributed Libraries / Minim / Basics / PlayAFile [any key]  
PDE / File / Examples / Contributed Libraries / Minim / Basics / RecordAudioInput “TALK/SING” [r]

* * *

BUT if the provided examples for  
processing core or libraries regarding  
file / camera / sound / work, but your code not  
you not need us here,  
you can work on your own and compare a running example with your code.

* * *

for your above microphone code  
( in case you have no error, but just a blank screen )  
you might use a

```auto
  println(backgroundCol);

```

in draw to see your problem

i changed and combined it with the example and it works here  
( here: win 10 64bit / processing 3.5.3 64bit )

```auto
import ddf.minim.*;

Minim minim;
AudioInput mic;

void setup() {
  size(500, 200);
  minim= new Minim( this );
  mic= minim.getLineIn();
}
void draw() {  
  float backgroundCol = mic.mix.level() * 2000; //255.0 ;
  println(backgroundCol);
  background(backgroundCol, backgroundCol, backgroundCol);
  stroke(255);
  for (int i = 0; i < mic.bufferSize() - 1; i++) {
    line(i, 50 + mic.left.get(i)*50, i+1, 50 + mic.left.get(i+1)*50);
    line(i, 150 + mic.right.get(i)*50, i+1, 150 + mic.right.get(i+1)*50);
  }
}

```

---

<div class="post-metadata">

**Author:** ![xianyu](https://avatars.discourse-cdn.com/v4/letter/x/5f9b8f/32.png) [@xianyu](https://discourse.processing.org/u/xianyu)\
**Post date:** [December 22, 2019, 5:59am UTC](https://discourse.processing.org/t/a-question-about-the-import-of-minim-files/16542/7 "2019-12-22T05:59:53Z")

</div>

thank you!  
My problem has been solved!!
