17
ModulatorP5 Make your sketches more dynamic with Modulators

Modulator p5: Make your Processing Sketches More Dynamic with Modulators

Embed Size (px)

Citation preview

ModulatorP5Make your sketches more dynamic with Modulators

Why ModulatorP5?

Inspired by my experience as an electronic musician.

Driven out of creating sketches for a performance at the Milwaukee Avenue Arts Fest.

I missed LFO’s (Low Frequency Oscillators.)

Also wanted an easy way to “tap in” to audio analysis data without a lot of work.

Why a Processing library?

Building a Processing library isn’t nearly as hard as it might look.

It pushes all the boilerplate repetitive code out of your sketch, and into one definitive place.

An easy way to get access to the power of Java, while keeping your sketches feeling “light-weight.”

What can it do?

Sine/Cosine and Perlin Noise LFO-type Modulators with adjustable rate and modulation amount.

Audio Analysis Modulator with adjustable frequency range, easing and modulation amount.

Add a control UI for any Modulator in one line of code.

Modulation

Sine Modulator modulating Particle Size.

Modulation with UI

Sine Modulator modulating Particle Size.

The Code - Setup// “this” is a reference to the sketch (PApplet)

minim = new Minim(this);

input = minim.getLineIn();

controlP5 = new ControlP5(this);

modP5 = new ModulatorP5(this, controlP5, minim, input);

The Code - OscillatorModulator sizeOsc = modP5.createCosineOscillator() .setMinRange(0) .setMaxRange(120) .setMinRate(0.0) .setMaxRate(0.5);

The Code - Control PanelmodP5.createControlPanel(20, 200, "P-Size (Osc)", sizeOsc);

No other code is needed!

I wanted ModulatorP5 to require a fair amount of configuration and setup in setup() up front.

Once it is up and running, nothing needs to be done in the draw() loop.

That’s not quite true - behind the scenes ModulatorP5 taps into the draw() loop, but it’s hidden from your sketch.

Audio Analysis

One caveat. There is a lot of room for improvement in the current version of the Audio Analysis code, both in the API and under the hood.

Audio Analysis comes down to picking a frequency range, easing, and modulation amount.

Currently supported frequency ranges are: sub-bass, bass, mids and highs.

Audio Analysis

Audio Analyzer modulating Particle size.

Audio Analysis with UI

The Code analyzer = modulatorP5.createAudioAnalyzer()

.setMinRange(0)

.setMaxRange(160)

.setEasing(0.2);

modP5.createControlPanel(20, 20, "P-Size (Anaylzer)", analyzer);

Plans for the future

Remove the ControlP5 dependency and replace with a custom UI.

Support more diverse waveforms like Saw, Square, Sample-and-hold, and maybe simple FM synthesis.

More sophisticated audio analysis, including setting frequency start and end bands, and multi-band analysis returning an array of values.

Don’t be afraid to dive in and build your own library.

Even if you’re the only one who is ever going to use it.

Push overly complicated logic out of your sketches.

Reuse your code!

Get more ambitious with your architecture, with Java you get generics, interfaces, enums and more.

The Processing Library Template for Eclipse gets you up and running quickly.

Contribute!ModulatorP5http://github.com/nathankoch/ModulatorP5