ddf / Minim

A Java audio library, designed to be used with Processing.
http://code.compartmental.net/tools/minim
GNU Lesser General Public License v3.0
668 stars 136 forks source link

How to normalize input? #108

Open joshbg2k opened 4 years ago

joshbg2k commented 4 years ago

I am trying to draw a waveform using microphone input, and I'd like to narrow the dynamic range of the prior to drawing the waveform. I'm working on an app where a lively waveform is important, so if user A has a low volume coming into the app, and user B has a really loud volume coming into the app, they each get a relatively consistent waveform.

I've combed the docs but I'm still not quite sure if this is possible.

joshbg2k commented 4 years ago

I'll answer my own question, here's a quick example:

public void draw() {
  table = new Wavetable(out.mix.toArray());
  table.normalize();
  println(table.getWaveform()[***any array index***]);
}

Hope this helps someone.