3

can anybody help me? I don't know what happened:(

Heres the relevant part of the code:

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(600, 600);
  minim = new Minim ( this );
  microphone = minim.getLineIn();
}

void draw() 
{
  
  float backgroundCol = microphone.mix.level() * 255 *10;
  float rectSize = microphone.mix.level() * 800.0;
  background(backgroundCol,backgroundCol,backgroundCol);
 
}

Heres the relevant part of the error:

==== JavaSound Minim Error ====
==== Unable to return a TargetDataLine: unsupported format - PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian

=== Minim Error ===
=== Minim.getLineIn: attempt failed, could not secure an AudioInput.

NullPointerException

Please tell me where I'm doing wrong.

any N
  • 41
  • 3
  • 1
    what language is this? – Stultuske Dec 15 '21 at 13:01
  • 1
    @Stultuske looks like it's Java, but my question would be, what library is this? – James Dunn Dec 15 '21 at 13:04
  • @JamesDunn import statements in the class, or code without a class? either it's far from complete, java has made some serious changes or this isn't java – Stultuske Dec 15 '21 at 13:13
  • @Stultuske good point, I should have noticed that. – James Dunn Dec 15 '21 at 13:15
  • 1
    @James Dunn I think the library name is【Minim】,its a contributed library – any N Dec 15 '21 at 13:18
  • Please make this test just in case: before using `microphone` in the `draw` method, check if it's null. The issue may just be that it doesn't find your mic when you set it up. – laancelot Dec 15 '21 at 17:40
  • If you are using a Mac see if this is applicable to your project: https://discourse.processing.org/t/minim-audioinput-nullpointerexception/3557. On my Mac system it allowed me to get a value for the microphone; otherwise it was null when I checked it with 'println("microphone = ", microphone);' – apodidae Dec 16 '21 at 03:44

1 Answers1

1

Thanks, all. I found solution:https://github.com/ddf/Minim/issues/75

any N
  • 41
  • 3
  • Please provide also a brief explanation as your answer might be deleted if consists only of a link, see: https://stackoverflow.com/help/deleted-answers – git_gud Dec 17 '21 at 08:55