Book Image

Processing 2: Creative Coding Hotshot

By : Nikolaus Gradwohl
Book Image

Processing 2: Creative Coding Hotshot

By: Nikolaus Gradwohl

Overview of this book

Processing makes it convenient for developers, artists, and designers to create their own projects easily and efficiently. Processing offers you a platform for expressing your ideas and engaging audiences in new ways. This book teaches you everything you need to know to explore new frontiers in animation and interactivity with the help of Processing."Processing 2: Creative Coding Hotshot' will present you with nine exciting projects that will take you beyond the basics and show you how you can make your programs see, hear, and even feel! With these projects, you will also learn how to build your own hardware controllers and integrate devices such as a Kinect senor board in your Processing sketches.Processing is an exciting programming environment for programmers and visual artists alike that makes it easier to create interactive programs.Through nine complete projects, "Processing 2: Creative Coding Hotshot' will help you explore the exciting possibilities that this open source language provides. The topics we will cover range from creating robot - actors performing Shakespeare's "Romeo and Juliet", to generating objects for 3D printing, and you will learn how to run your processing sketches nearly anywhere from a desktop computer to a browser or a mobile device.
Table of Contents (16 chapters)
Processing 2: Creative Coding Hotshot
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Can you hear me?


In the first task for this mission, we will write a Processing sketch that plays an MP3 file and uses the Minim library to access the played samples. We will use this data to write an oscilloscope-like curve. We will then use the fft class of Minim to calculate the frequency spectrum of the currently played sound and generate a bar graph to visualize it.

Engage Thrusters

Let's give Processing ears:

  1. Create a new Processing sketch and add a setup() and a draw() method.

    void setup() {
    }
    
    void draw() {
    }
  2. Add the import statements for the Minim library by navigating to Sketch | Import Library ... | minim.

  3. Now we need to add an MP3 file to our sketch by navigating to Sketch | Add File ... or by simply dropping it onto the sketch window.

  4. Add an AudioPlayer object to your sketch and initialize it in the setup() method.

    import ddf.minim.spi.*;
    import ddf.minim.signals.*;
    import ddf.minim.*;
    import ddf.minim.analysis.*;
    import ddf.minim.ugens.*;
    import ddf.minim.effects.*;
    
    Minim minim;
    AudioPlayer...