Manual: Effectable
The Effectable interface defines methods that allow adding, removing, and manipulating the state of AudioEffects. It looks a lot like a Collection. The methods are:
// Adds an effect to the effects chain. void addEffect(AudioEffect effect) // Removes all effects from the effect chain. void clearEffects() // Disables effect if it is in the chain. void disableEffect(AudioEffect effect) // Disables the ith effect in the effect chain. void disableEffect(int i) // Returns the number of effects in the chain. int effectCount() // Enables all effects currently attached to this. void effects() // Enables effect if it is in the chain. void enableEffect(AudioEffect effect) // Enables the ith effect in the effect chain. void enableEffect(int i) // Returns the ith effect in the effect chain. AudioEffect getEffect(int i) // Returns true if effect is in the chain. boolean hasEffect(AudioEffect effect) // Returns true if at least one effect in the chain is enabled. boolean isEffected() // Returns true if effect is in the chain and is also enabled. boolean isEnabled(AudioEffect effect) // Disables all effects currently attached to this. void noEffects() // Removes effect from the effects chain. void removeEffect(AudioEffect effect) // Removes and returns the ith effect in the effect chain. AudioEffect removeEffect(int i)
Note that there is no way to insert an effect into a particular slot. Effects are always added to the end of the effect list. The number of effects that can be added does not have a limit, other than memory. Processing time will also be a factor if effects are complex.
Code Sample (online example)
import ddf.minim.*; import ddf.minim.effects.*; AudioPlayer groove; LowPassFS lpfilter; WaveformRenderer waveform; void setup() { size(512, 200); // always start Minim first Minim.start(this); groove = Minim.loadFile("groove.mp3", 512); groove.loop(); waveform = new WaveformRenderer(); // see the example Recordable >> addListener for more about this groove.addListener(waveform); // see the example AudioEffect >> LowPassFSFilter for more about this lpfilter = new LowPassFS(300, groove.sampleRate()); // add the effect to the player groove.addEffect(lpfilter); } void draw() { background(0); waveform.draw(); } void stop() { // always close Minim audio classes when you are done with them groove.close(); // always stop Minim before exiting Minim.stop(); super.stop(); }