31
edits
No edit summary |
No edit summary |
||
Line 55: | Line 55: | ||
Code for the randomized music in processing (failed working) | |||
[[File:Imageeorjklgoijre.png|thumb|1216x1216px|Whole code:// Sprühflasche aktiviert und triggert Sensor | |||
// Sensor misst den Wert und je nach Wert wird Musik abgespielt | |||
// plant leader: "The days of humankind have ended, for plants have taken over again! Now it is our place to rule over the earth and weather!" | |||
// servant: "Oh my liege, how long we have waited for this moment to arrive! The downfall of humans has come!" | |||
// plant leader: "Woooohaha" | |||
// randomized music is played | |||
import ddf.minim.*; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
Minim minim; | |||
AudioPlayer currentPlayer; | |||
ArrayList<AudioPlayer> players = new ArrayList<AudioPlayer>(); | |||
ArrayList<Integer> playOrder; | |||
int currentIndex = 0; | |||
void setup() { | |||
size(400, 200); | |||
minim = new Minim(this); | |||
// Lade die Sound-Dateien | |||
players.add(minim.loadFile("Supertramp - It's Raining Again (cut).mp3")); | |||
players.add(minim.loadFile("Fools Garden - Lemon Tree (cut).mp3")); | |||
players.add(minim.loadFile("Singin' in the Rain (cut).mp3")); | |||
players.add(minim.loadFile("Rihanna - Umbrella ft. JAY-Z (cut).mp3")); | |||
players.add(minim.loadFile("Surface - Shower Me With Your Love (cut).mp3")); | |||
players.add(minim.loadFile("Jermaine Jackson, Pia Zadora - When the Rain Begins to Fall (cut).mp3")); | |||
players.add(minim.loadFile("Patrice Rushen - Forget Me Nots (cut).mp3")); | |||
players.add(minim.loadFile("Prince - Purple Rain (cut).mp3")); | |||
players.add(minim.loadFile("ProleteR - April Showers (cut).mp3")); | |||
players.add(minim.loadFile("Raindrops Keep Falling on my Head (cut).mp3")); | |||
players.add(minim.loadFile("The Weather Girls - It's Raining Men (cut).mp3")); | |||
// Erstelle eine zufällige Abspielreihenfolge | |||
playOrder = new ArrayList<Integer>(); | |||
for (int i = 0; i < players.size(); i++) { | |||
playOrder.add(i); | |||
} | |||
Collections.shuffle(playOrder); | |||
playNext(); | |||
} | |||
void draw() { | |||
background(50); | |||
fill(255); | |||
textSize(20); | |||
textAlign(CENTER, CENTER); | |||
text("Playing: " + playOrder.get(currentIndex), width/2, height/2); | |||
// Check, ob der aktuelle Song fertig ist | |||
if (currentPlayer != null && !currentPlayer.isPlaying()) { | |||
playNext(); | |||
} | |||
} | |||
void playNext() { | |||
// Stoppe den aktuellen Player | |||
if (currentPlayer != null) { | |||
currentPlayer.close(); | |||
} | |||
// Spiele den nächsten Song in der Reihenfolge ab | |||
currentIndex = (currentIndex + 1) % players.size(); | |||
int nextIndex = playOrder.get(currentIndex); | |||
currentPlayer = players.get(nextIndex); | |||
currentPlayer.play(); | |||
} | |||
void stop() { | |||
// Schließe Minim und die Audio-Player | |||
if (currentPlayer != null) currentPlayer.close(); | |||
minim.stop(); | |||
super.stop(); | |||
} | |||
//lackey: "Now no-one will poison our soil, sour the rains or starve us with droughts!" | |||
//plant leader: "It is time for me to call to the mighty weather being, for she will be our greatest ally! | |||
//plant leader: I must ensure a strong bond to reign in power over the lands with her!" | |||
//plant leader:(now loud, speaking to the weather being) "Oh great being of the seasons, ruler of the water and the ice, the flowers and the mice, I pledge my undying loyalty to thee!" | |||
// randomized music is played | |||
//weather b.: (loudly, reverbing from the skies) "I hear thee, my child of life and growth. | |||
//weather b.: It is thou I will take as my right hand, freed you have the holy land, of creatures that were cruel and bold, forever gone and left to mold. | |||
//weather b.: From now I will be free of mind, will do what makes the creatures sigh. They can call to me and I will send the weather that they need at hand." | |||
// randomized music is played | |||
//plant leader: "Oh gracious thing, I salute thee, please grant us growth and prosperity. For now, we seek a healthy rain, to make earth drink and bloom again!" | |||
//weather b.:"Your wish may be granted." | |||
// weather b’s lackey: "To your service, Ma’am"(summons rain) | |||
//(A loud thunder roams across the lands and an intense thunderstorm lets loose on the fields. The plants sigh.) | |||
// randomized music is played]] |
edits