Minim icon indicating copy to clipboard operation
Minim copied to clipboard

How to normalize input?

Open joshbg2k opened this issue 5 years ago • 1 comments

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 avatar Mar 29 '20 03:03 joshbg2k

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.

joshbg2k avatar Mar 29 '20 18:03 joshbg2k