Nod Bang: Data Smoothing

Posted on
nodbang ixd intro to pcomp itpnyu

I’ve mostly been working on smoothing and mapping accelerometer data for the past week.

Link to project description

Recursive Smoothing

My main goal this week has been to range and smooth the data into a useable state.

I’m using recursive smoothing that weights new values much less than old values.

int smooth(int old_val, int new_val) {
  float perc = .1;
  float new_smooth = float(old_val) * ( 1 - perc) + new_val * ( perc);
  return int(new_smooth);
}

I’m also now dynamically tracking the max, min, and midpoint of the data to avoid hardcoding values that might not always work.

You can see the max, min, midpoint, and a few levels of recursion plotted below:

The grey data is after two iterations of recursion and is visibly smoother than the other, less smoothed, streams.

Mapping to LED

After a few additional transformations, the accelerometer data is mapped to LED brightness values. I’m aiming to match brightness with the trough of the nodding motion.

Above, you can see the LED glowing in response to me nodding my head and changing color when I press down on the button.

The data that resulted from the brightness mapping looks pretty useable for nod detection. I’ll try to use this in the future.

Next Steps: MIDI

After discussing my concept with my professor, Jeff Feddersen, and a couple other students, I’ve refined the definitions of the components for the project.

The accelerator and buttons will be a self contained USB MIDI controller. It will keep my options open for the music half of the project.

I’m currently still planning to build the musical components in Max, but I’ve also been playing around with Ableton Live this week and found it enjoyable to use. If Max for Live can cover my needs, building the looping tracks in Ableton would allow me to make it sound much better than building it in entirely in Max.