Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
farrahzakir
farrahzakir's Profile
1
Posts
0
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Audio Mixer
[0 Replies]
01-Jul-2013 08:46 AM
Forum:
Share your Work
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.signals.*;
PImage img;
Minim minim;
AudioPlayer song0;
AudioPlayer song1;
AudioPlayer song2;
AudioPlayer song3;
AudioPlayer song4;
FFT fft;
PFont f;
String typing = "";
void setup()
{
img = loadImage("mixer.jpg");
size(512, 200);
f = createFont("Arial",10,true);
minim = new Minim(this);
song0 = minim.loadFile("jazz.wav", 512);
song1 = minim.loadFile("rock.wav", 512);
song2 = minim.loadFile("classical.wav", 512);
song3 = minim.loadFile("pop.wav", 512);
song4 = minim.loadFile("indian.wav", 512);
fft = new FFT(song0.bufferSize(), song0.sampleRate());
fft = new FFT(song1.bufferSize(), song1.sampleRate());
fft = new FFT(song2.bufferSize(), song2.sampleRate());
fft = new FFT(song3.bufferSize(), song3.sampleRate());
fft = new FFT(song4.bufferSize(), song4.sampleRate());
}
void draw()
{
image(img,0,0);
fft.forward(song0.mix);
fft.forward(song1.mix);
fft.forward(song2.mix);
fft.forward(song3.mix);
fft.forward(song4.mix);
for(int i = 0; i < song0.left.size() - 1; i++)
{
stroke(255, 0, 0, 125);
line(i, 50 + song0.left.get(i)*50, i+1, 50 + song0.left.get(i+1)*50);
line(i, 150 + song0.right.get(i)*50, i+1, 150 + song0.right.get(i+1)*50);
}
for(int i = 0; i < song1.left.size() - 1; i++)
{
stroke(255, 255, 0, 129);
line(i, 50 + song1.left.get(i)*50, i+1, 50 + song1.left.get(i+1)*50);
line(i, 150 + song1.right.get(i)*50, i+1, 150 + song1.right.get(i+1)*50);
}
for(int i = 0; i < song2.left.size() - 1; i++)
{
stroke(255, 255, 255, 128);
line(i, 50 + song2.left.get(i)*50, i+1, 50 + song2.left.get(i+1)*50);
line(i, 150 + song2.right.get(i)*50, i+1, 150 + song2.right.get(i+1)*50);
}
for(int i = 0; i < song3.left.size() - 1; i++)
{
stroke(0, 0, 255, 128);
line(i, 50 + song3.left.get(i)*50, i+1, 50 + song3.left.get(i+1)*50);
line(i, 150 + song3.right.get(i)*50, i+1, 150 + song3.right.get(i+1)*50);
}
for(int i = 0; i < song4.left.size() - 1; i++)
{
stroke(255, 100, 0, 128);
line(i, 50 + song4.left.get(i)*50, i+1, 50 + song4.left.get(i+1)*50);
line(i, 150 + song4.right.get(i)*50, i+1, 150 + song4.right.get(i+1)*50);
}
textFont(f);
fill(255);
text("Click in this applet and: Press 'j' for Jazz, 'r' for Rock, 'c' for Classical, 'p' for Pop, 'i' for Indian Mix", 25, 100);
}
void keyPressed() {
if (key == 'j' ) {
song0.play();
song0.loop();
typing = "";
}
if (key == 'r' ) {
song1.play();
song1.loop();
typing = "";
}
if (key == 'c' ) {
song2.play();
song2.loop();
typing = "";
}
if (key == 'p' ) {
song3.play();
song3.loop();
typing = "";
}
if (key == 'i' ) {
song4.play();
song4.loop();
typing = "";
}
}
void stop()
{
song0.close();
song1.close();
song2.close();
song3.close();
song4.close();
minim.stop();
}
«Prev
Next »
Moderate user : farrahzakir
Forum