What to do for Project 2? Objectives • • • • Tie back to Processing Work with classes Present a creative challenge Work with a different programming language Well three out of four objectives ain’t bad Many Processing Libraries • • • • • • • Video Serial PDF Export OpenGL Arduino Minim Audio Many more Minim • A Processing library that uses JavaSound API, Tritonus, and MP3SPI to provide an easy to use audio library. • Features: – – – – – – – AudioPlayer: for playback of WAV, AIFF, AU, SND, & MP3 files. AudioMetaData: for metadata about a file, such as ID3 tags. AudioSignal: for writing your own sound synthesis AudioRecorder: for audio recording AudioEffect: for writing your own audio effects. FFT: for doing spectrum analysis. BeatDetect: for doing beat detection. A Sound Theory • Mike Ruiz’s Sound Applets • Minim FFT Amplitude Frequency Music Visualization using Minim • Options: – Use the wave form – Use the FFT (on previous slide) – Use BeatDectect Explained Here The BeatDetect Class (by Example) (SOUND_ENERGY mode) import ddf.minim.*; import ddf.minim.analysis.*; Minim minim; AudioPlayer song; BeatDetect beat; void setup() { minim = new Minim(this); song = minim.loadFile("TicketToRide.mp3"); song.play(); beat = new BeatDetect(); beat.setSensitivity(100); } void draw() { beat.detect(song.mix); if( beat.isOnset() ) { … } … } void stop() { song.close(); minim.stop(); super.stop(); } Example Program The BeatDetect Class (by Example) (FREQ_ENERGY mode) import ddf.minim.*; import ddf.minim.analysis.*; Minim minim; AudioPlayer song; BeatDetect beat; BeatListener bl; class BeatListener implements AudioListener { private BeatDetect beat; private AudioPlayer source; … } void setup() { minim = new Minim(this); song = minim.loadFile("TicketToRide.mp3", 32768); song.play(); beat = new BeatDetect(song.bufferSize(), song.sampleRate()); beat.setSensitivity(200); bl = new BeatListener(beat, song); } … Buffer size must be a power of 2 Example Program A Little Insight into Beat Detection • Use the drawGraph() method to see the energy levels. • Example program Project 2 • Presented at the time of our final: Tuesday, May 3 @11:30 • Project 2 • Seniors, please talk to me about the due date. Resources • • • • • • • • Main documentation Processing Page Examples Minim Code Log Examples Doorbell example by Daniel Shiffman Audio Processing Examples by Dan Ellis Vimeo video tutorial 4 and video tutorial 5 OpenProcessing Examples Beatles Ukulele Project (a source of .mp3 files)