Browsing articles tagged with " Audio Interaction"
Cong Box v1. Another example of sound interacting with shape generation.
This example is using OPENGL to generate a cube.
Using the minim library I have integrated sound to make it decrease and increase in size.
Below is the source code:
/**I created a cube that is colored
using RGB values when settings the vertex positions.
I am using the minim library to change the size of the cube.
I also textured the cube in Normalized mode.
On top of this I left two sides untextured to give a cool glitchy seethrough effect.
LIKE A G6.
This 3d shape interacts with sound and is textured.
**/
import processing.opengl.*;
import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
int si = 30;
PFont fontA;
int var1 = 200;
PImage img;
Minim minim;
AudioOutput out;
SineWave sine;
AudioPlayer music;
float xmag, ymag = 0;
float newXmag, newYmag = 0, i;
float il = 0;
float il2 = 0;
void setup()
{
size(500, 500, OPENGL);
strokeWeight(3);
stroke(0);
textureMode(NORMALIZED);
img = loadImage("img.jpg");
minim = new Minim(this);
music = minim.loadFile("music.mp3", 2048);
// get a line out from Minim, default sample rate is 44100, default bit depth is 16
out = minim.getLineOut(Minim.STEREO, 2048);
fontA = loadFont("HERO.vlw");
// create a sine wave Oscillator, set to 440 Hz,
//at 0.5 amplitude, sample rate 44100 to match the line out
//sine = new SineWave(440, 0.5, out.sampleRate());
// add the oscillator to the line out
//out.addSignal(sine);
music.play();
}
void draw()
{
textFont(fontA, 32);
stroke(int(random(255)), int(random(255)), int(random(255)));
if(frameCount % 5 == 0){
background(255);
}
if(frameCount % 1700 < 20 && frameCount > 1700){
//this creates a really awesome feedback glitch
music = minim.loadFile("music.mp3", 2048);
music.play();
}
println(frameCount);
pushMatrix();
translate(width/2, height/2, -30);
newXmag = mouseX/float(width) * TWO_PI;
newYmag = mouseY/float(height) * TWO_PI;
float diff = xmag-newXmag;
if (abs(diff) > 0.01) { xmag -= diff/4.0; }
diff = ymag-newYmag;
if (abs(diff) > 0.01) { ymag -= diff/4.0; }
rotateX(-xmag);
rotateY(-ymag);
il = music.left.get(1)*100;
il2 = music.right.get(1)*100;
float outs = il+il2;
if(outs < 40){
outs = 40;
}
scale(outs);
beginShape(QUADS);
texture(img);
vertex(-1, 1, 1, 0, 0);
vertex( 1, 1, 1, 1, 0);
vertex( 1, -1, 1, 1, 1);
vertex(-1, -1, 1, 0, 1);
vertex( 1, 1, 1, 0, 0);
vertex( 1, 1, -1, 1, 0);
vertex( 1, -1, -1, 1, 1);
vertex( 1, -1, 1, 0, 1);
vertex( 1, 1, -1, 0, 0);
vertex(-1, 1, -1, 1, 0);
vertex(-1, -1, -1, 1, 1);
vertex( 1, -1, -1, 0, 1);
vertex(-1, 1, -1, 0, 0);
vertex(-1, 1, 1, 1, 0);
vertex(-1, -1, 1, 1, 1);
vertex(-1, -1, -1, 0, 1);
vertex(-1, 1, -1);
vertex( 1, 1, -1);
vertex( 1, 1, 1);
vertex(-1, 1, 1);
vertex(-1, -1, -1);
vertex( 1, -1, -1);
vertex( 1, -1, 1);
vertex(-1, -1, 1);
endShape();
popMatrix();
fill( int(random(255)), int(random(255)), int(random(255)));
stroke( int(random(255)), int(random(255)), int(random(255)));
text("Cong Box v1.0", width/2-100, 30 );
}
void stop()
{
// always close Minim audio classes when you are done with them
out.close();
minim.stop();
super.stop();
}
void musicalVar()
{
stroke(255);
// draw the waveforms
for(int i = 0; i < out.bufferSize() - 1; i++)
{
line(i, 50 + out.left.get(i)*50, i+1, 50 + out.left.get(i+1)*50);
line(i, 150 + out.right.get(i)*50, i+1, 150 + out.right.get(i+1)*50);
}
}
Get In touch!
Latest Posts
- Playing Fritzing and arduino. 2 push buttons and 2 LEDs with a basic arduino script.
- I dont want to use office365 thanks goldsmiths.
- How to create an Android application and submit it to the market pdf guide.
- Xtreme Simon – A multiplatform Memory/Concentration game!
- Processing Tutorial 7 – Android accelerometer and you
- Long cat the game
- Processing Tutorial 6 – Android Processing Basics and 3D texturing
- Biography and Contact Information
- OpenFrameworks Research
- Jump ‘n’ tilt
- E1 Android App
- creating a signed app using the processing export
- Installing and Compiling Ant
- Processing Tutorial 5 – Basic 3D
- Processing Tutorial 4 – lets create something useful
- Processing Tutorial 3 – Using Methods
- Worlds first Bionic arm
- Processing Tutorial 2 – Basic Shapes
- Processing Tutorial 1 – Getting to know Processing
- SHAFT
- Sounds generative walls.
- ROK Android App
- Blob the Defender Alpha v0.0001
- Dance Projection Lights.
- Cong Box v1. Another example of sound interacting with shape generation.
- I dreamt in code… is this normal? better keeping a notepad and pen next to my bed.
- A World Of Creation
- Illustrations
focus
Android
ant
Audio Interaction
audiovisual
banner
blob the defender
compiling
compiling ant
Computer Science
Computing
Contact Details
Creative Computing
Digital Illustration
discourse
draw
dreaming in code
game
Goldsmiths
ide
Illustration Project
Illustrations
Image Manipulation
increments
installing
interactive
Java
jdk
Market
Minim
PFont
platformer
Processing
Processing Discourse
Processing IDE
programming
ptutorials
ROK Universal
SHAFT
sidescrolling
tutorial
tutorials
Typography
University Of London
variables
windows 7





