So this has a lot going on. First this is my first go at using Processing libraries. Here's I'm using minim. When you mouse over the array list changes but when you click the music starts. Still working on a few bug but there you go.
“homework_library” by Veronica Black
https://openprocessing.org/sketch/74489
License CreativeCommons Attribution ShareAlike
https://creativecommons.org/licenses/by-sa/3.0
{{filePath}}
{{width}} x {{height}}
Report Sketch
Oh, that naughty sketch! Please let us know what the issue is below.
Apply Template
Applying this template will reset your sketch and remove all your changes. Are you sure you would like to continue?
Report Sketch
Report Comment
Please confirm that you would like to report the comment below.
We will review your submission and take any actions necessary per our Community Guidelines. In addition to reporting this comment, you can also block the user to prevent any future interactions.
Please report comments only when necessary. Unnecessary or abusive use of this tool may result in your own account being suspended.
Are you sure you want to delete your sketch?
Any files uploaded will be deleted as well.
Delete Comment?
This will also delete all the replies to this comment.
Delete this tab? Any code in it will be deleted as well.
Select a collection to submit your sketch
We Need Your Support
Since 2008, OpenProcessing has provided tools for creative coders to learn, create, and share over a million open source projects in a friendly environment.
Niche websites like ours need your continued support for future development and maintenance, while keeping it an ad-free platform that respects your data and privacy!
Please consider subscribing below to show your support with a "Plus" badge on your profile and get access to many other features!
CC Attribution ShareAlike
Archived Sketch
This sketch is created with an older version of Processing,
and doesn't work on browsers anymore.
View Source Code
homework_library
Black
xxxxxxxxxx
//CCLab Homework by Veronica Black
//Sept. 27th 2012
/* ---- Use a library to create an interesting audio-visual interaction --- */
/* --- I can make this work. Making the mouseX and mouseY create value --- */
//playing around
float soundX;
float soundY;
float easing = 0.5;
float pointX;
float pointY;
//minim
import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
//declaring audio
Minim minim;
AudioPlayer koshland2; //initialize rain sound
//class
// we delcare the objects
sound [][] mySound = new sound[30][30];
//setup
void setup(){
size(600, 600);
smooth();
minim = new Minim(this);
koshland2 = minim.loadFile("koshland2.mp3", 512); //load sounds
for (int i=0; i<mySound.length; i++) {
for (int j=0; j<mySound.length; j++) {
mySound [i][j]= new sound(30 * i, 30*j, 40);
// We assign the elements of the array, and we give it some propertie
}
}
}
void draw(){
background(255);
for (int i=0; i<mySound.length; i++) {
//playing around
/*float targetX = mouseX;
soundX += (targetX-soundX) * easing;
float targetY = mouseY;
soundY += (targetY-soundY) * easing;
float weight = dist(soundX, soundY, pointX, pointY);
line(soundX, soundY, pointX, pointY);
pointY = soundY;
pointX = soundX;*/
for (int j=0; j<mySound.length; j++) {
fill(0,mySound[i][j].mouseDist,0);
mySound[i][j].update(mouseX, mouseY);//method_update
mySound[i][j].display();//method_display
}
}
}
//http://www.openprocessing.org/sketch/69763
//thanks to Owen Herterich
void mouseReleased() { //if the mouse is released, stop the sound and reload it.
koshland2.close();
koshland2 = minim.loadFile("koshland2.mp3", 512);
koshland2.play();
}
//function for stopping sound when program exits
void stop() {
koshland2.close();
minim.stop();
super.stop();
}
See More Shortcuts