Manual: Special Classes

[Note: this section of the manual pertains to the recent Beta Release of Minim and not to the version currently being distributed with Processing.]

We’ve created some special classes in order to make putting things together easier for you.

Frequency

The Frequency class was created in order to make it easy to convert between different representations of a note’s frequency. Using the Frequency class, you can specify the frequency in Hertz, MIDI note number, or pitch name (as a String) and receive the frequency in Hertz or MIDI note number.

Take a look at the pitchNameExample and midiFreqExample to see a bit of how this works.

Waves

We also created a class called Waves to make it easy to generate lots of different waveforms. With the Waves class, you have access to a perfect sine, triangle, saw, or square wave. You can also create waves based on

- a perfect triangle, saw, or square wave with one of the zero-crossings shifted in time
- the first N harmonics of a triangle, saw, or square wave
- the first N harmonics or N odd harmonics with random amplitudes
- random noise
- N impulses placed randomly in silence
- a weighted combination of these

You can also build waves using function generators similar to several of those found in Csound.

The example waveformExample uses lots of different methods from the Waves class, but you should look at the JavaDocs directly to see all of the options available to you.

For those who would like to dig just a bit deeper, in Minim, oscillators currently repeat Waveforms. A Waveform is an interface that simply requires that the value over the Waveform can be found by an at() method which has a float argument between 0 and 1. The Wavetable class is one implementation of the Waveform interface. A Wavetable is effectively an array which returns an interpolated value based on the index of the at() method. Waves is a class which includes many ways to build Waveforms using Wavetables.