Using effects
In the last recipe of this chapter, you'll learn how to use effects. These effects can be used to shape the waves of a synthesizer you are creating or to change the sound of an audio file.
How to do it...
The beginning of this sketch is the same as that of most of the sketches we've made in this chapter. You'll load an audio file and play it. The only difference is that we'll create a low pass and a high pass filter and add these effects to the AudioPlayer
object.
import ddf.minim.*; import ddf.minim.signals.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; Minim minim; AudioPlayer player; LowPassSP lowpass; HighPassSP highpass; void setup() { size( 640, 480 ); minim = new Minim( this ); player = minim.loadFile("song.mp3"); player.play(); lowpass = new LowPassSP( 440, 44100 ); player.addEffect( lowpass ); highpass = new HighPassSP( 440, 44100 ); player.addEffect( highpass ); } void draw() { background( 255 ); } void stop()...