1

I was doing an "live-audio-visualizer" in Processing. Everything is working fine except of this:
Even if I don't play any music/sound in the background my program shows that there is sound. I don't know why this happens..
Here's my code:

import ddf.minim.analysis.*;
import ddf.minim.*;

Minim minim;
AudioInput in;
int buffer_size = 512;
float sample_rate = 44100;
FFT fft;

void setup()
{
  size(480, 600);
  minim = new Minim(this);
  in = minim.getLineIn(Minim.MONO,buffer_size,sample_rate);
  fft = new FFT(in.bufferSize(), in.sampleRate());
  fft.window(FFT.HAMMING);
}

void draw()
{
  background(0);
  stroke(255);

  fft.forward(in.mix);
  for(int i = 0; i < fft.specSize(); i++)
  {
    ellipse(i, 300, 1, fft.getBand(i) * 100);
  }

  float current = fft.getBand(0) * 100;
  stroke(255, 0, 0);
  rect(200, 300, 20, -current);
}

Edit: By now I played around a bit and found out, that I'm analyzing the output and the input, but i just want the output.. how can I do that?

32byTe
  • 23
  • 1
  • 4
  • Are you on a Mac? Reading http://code.compartmental.net/minim/audioinput_class_audioinput.html An AudioInput is a connection to the current record source of the computer. How the record source for a computer is set will depend on the soundcard and OS, but typically a user can open a control panel and set the source from there. Unfortunately, **there is no way to set the record source from Java**. This is particularly **problematic on the Mac because the input will always wind up being connected to the Mic-In**, even if the user has set the input differently using their audio control panel. – francis Mar 19 '19 at 19:28
  • Thanks, I'm using Windows. So should I try C# and WinApi? If yes, could you send me some links with help? – 32byTe Mar 19 '19 at 20:03
  • I found a nice Video how to do that (with source code) Here's the link: https://www.youtube.com/watch?v=sOm6PdKJsdc – 32byTe Mar 19 '19 at 20:24

0 Answers0