Audio using Processing 2...

     I am going to show the basic work with audio file using Processing language to play on an android device. It is pretty easy but very interesting to work on. Here is my code and I am going to explain my code using ‘//’ (comment) before every lines.

//Maxim is called for creating the audio environment. I named it maxim
Maxim maxim;

//Called AudioPlayer to make my player.
AudioPlayer player;

//This method called to play the specific audio file named “Drum.wav”. I used Audacity to record my sound to stereo type mono. We always have to save audio file on the scratch folder named “data”.
void setup()
  size(640, 960);
  maxim = new Maxim(this);
  player = maxim.loadFile("Drum.wav");

//Android device always plays loop, so I have closed the loop. Now the sound plays once.

//This method knows when mouse pressed or screen tap happens
void mousePressed()

  //This line randomly changes the player speed to play in different presentation.

  player.speed(random(0.1, 2));

No comments:

Post a Comment