Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- abstract class Visualization {
- abstract void setup();
- abstract void draw();
- }
- class Visualization1 extends Visualization {
- // Processing Sound-Painting Animation Inspired by Stockhausen
- // Shapes: Ovals, Rectangles, Lines
- // Music Articulation Mapped: Dynamics(Volume), Pitch, Rhythm, Timbre
- // Variables for animation control
- float pitch; // Represents pitch(mapped to y-position of shapes)
- float volume; // Represents dynamics(mapped to size of shapes)
- float rhythm; // Represents time intervals between shape changes
- float timbre; // Represents timbre(mapped to color)
- void setup() {
- size(800, 800);
- frameRate(30); // Control speed of animation
- noStroke();
- background(0);
- }
- void draw() {
- background(0, 30); // Slow fade effect to create smooth transitions
- // Simulate changes in pitch, volume, rhythm, and timbre dynamically
- pitch = map(sin(frameCount * 0.05), -1, 1, 0, height);
- volume = map(abs(sin(frameCount * 0.1)), 0, 1, 20, 200);
- rhythm = map(noise(frameCount * 0.01), 0, 1, 5, 50);
- timbre = map(sin(frameCount * 0.02), -1, 1, 0, 255);
- // Drawing ovals based on music articulation
- fill(timbre, 255 - timbre, 150, 150); // Color representing timbre
- ellipse(width / 2, pitch, volume, volume); // Oval with changing pitch and volume
- // Drawing rectangles to represent rhythm sections
- fill(255 - timbre, timbre, 200, 150);
- rect(random(width), pitch, rhythm, volume); // Random rectangles appearing based on rhythm
- // Adding lines for texture and structure(representing articulation nuances)
- stroke(255, 100);
- line(random(width), random(height), width/2, pitch);
- // Adding more complexity for layers, creating a Stockhausen-esque aesthetic
- if (frameCount % 50 == 0) {
- float rectSize = random(30, 100);
- fill(timbre, random(255), random(255), 200);
- rect(random(width), random(height), rectSize, rectSize);
- }
- }
- }
- class Visualization2 extends Visualization {
- // Processing Pointillistic Sound-Painting Inspired by Stockhausen
- // Pointillism within rhythm, pitch, and articulation
- int numPoints = 300; // Number of pointillist elements
- float[] x = new float[numPoints]; // X positions for points
- float[] y = new float[numPoints]; // Y positions for points(mapped to pitch)
- float[] sizes = new float[numPoints]; // Sizes representing articulation
- float[] lifeSpan = new float[numPoints]; // LifeSpan controls duration of shapes
- color[] colors = new color[numPoints]; // Color represents timbre
- void setup() {
- size(800, 800);
- frameRate(30);
- noStroke();
- initializePoints(); // Initialize all points
- }
- void initializePoints() {
- for (int i=0; i<numPoints; i++) {
- x[i] = random(width); // Random horizontal position
- y[i] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // Vertical mapped to pitch
- sizes[i] = random(5, 20); // Random size for articulation
- lifeSpan[i] = random(30, 100); // Each point's lifespan before disappearing
- colors[i] = color(random(255), random(255), random(255), 150); // Semi-transparent colors
- }
- }
- void draw() {
- background(0, 40); // Semi-fade for smoother transitions
- // Loop through all points and update based on musical ideas
- for (int i=0; i<numPoints; i++) {
- if (lifeSpan[i] > 0) {
- // Draw points representing individual sounds
- fill(colors[i]);
- ellipse(x[i], y[i], sizes[i], sizes[i]); // Draw an ellipse as a point
- lifeSpan[i] -= 1; // Reduce lifespan
- // Update position and articulation over time for a dynamic "sound-painting"
- x[i] += random(-1, 1); // Simulate slight movement in x(rhythmic instability)
- y[i] += random(-1, 1); // Simulate small fluctuations in y(pitch micro-variations)
- } else {
- // Respawn the point with new properties(like a new note or articulation)
- x[i] = random(width);
- y[i] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // Pitch change
- sizes[i] = random(5, 20); // New articulation size
- lifeSpan[i] = random(30, 100); // Reset lifespan
- colors[i] = color(random(255), random(255), random(255), 150); // New timbre color
- }
- }
- }
- }
- class Visualization3 extends Visualization {
- // Processing Pointillistic Music Texture Inspired by Stockhausen
- // Aesthetic: Pointillism applied to Rhythm, Pitch, and Articulation
- int numShapes = 400; // Number of shapes
- float[] x = new float[numShapes]; // X positions for shapes(time/rhythm)
- float[] y = new float[numShapes]; // Y positions for shapes(pitch)
- float[] sizes = new float[numShapes]; // Sizes representing articulation(dynamics)
- float[] lifeSpan = new float[numShapes]; // Life span of each shape
- float[] speeds = new float[numShapes]; // Speed of movement for rhythm variation
- color[] colors = new color[numShapes]; // Color representing timbre
- void setup() {
- size(800, 800);
- frameRate(30);
- noStroke();
- initializeShapes(); // Initialize shape positions, sizes, speeds, etc.
- }
- void initializeShapes() {
- for (int i=0; i<numShapes; i++) {
- x[i] = random(width); // Random horizontal position(rhythm/time)
- y[i] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // Vertical position mapped to pitch
- sizes[i] = random(5, 30); // Articulation(size) reflecting dynamics
- lifeSpan[i] = random(30, 150); // Random life span for rhythmic events
- speeds[i] = random(0.5, 2.5); // Random speed for rhythm variation
- colors[i] = color(random(255), random(255), random(255), 150); // Dynamic color(timbre)
- }
- }
- void draw() {
- background(0, 50); // A slightly fading background for smooth transitions
- for (int i=0; i<numShapes; i++) {
- if (lifeSpan[i] > 0) {
- // Apply articulation, pitch, and timbre to each shape
- fill(colors[i]);
- ellipse(x[i], y[i], sizes[i], sizes[i]); // Drawing an ellipse representing the sound gesture
- // Update movement and life span(reflecting dynamic rhythm and articulation)
- x[i] += random(-speeds[i], speeds[i]); // Movement represents slight rhythmic instability
- y[i] += random(-0.5, 0.5); // Slight fluctuations in pitch(micro-variations)
- sizes[i] += random(-0.2, 0.2); // Subtle size changes(dynamics in articulation)
- lifeSpan[i] -= 1; // Gradual fade-out of shape(decay of sound gesture)
- } else {
- // Respawn the shape with new properties(like a new note or articulation)
- x[i] = random(width);
- y[i] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // New pitch
- sizes[i] = random(5, 30); // New articulation size
- lifeSpan[i] = random(30, 150); // Reset life span
- speeds[i] = random(0.5, 2.5); // Reset speed for rhythm variation
- colors[i] = color(random(255), random(255), random(255), 150); // New timbre color
- }
- }
- // Occasionally draw additional lines or structures to represent complex textures
- if (frameCount % 50 == 0) {
- stroke(255, 100); // Lines in white, semi-transparent
- line(random(width), random(height), random(width), random(height)); // Random lines representing texture
- noStroke();
- }
- }
- }
- class Visualization4 extends Visualization {
- // Processing Sound-Painting with 3-6 Voices
- // Pointillism applied to Rhythm, Pitch, and Articulation(3-6 simultaneous gestures)
- int maxVoices = 6; // Maximum number of active voices at a time
- float[] x = new float[maxVoices]; // X positions for each shape
- float[] y = new float[maxVoices]; // Y positions for each shape(pitch)
- float[] sizes = new float[maxVoices]; // Sizes representing articulation(dynamics)
- float[] lifeSpan = new float[maxVoices]; // Life span of each shape
- float[] speeds = new float[maxVoices]; // Speed of movement for rhythm variation
- color[] colors = new color[maxVoices]; // Color representing timbre
- void setup() {
- size(800, 800);
- frameRate(30);
- noStroke();
- initializeVoices(); // Initialize positions, sizes, speeds, etc.
- }
- void initializeVoices() {
- for (int i=0; i<maxVoices; i++) {
- x[i] = random(width); // Random horizontal position(time/rhythm)
- y[i] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // Vertical position mapped to pitch
- sizes[i] = random(20, 50); // Larger articulation(size) representing dynamics
- lifeSpan[i] = random(50, 150); // Life span for rhythmic events
- speeds[i] = random(1, 3); // Random speed for rhythm variation
- colors[i] = color(random(255), random(255), random(255), 200); // Color representing timbre
- }
- }
- void draw() {
- background(0, 50); // Fading background for smooth transitions
- // Loop through all active voices and update them
- for (int i=0; i<maxVoices; i++) {
- if (lifeSpan[i] > 0) {
- // Draw shapes(voices) representing individual sounds
- fill(colors[i]);
- ellipse(x[i], y[i], sizes[i], sizes[i]); // Drawing an ellipse representing the sound gesture
- // Update movement, articulation, and life span
- x[i] += random(-speeds[i], speeds[i]); // Rhythmic movement
- y[i] += random(-0.5, 0.5); // Micro variations in pitch
- sizes[i] += random(-0.2, 0.2); // Subtle size changes for articulation
- lifeSpan[i] -= 1; // Reduce lifespan for fading out
- } else {
- // When a voice finishes, respawn it with new properties
- x[i] = random(width); // New position for rhythm
- y[i] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // New pitch
- sizes[i] = random(20, 50); // New articulation size
- lifeSpan[i] = random(50, 150); // New lifespan
- speeds[i] = random(1, 3); // New speed for rhythm variation
- colors[i] = color(random(255), random(255), random(255), 200); // New timbre color
- }
- }
- // Occasionally add lines to represent musical texture
- if (frameCount % 100 == 0) {
- stroke(255, 150); // Semi-transparent white lines for texture
- line(random(width), random(height), random(width), random(height)); // Random lines as accents
- noStroke();
- }
- }
- }
- class Visualization5 extends Visualization {
- // Processing Visual Texture inspired by "Iron Circle" Aesthetic
- // Includes ovals, rectangles, and lines representing short and long notes
- int maxVoices = 6; // Limit to 3-6 simultaneous shapes(voices)
- float[] x = new float[maxVoices]; // X positions for shapes
- float[] y = new float[maxVoices]; // Y positions for shapes(pitch)
- float[] sizes = new float[maxVoices]; // Sizes representing articulation(dynamics)
- float[] lifeSpan = new float[maxVoices]; // Life span of each shape
- float[] speeds = new float[maxVoices]; // Speed of movement for rhythm variation
- color[] colors = new color[maxVoices]; // Colors representing timbre
- boolean[] isRect = new boolean[maxVoices]; // Whether the shape is a rectangle or an oval
- boolean[] isLongNote = new boolean[maxVoices]; // Short vs. Long note(lifespan)
- void setup() {
- size(800, 800);
- frameRate(30);
- noStroke();
- initializeVoices(); // Initialize shapes' positions, sizes, and other properties
- }
- void initializeVoices() {
- for (int i=0; i<maxVoices; i++) {
- x[i] = random(width); // Random X position(time/rhythm)
- y[i] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // Vertical position mapped to pitch
- sizes[i] = random(20, 50); // Articulation(size) representing dynamics
- lifeSpan[i] = random(50, 150); // Random lifespan for rhythmic variation
- speeds[i] = random(1, 3); // Random speed for rhythm variation
- colors[i] = color(random(255), random(255), random(255), 200); // Color representing timbre
- // Randomly determine whether the shape is a rectangle or an oval
- isRect[i] = random(1) > 0.5;
- // Assign long vs. short note(longer lifespan for smoother, evolving sounds)
- isLongNote[i] = random(1) > 0.5;
- if (isLongNote[i]) {
- lifeSpan[i] += 100; // Extend the lifespan for longer notes
- }
- }
- }
- void draw() {
- background(0, 50); // Fading background for smooth transitions
- // Draw lines for layered transitions or texture, appearing every few frames
- if (frameCount % 50 == 0) {
- stroke(255, 100); // White semi-transparent lines
- line(random(width), random(height), random(width), random(height)); // Random lines as textural transitions
- noStroke();
- }
- // Loop through all active shapes(voices)
- for (int i=0; i<maxVoices; i++) {
- if (lifeSpan[i] > 0) {
- // Draw rectangles for sharp attacks or ovals for smooth articulations
- fill(colors[i]);
- if (isRect[i]) {
- rect(x[i], y[i], sizes[i], sizes[i]); // Rectangle for more structured, mechanical sound
- } else {
- ellipse(x[i], y[i], sizes[i], sizes[i]); // Oval for smoother, evolving sounds
- }
- // Update movement, articulation, and life span
- x[i] += random(-speeds[i], speeds[i]); // Rhythmic movement
- y[i] += random(-0.5, 0.5); // Micro-variations in pitch
- sizes[i] += random(-0.2, 0.2); // Subtle size changes for articulation
- lifeSpan[i] -= 1; // Reduce lifespan to fade out
- } else {
- // When a shape finishes, respawn it with new properties
- x[i] = random(width); // New position(time/rhythm)
- y[i] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // New pitch
- sizes[i] = random(20, 50); // New articulation size
- lifeSpan[i] = random(50, 150); // New lifespan
- speeds[i] = random(1, 3); // New speed for rhythm variation
- colors[i] = color(random(255), random(255), random(255), 200); // New timbre color
- // Reassign shape type and note length
- isRect[i] = random(1) > 0.5;
- isLongNote[i] = random(1) > 0.5;
- if (isLongNote[i]) {
- lifeSpan[i] += 100; // Extend lifespan for longer notes
- }
- }
- }
- }
- }
- class Visualization6 extends Visualization {
- // Processing Visual Texture inspired by "Iron Circle" Aesthetic
- // Includes variable sizes, faster tempo, and combination of ovals, rectangles, and lines
- int maxVoices = 6; // Limit to 3-6 simultaneous shapes(voices)
- float[] x = new float[maxVoices]; // X positions for shapes
- float[] y = new float[maxVoices]; // Y positions for shapes(pitch)
- float[] sizes = new float[maxVoices]; // Sizes representing articulation(dynamics)
- float[] lifeSpan = new float[maxVoices]; // Life span of each shape
- float[] speeds = new float[maxVoices]; // Speed of movement for rhythm variation
- color[] colors = new color[maxVoices]; // Colors representing timbre
- boolean[] isRect = new boolean[maxVoices]; // Whether the shape is a rectangle or an oval
- boolean[] isLongNote = new boolean[maxVoices]; // Short vs. Long note(lifespan)
- void setup() {
- size(800, 800);
- frameRate(45); // Faster frame rate to accelerate the tempo
- noStroke();
- initializeVoices(); // Initialize shapes' positions, sizes, and other properties
- }
- void initializeVoices() {
- for (int i=0; i<maxVoices; i++) {
- x[i] = random(width); // Random X position(time/rhythm)
- y[i] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // Vertical position mapped to pitch
- sizes[i] = random(10, 100); // Variable sizes for different articulation(dynamics)
- lifeSpan[i] = random(30, 100); // Shorter life spans for faster tempo
- speeds[i] = random(2, 6); // Faster movement for increased tempo
- colors[i] = color(random(255), random(255), random(255), 200); // Color representing timbre
- // Randomly determine whether the shape is a rectangle or an oval
- isRect[i] = random(1) > 0.5;
- // Assign long vs. short note(longer lifespan for smoother, evolving sounds)
- isLongNote[i] = random(1) > 0.5;
- if (isLongNote[i]) {
- lifeSpan[i] += 50; // Extend lifespan for some longer notes, but still faster overall
- }
- }
- }
- void draw() {
- background(0, 70); // Fading background but slightly faster to keep up with the tempo
- // Draw lines for layered transitions or texture, appearing every few frames
- if (frameCount % 40 == 0) {
- stroke(255, 100); // White semi-transparent lines
- line(random(width), random(height), random(width), random(height)); // Random lines as textural transitions
- noStroke();
- }
- // Loop through all active shapes(voices)
- for (int i=0; i<maxVoices; i++) {
- if (lifeSpan[i] > 0) {
- // Draw rectangles for sharp attacks or ovals for smooth articulations
- fill(colors[i]);
- if (isRect[i]) {
- rect(x[i], y[i], sizes[i], sizes[i]); // Rectangle for more structured, mechanical sound
- } else {
- ellipse(x[i], y[i], sizes[i], sizes[i]); // Oval for smoother, evolving sounds
- }
- // Update movement, articulation, and life span
- x[i] += random(-speeds[i], speeds[i]); // Faster rhythmic movement
- y[i] += random(-1, 1); // Micro-variations in pitch(slightly faster)
- sizes[i] += random(-0.5, 0.5); // Subtle size changes for articulation(quicker)
- lifeSpan[i] -= 2; // Reduce lifespan faster to keep up with tempo
- } else {
- // When a shape finishes, respawn it with new properties
- x[i] = random(width); // New position(time/rhythm)
- y[i] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // New pitch
- sizes[i] = random(10, 100); // New articulation size(variable sizes for more contrast)
- lifeSpan[i] = random(30, 100); // Shorter lifespan for quicker tempo
- speeds[i] = random(2, 6); // Faster speed for rhythmic variation
- colors[i] = color(random(255), random(255), random(255), 200); // New timbre color
- // Reassign shape type and note length
- isRect[i] = random(1) > 0.5;
- isLongNote[i] = random(1) > 0.5;
- if (isLongNote[i]) {
- lifeSpan[i] += 50; // Longer lifespan for some notes, but still balanced for faster tempo
- }
- }
- }
- }
- }
- class Visualization7 extends Visualization {
- int maxVoices = 6; // Limit to 3-6 simultaneous shapes(voices)
- float[] x = new float[maxVoices]; // X positions for shapes
- float[] y = new float[maxVoices]; // Y positions for shapes(pitch)
- float[] sizes = new float[maxVoices]; // Sizes representing articulation(dynamics)
- float[] lifeSpan = new float[maxVoices]; // Life span of each shape
- float[] speeds = new float[maxVoices]; // Speed of movement for rhythm variation
- color[] colors = new color[maxVoices]; // Colors representing timbre
- boolean[] isRect = new boolean[maxVoices]; // Whether the shape is a rectangle or an oval
- boolean[] isLongNote = new boolean[maxVoices]; // Short vs. Long note(lifespan)
- float tempo; // Global tempo in milliseconds
- float lastUpdateTime; // Last update time
- int feedbackAlpha = 50; // Alpha value for feedback effect
- void setup() {
- size(800, 800);
- noStroke();
- initializeVoices(); // Initialize shapes' positions, sizes, and other properties
- lastUpdateTime = millis(); // Initialize the last update time
- }
- void initializeVoices() {
- for (int i=0; i<maxVoices; i++) {
- x[i] = random(width); // Random X position(time/rhythm)
- y[i] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // Vertical position mapped to pitch
- sizes[i] = random(10, 100); // Variable sizes for different articulation(dynamics)
- lifeSpan[i] = random(30, 100); // Lifespan for shapes
- speeds[i] = random(2, 6); // Speed of movement for rhythm variation
- colors[i] = color(random(255), random(255), random(255), 200); // Color representing timbre
- // Randomly determine whether the shape is a rectangle or an oval
- isRect[i] = random(1) > 0.5;
- // Assign long vs. short note(longer lifespan for smoother, evolving sounds)
- isLongNote[i] = random(1) > 0.5;
- if (isLongNote[i]) {
- lifeSpan[i] += 50; // Extend lifespan for some longer notes
- }
- }
- }
- void draw() {
- // Calculate the global tempo and apply it
- float currentTime = millis();
- if (currentTime - lastUpdateTime >= tempo) {
- lastUpdateTime = currentTime;
- // Draw motion blur effect by overlaying a semi-transparent background
- fill(0, feedbackAlpha); // Background with some transparency
- rect(0, 0, width, height);
- // Loop through all active shapes(voices)
- for (int i=0; i<maxVoices; i++) {
- if (lifeSpan[i] > 0) {
- // Draw rectangles for sharp attacks or ovals for smooth articulations
- fill(colors[i]);
- if (isRect[i]) {
- rect(x[i], y[i], sizes[i], sizes[i]); // Rectangle for more structured, mechanical sound
- } else {
- ellipse(x[i], y[i], sizes[i], sizes[i]); // Oval for smoother, evolving sounds
- }
- // Update movement, articulation, and life span
- x[i] += random(-speeds[i], speeds[i]); // Rhythmic movement
- y[i] += random(-1, 1); // Micro-variations in pitch
- sizes[i] += random(-0.5, 0.5); // Subtle size changes for articulation
- lifeSpan[i] -= 2; // Reduce lifespan to fade out
- } else {
- // When a shape finishes, respawn it with new properties
- x[i] = random(width); // New position(time/rhythm)
- y[i] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // New pitch
- sizes[i] = random(10, 100); // New articulation size
- lifeSpan[i] = random(30, 100); // New lifespan
- speeds[i] = random(2, 6); // New speed for rhythmic variation
- colors[i] = color(random(255), random(255), random(255), 200); // New timbre color
- // Reassign shape type and note length
- isRect[i] = random(1) > 0.5;
- isLongNote[i] = random(1) > 0.5;
- if (isLongNote[i]) {
- lifeSpan[i] += 50; // Longer lifespan for some notes, but balanced for faster tempo
- }
- }
- }
- // Update global tempo with random fluctuation
- tempo = random(21000, 46700); // Tempo in milliseconds(21 to 46.7 seconds)
- }
- }
- }
- class Visualization8 extends Visualization {
- int maxVoices = 6; // Limit to 3-6 simultaneous shapes(voices)
- float[] x = new float[maxVoices]; // X positions for shapes
- float[] y = new float[maxVoices]; // Y positions for shapes(pitch)
- float[] sizes = new float[maxVoices]; // Sizes representing articulation(dynamics)
- float[] lifeSpan = new float[maxVoices]; // Life span of each shape
- float[] speeds = new float[maxVoices]; // Speed of movement for rhythm variation
- color[] colors = new color[maxVoices]; // Colors representing timbre
- boolean[] isRect = new boolean[maxVoices]; // Whether the shape is a rectangle or an oval
- boolean[] isLongNote = new boolean[maxVoices]; // Short vs. Long note(lifespan)
- float spawnInterval; // Interval for spawning new shapes in milliseconds
- float lastSpawnTime; // Last time a new shape was spawned
- int feedbackAlpha = 50; // Alpha value for feedback effect
- void setup() {
- size(800, 800);
- noStroke();
- initializeVoices(); // Initialize shapes' properties
- lastSpawnTime = millis(); // Initialize the last spawn time
- spawnInterval = random(21000, 46700); // Initial spawn interval(21 to 46.7 seconds)
- }
- void initializeVoices() {
- for (int i=0; i<maxVoices; i++) {
- x[i] = random(width); // Random X position(time/rhythm)
- y[i] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // Vertical position mapped to pitch
- sizes[i] = random(10, 100); // Variable sizes for different articulation(dynamics)
- lifeSpan[i] = random(30, 100); // Lifespan for shapes
- speeds[i] = random(2, 6); // Speed of movement for rhythm variation
- colors[i] = color(random(255), random(255), random(255), 200); // Color representing timbre
- // Randomly determine whether the shape is a rectangle or an oval
- isRect[i] = random(1) > 0.5;
- // Assign long vs. short note(longer lifespan for smoother, evolving sounds)
- isLongNote[i] = random(1) > 0.5;
- if (isLongNote[i]) {
- lifeSpan[i] += 50; // Extend lifespan for some longer notes
- }
- }
- }
- void draw() {
- // Draw motion blur effect by overlaying a semi-transparent background
- fill(0, feedbackAlpha); // Background with some transparency
- rect(0, 0, width, height);
- // Current time for tempo management
- float currentTime = millis();
- // Check if it's time to spawn a new shape
- if (currentTime - lastSpawnTime >= spawnInterval) {
- // Spawn new shapes
- for (int i=0; i<maxVoices; i++) {
- if (lifeSpan[i] <= 0) {
- // Replace expired shapes
- x[i] = random(width); // New X position(time/rhythm)
- y[i] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // New pitch
- sizes[i] = random(10, 100); // New articulation size
- lifeSpan[i] = random(30, 100); // New lifespan
- speeds[i] = random(2, 6); // New speed for rhythmic variation
- colors[i] = color(random(255), random(255), random(255), 200); // New timbre color
- // Reassign shape type and note length
- isRect[i] = random(1) > 0.5;
- isLongNote[i] = random(1) > 0.5;
- if (isLongNote[i]) {
- lifeSpan[i] += 50; // Longer lifespan for some notes
- }
- }
- }
- // Update the last spawn time and set a new random spawn interval
- lastSpawnTime = currentTime;
- spawnInterval = random(21000, 46700); // New spawn interval(21 to 46.7 seconds)
- }
- // Loop through all active shapes(voices)
- for (int i=0; i<maxVoices; i++) {
- if (lifeSpan[i] > 0) {
- // Draw rectangles for sharp attacks or ovals for smooth articulations
- fill(colors[i]);
- if (isRect[i]) {
- rect(x[i], y[i], sizes[i], sizes[i]); // Rectangle for structured, mechanical sound
- } else {
- ellipse(x[i], y[i], sizes[i], sizes[i]); // Oval for smoother, evolving sounds
- }
- // Update movement, articulation, and life span
- x[i] += random(-speeds[i], speeds[i]); // Rhythmic movement
- y[i] += random(-1, 1); // Micro-variations in pitch
- sizes[i] += random(-0.5, 0.5); // Subtle size changes for articulation
- lifeSpan[i] -= 2; // Reduce lifespan to fade out
- }
- }
- }
- }
- class Visualization9 extends Visualization {
- int maxVoices = 6; // Limit to 3-6 simultaneous shapes(voices)
- float[] x = new float[maxVoices]; // X positions for shapes
- float[] y = new float[maxVoices]; // Y positions for shapes(pitch)
- float[] sizes = new float[maxVoices]; // Sizes representing articulation(dynamics)
- float[] lifeSpan = new float[maxVoices]; // Life span of each shape
- float[] speeds = new float[maxVoices]; // Speed of movement for rhythm variation
- color[] colors = new color[maxVoices]; // Colors representing timbre
- boolean[] isRect = new boolean[maxVoices]; // Whether the shape is a rectangle or an oval
- boolean[] isLongNote = new boolean[maxVoices]; // Short vs. Long note(lifespan)
- float spawnInterval; // Interval for spawning new shapes in milliseconds
- float lastSpawnTime; // Last time a new shape was spawned
- int feedbackAlpha = 50; // Alpha value for feedback effect
- void setup() {
- size(800, 800);
- noStroke();
- initializeVoices(); // Initialize shapes' properties
- lastSpawnTime = millis(); // Initialize the last spawn time
- spawnInterval = random(21000, 46700); // Initial spawn interval(21 to 46.7 seconds)
- }
- void initializeVoices() {
- for (int i=0; i<maxVoices; i++) {
- x[i] = random(width); // Random X position(time/rhythm)
- y[i] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // Vertical position mapped to pitch
- sizes[i] = random(10, 100); // Variable sizes for different articulation(dynamics)
- lifeSpan[i] = random(3000, 10000); // Lifespan for shapes(3 to 10 seconds)
- speeds[i] = random(2, 6); // Speed of movement for rhythm variation
- colors[i] = color(random(255), random(255), random(255), 200); // Color representing timbre
- // Randomly determine whether the shape is a rectangle or an oval
- isRect[i] = random(1) > 0.5;
- // Assign long vs. short note(longer lifespan for smoother, evolving sounds)
- isLongNote[i] = random(1) > 0.5;
- if (isLongNote[i]) {
- lifeSpan[i] += 5000; // Extend lifespan for some longer notes
- }
- }
- }
- void draw() {
- // Draw motion blur effect by overlaying a semi-transparent background
- fill(0, feedbackAlpha); // Background with some transparency
- rect(0, 0, width, height);
- // Current time for tempo management
- float currentTime = millis();
- // Check if it's time to spawn a new shape
- if (currentTime - lastSpawnTime >= spawnInterval) {
- // Spawn new shapes
- for (int i=0; i<maxVoices; i++) {
- if (lifeSpan[i] <= 0) {
- // Replace expired shapes
- x[i] = random(width); // New X position(time/rhythm)
- y[i] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // New pitch
- sizes[i] = random(10, 100); // New articulation size
- lifeSpan[i] = random(3000, 10000); // New lifespan(3 to 10 seconds)
- speeds[i] = random(2, 6); // New speed for rhythmic variation
- colors[i] = color(random(255), random(255), random(255), 200); // New timbre color
- // Reassign shape type and note length
- isRect[i] = random(1) > 0.5;
- isLongNote[i] = random(1) > 0.5;
- if (isLongNote[i]) {
- lifeSpan[i] += 5000; // Longer lifespan for some notes
- }
- }
- }
- // Update the last spawn time and set a new random spawn interval
- lastSpawnTime = currentTime;
- spawnInterval = random(21000, 46700); // New spawn interval(21 to 46.7 seconds)
- }
- // Loop through all active shapes(voices)
- for (int i=0; i<maxVoices; i++) {
- if (lifeSpan[i] > 0) {
- // Draw rectangles for sharp attacks or ovals for smooth articulations
- fill(colors[i]);
- if (isRect[i]) {
- rect(x[i], y[i], sizes[i], sizes[i]); // Rectangle for structured, mechanical sound
- } else {
- ellipse(x[i], y[i], sizes[i], sizes[i]); // Oval for smoother, evolving sounds
- }
- // Update movement, articulation, and life span
- x[i] += random(-speeds[i], speeds[i]); // Rhythmic movement
- y[i] += random(-1, 1); // Micro-variations in pitch
- sizes[i] += random(-0.5, 0.5); // Subtle size changes for articulation
- lifeSpan[i] -=(millis() - lastSpawnTime) /(float)spawnInterval * 2; // Gradual reduction based on spawn interval
- }
- }
- }
- }
- class Visualization10 extends Visualization {
- int maxVoices = 6; // Limit to 3-6 simultaneous shapes(voices)
- float[] x = new float[maxVoices]; // X positions for shapes
- float[] y = new float[maxVoices]; // Y positions for shapes(pitch)
- float[] sizes = new float[maxVoices]; // Sizes representing articulation(dynamics)
- float[] lifeSpan = new float[maxVoices]; // Life span of each shape
- float[] speeds = new float[maxVoices]; // Speed of movement for rhythm variation
- color[] colors = new color[maxVoices]; // Colors representing timbre
- boolean[] isRect = new boolean[maxVoices]; // Whether the shape is a rectangle or an oval
- boolean[] isLongNote = new boolean[maxVoices]; // Short vs. Long note(lifespan)
- float spawnInterval; // Interval for spawning new shapes in milliseconds
- float lastSpawnTime; // Last time a new shape was spawned
- int feedbackAlpha = 50; // Alpha value for feedback effect
- int currentAlgorithm = 0; // Index for the current visual algorithm
- int algorithmChangeInterval = 60000; // Time interval to change algorithm(60 seconds)
- float lastAlgorithmChangeTime; // Last time the algorithm was changed
- void setup() {
- size(800, 800);
- noStroke();
- initializeVoices(); // Initialize shapes' properties
- lastSpawnTime = millis(); // Initialize the last spawn time
- lastAlgorithmChangeTime = millis(); // Initialize algorithm change time
- spawnInterval = random(21000, 46700); // Initial spawn interval(21 to 46.7 seconds)
- }
- void initializeVoices() {
- for (int i=0; i<maxVoices; i++) {
- resetVoice(i); // Initialize or reset each shape
- }
- }
- void resetVoice(int index) {
- x[index] = random(width); // Random X position(time/rhythm)
- y[index] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // Vertical position mapped to pitch
- sizes[index] = random(10, 100); // Variable sizes for different articulation(dynamics)
- lifeSpan[index] = random(3000, 10000); // Lifespan for shapes(3 to 10 seconds)
- speeds[index] = random(2, 6); // Speed of movement for rhythm variation
- colors[index] = color(random(255), random(255), random(255), 200); // Color representing timbre
- // Randomly determine whether the shape is a rectangle or an oval
- isRect[index] = random(1) > 0.5;
- // Assign long vs. short note(longer lifespan for smoother, evolving sounds)
- isLongNote[index] = random(1) > 0.5;
- if (isLongNote[index]) {
- lifeSpan[index] += 5000; // Extend lifespan for some longer notes
- }
- }
- void draw() {
- // Draw motion blur effect by overlaying a semi-transparent background
- fill(0, feedbackAlpha); // Background with some transparency
- rect(0, 0, width, height);
- // Current time for tempo management
- float currentTime = millis();
- // Check if it's time to spawn a new shape
- if (currentTime - lastSpawnTime >= spawnInterval) {
- // Spawn new shapes
- for (int i=0; i<maxVoices; i++) {
- if (lifeSpan[i] <= 0) {
- // Replace expired shapes
- resetVoice(i); // Initialize new shape
- }
- }
- // Update the last spawn time and set a new random spawn interval
- lastSpawnTime = currentTime;
- spawnInterval = random(21000, 46700); // New spawn interval(21 to 46.7 seconds)
- }
- // Loop through all active shapes(voices)
- for (int i=0; i<maxVoices; i++) {
- if (lifeSpan[i] > 0) {
- // Draw rectangles for sharp attacks or ovals for smooth articulations
- fill(colors[i]);
- if (isRect[i]) {
- rect(x[i], y[i], sizes[i], sizes[i]); // Rectangle for structured, mechanical sound
- } else {
- ellipse(x[i], y[i], sizes[i], sizes[i]); // Oval for smoother, evolving sounds
- }
- // Update movement, articulation, and life span
- x[i] += random(-speeds[i], speeds[i]); // Rhythmic movement
- y[i] += random(-1, 1); // Micro-variations in pitch
- sizes[i] += random(-0.5, 0.5); // Subtle size changes for articulation
- lifeSpan[i] -=(millis() - lastSpawnTime) /(float)spawnInterval * 2; // Gradual reduction based on spawn interval
- }
- }
- // Check if it's time to change the visual algorithm
- if (currentTime - lastAlgorithmChangeTime >= algorithmChangeInterval) {
- changeAlgorithm(); // Apply a new algorithm
- lastAlgorithmChangeTime = currentTime; // Update the last algorithm change time
- }
- }
- void changeAlgorithm() {
- // Example of algorithm change: Randomly select a new algorithm for shape behavior
- currentAlgorithm =(currentAlgorithm + 1) % 3; // Cycle through 3 algorithms
- switch(currentAlgorithm) {
- case 0: // Algorithm 1: Basic shapes
- println("Applying Algorithm 1: Basic Shapes");
- // Set properties for Algorithm 1
- break;
- case 1: // Algorithm 2: More dynamic shapes
- println("Applying Algorithm 2: Dynamic Shapes");
- // Set properties for Algorithm 2
- break;
- case 2: // Algorithm 3: Complex shapes with varying attributes
- println("Applying Algorithm 3: Complex Shapes");
- // Set properties for Algorithm 3
- break;
- }
- }
- }
- class Visualization11 extends Visualization {
- int maxVoices = 6; // Limit to 3-6 simultaneous shapes(voices)
- float[] x = new float[maxVoices]; // X positions for shapes
- float[] y = new float[maxVoices]; // Y positions for shapes(pitch)
- float[] sizes = new float[maxVoices]; // Sizes representing articulation(dynamics)
- float[] lifeSpan = new float[maxVoices]; // Life span of each shape
- float[] speeds = new float[maxVoices]; // Speed of movement for rhythm variation
- color[] colors = new color[maxVoices]; // Colors representing timbre
- boolean[] isRect = new boolean[maxVoices]; // Whether the shape is a rectangle or an oval
- boolean[] isLongNote = new boolean[maxVoices]; // Short vs. Long note(lifespan)
- float spawnInterval; // Interval for spawning new shapes in milliseconds
- float lastSpawnTime; // Last time a new shape was spawned
- int feedbackAlpha = 50; // Alpha value for feedback effect
- // Algorithm parameters
- int currentAlgorithm = 0;
- float algorithmChangeInterval = 60000; // Time interval to change algorithm(60 seconds)
- float lastAlgorithmChangeTime; // Last time the algorithm was changed
- // Algorithm functions
- void setup() {
- size(800, 800);
- noStroke();
- initializeVoices(); // Initialize shapes' properties
- lastSpawnTime = millis(); // Initialize the last spawn time
- lastAlgorithmChangeTime = millis(); // Initialize algorithm change time
- spawnInterval = random(21000, 46700); // Initial spawn interval(21 to 46.7 seconds)
- generateNewAlgorithm(); // Generate the initial algorithm
- }
- void initializeVoices() {
- for (int i=0; i<maxVoices; i++) {
- resetVoice(i); // Initialize or reset each shape
- }
- }
- void resetVoice(int index) {
- x[index] = random(width); // Random X position(time/rhythm)
- y[index] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // Vertical position mapped to pitch
- sizes[index] = random(10, 100); // Variable sizes for different articulation(dynamics)
- lifeSpan[index] = random(3000, 10000); // Lifespan for shapes(3 to 10 seconds)
- speeds[index] = random(2, 6); // Speed of movement for rhythm variation
- colors[index] = color(random(255), random(255), random(255), 200); // Color representing timbre
- // Randomly determine whether the shape is a rectangle or an oval
- isRect[index] = random(1) > 0.5;
- // Assign long vs. short note(longer lifespan for smoother, evolving sounds)
- isLongNote[index] = random(1) > 0.5;
- if (isLongNote[index]) {
- lifeSpan[index] += 5000; // Extend lifespan for some longer notes
- }
- }
- void draw() {
- // Draw motion blur effect by overlaying a semi-transparent background
- fill(0, feedbackAlpha); // Background with some transparency
- rect(0, 0, width, height);
- // Current time for tempo management
- float currentTime = millis();
- // Check if it's time to spawn a new shape
- if (currentTime - lastSpawnTime >= spawnInterval) {
- // Spawn new shapes
- for (int i=0; i<maxVoices; i++) {
- if (lifeSpan[i] <= 0) {
- // Replace expired shapes
- resetVoice(i); // Initialize new shape
- }
- }
- // Update the last spawn time and set a new random spawn interval
- lastSpawnTime = currentTime;
- spawnInterval = random(21000, 46700); // New spawn interval(21 to 46.7 seconds)
- }
- // Loop through all active shapes(voices)
- for (int i=0; i<maxVoices; i++) {
- if (lifeSpan[i] > 0) {
- // Apply the current algorithm to draw shapes
- applyAlgorithm(i);
- // Update movement, articulation, and life span
- x[i] += random(-speeds[i], speeds[i]); // Rhythmic movement
- y[i] += random(-1, 1); // Micro-variations in pitch
- sizes[i] += random(-0.5, 0.5); // Subtle size changes for articulation
- lifeSpan[i] -=(millis() - lastSpawnTime) /(float)spawnInterval * 2; // Gradual reduction based on spawn interval
- }
- }
- // Check if it's time to generate a new algorithm
- if (currentTime - lastAlgorithmChangeTime >= algorithmChangeInterval) {
- generateNewAlgorithm(); // Generate a new algorithm
- lastAlgorithmChangeTime = currentTime; // Update the last algorithm change time
- }
- }
- void generateNewAlgorithm() {
- // Generate a new algorithm function
- currentAlgorithm =(int)random(0, 3); // Randomly select an algorithm(0, 1, or 2)
- println("Generated Algorithm: " + currentAlgorithm);
- }
- void applyAlgorithm(int index) {
- // Apply the generated algorithm to shape drawing
- switch(currentAlgorithm) {
- case 0: // Example of Algorithm 0: Basic Shapes
- fill(colors[index]);
- if (isRect[index]) {
- rect(x[index], y[index], sizes[index], sizes[index]);
- } else {
- ellipse(x[index], y[index], sizes[index], sizes[index]);
- }
- break;
- case 1: // Example of Algorithm 1: Dynamic Sizes
- fill(colors[index]);
- if (isRect[index]) {
- rect(x[index], y[index], sizes[index], sizes[index] * 1.5); // Change size dynamically
- } else {
- ellipse(x[index], y[index], sizes[index] * 1.5, sizes[index] * 0.5); // Ellipse with dynamic size
- }
- break;
- case 2: // Example of Algorithm 2: Variable Opacity
- fill(colors[index], random(100, 255)); // Variable opacity
- if (isRect[index]) {
- rect(x[index], y[index], sizes[index], sizes[index]);
- } else {
- ellipse(x[index], y[index], sizes[index], sizes[index]);
- }
- break;
- }
- }
- }
- class Visualization12 extends Visualization {
- int maxVoices = 6; // Limit to 3-6 simultaneous shapes(voices)
- float[] x = new float[maxVoices]; // X positions for shapes
- float[] y = new float[maxVoices]; // Y positions for shapes(pitch)
- float[] sizes = new float[maxVoices]; // Sizes representing articulation(dynamics)
- float[] lifeSpan = new float[maxVoices]; // Life span of each shape
- float[] speeds = new float[maxVoices]; // Speed of movement for rhythm variation
- color[] colors = new color[maxVoices]; // Colors representing timbre
- boolean[] isRect = new boolean[maxVoices]; // Whether the shape is a rectangle or an oval
- boolean[] isLongNote = new boolean[maxVoices]; // Short vs. Long note(lifespan)
- float spawnInterval; // Interval for spawning new shapes in milliseconds
- float[] spawnTimes = new float[maxVoices]; // Times at which shapes should respawn
- int feedbackAlpha = 50; // Alpha value for feedback effect
- // Algorithm parameters
- int currentAlgorithm = 0;
- float algorithmChangeInterval = 60000; // Time interval to change algorithm(60 seconds)
- float lastAlgorithmChangeTime; // Last time the algorithm was changed
- void setup() {
- size(800, 800);
- noStroke();
- initializeVoices(); // Initialize shapes' properties
- lastAlgorithmChangeTime = millis(); // Initialize algorithm change time
- spawnInterval = random(21000, 46700); // Initial spawn interval(21 to 46.7 seconds)
- generateNewAlgorithm(); // Generate the initial algorithm
- }
- void initializeVoices() {
- for (int i=0; i<maxVoices; i++) {
- resetVoice(i); // Initialize or reset each shape
- spawnTimes[i] = millis(); // Initialize spawn time for each shape
- }
- }
- void resetVoice(int index) {
- x[index] = random(width); // Random X position(time/rhythm)
- y[index] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // Vertical position mapped to pitch
- sizes[index] = random(10, 100); // Variable sizes for different articulation(dynamics)
- lifeSpan[index] = random(3000, 10000); // Lifespan for shapes(3 to 10 seconds)
- speeds[index] = random(2, 6); // Speed of movement for rhythm variation
- colors[index] = color(random(255), random(255), random(255), 200); // Color representing timbre
- // Randomly determine whether the shape is a rectangle or an oval
- isRect[index] = random(1) > 0.5;
- // Assign long vs. short note(longer lifespan for smoother, evolving sounds)
- isLongNote[index] = random(1) > 0.5;
- if (isLongNote[index]) {
- lifeSpan[index] += 5000; // Extend lifespan for some longer notes
- }
- }
- void draw() {
- // Draw motion blur effect by overlaying a semi-transparent background
- fill(0, feedbackAlpha); // Background with some transparency
- rect(0, 0, width, height);
- // Current time for tempo management
- float currentTime = millis();
- // Loop through all active shapes(voices)
- for (int i=0; i<maxVoices; i++) {
- // Check if it's time to respawn or if the shape is still active
- if (currentTime - spawnTimes[i] >= spawnInterval) {
- // Reset shape if it has expired
- resetVoice(i);
- spawnTimes[i] = currentTime; // Update the spawn time for the shape
- }
- if (currentTime - spawnTimes[i] <= lifeSpan[i]) {
- // Apply the current algorithm to draw shapes
- applyAlgorithm(i);
- // Update movement, articulation, and life span
- x[i] += random(-speeds[i], speeds[i]); // Rhythmic movement
- y[i] += random(-1, 1); // Micro-variations in pitch
- sizes[i] += random(-0.5, 0.5); // Subtle size changes for articulation
- }
- }
- // Check if it's time to generate a new algorithm
- if (currentTime - lastAlgorithmChangeTime >= algorithmChangeInterval) {
- generateNewAlgorithm(); // Generate a new algorithm
- lastAlgorithmChangeTime = currentTime; // Update the last algorithm change time
- }
- }
- void generateNewAlgorithm() {
- // Generate a new algorithm function
- currentAlgorithm =(int)random(0, 3); // Randomly select an algorithm(0, 1, or 2)
- println("Generated Algorithm: " + currentAlgorithm);
- }
- void applyAlgorithm(int index) {
- // Apply the generated algorithm to shape drawing
- switch(currentAlgorithm) {
- case 0: // Example of Algorithm 0: Basic Shapes
- fill(colors[index]);
- if (isRect[index]) {
- rect(x[index], y[index], sizes[index], sizes[index]);
- } else {
- ellipse(x[index], y[index], sizes[index], sizes[index]);
- }
- break;
- case 1: // Example of Algorithm 1: Dynamic Sizes
- fill(colors[index]);
- if (isRect[index]) {
- rect(x[index], y[index], sizes[index], sizes[index] * 1.5); // Change size dynamically
- } else {
- ellipse(x[index], y[index], sizes[index] * 1.5, sizes[index] * 0.5); // Ellipse with dynamic size
- }
- break;
- case 2: // Example of Algorithm 2: Variable Opacity
- fill(colors[index], random(100, 255)); // Variable opacity
- if (isRect[index]) {
- rect(x[index], y[index], sizes[index], sizes[index]);
- } else {
- ellipse(x[index], y[index], sizes[index], sizes[index]);
- }
- break;
- }
- }
- }
- class Visualization13 extends Visualization {
- int maxVoices = 6; // Limit to 3-6 simultaneous shapes(voices)
- float[] x = new float[maxVoices]; // X positions for shapes
- float[] y = new float[maxVoices]; // Y positions for shapes(pitch)
- float[] sizes = new float[maxVoices]; // Sizes representing articulation(dynamics)
- float[] spawnTimes = new float[maxVoices]; // Times at which shapes should respawn
- float[] speeds = new float[maxVoices]; // Speed of movement for rhythm variation
- color[] colors = new color[maxVoices]; // Colors representing timbre
- boolean[] isRect = new boolean[maxVoices]; // Whether the shape is a rectangle or an oval
- boolean[] isLongNote = new boolean[maxVoices]; // Short vs. Long note(lifespan)
- float spawnInterval; // Interval for updating shapes in milliseconds
- int feedbackAlpha = 50; // Alpha value for feedback effect
- // Algorithm parameters
- int currentAlgorithm = 0;
- float algorithmChangeInterval = 60000; // Time interval to change algorithm(60 seconds)
- float lastAlgorithmChangeTime; // Last time the algorithm was changed
- void setup() {
- size(800, 800);
- noStroke();
- initializeVoices(); // Initialize shapes' properties
- lastAlgorithmChangeTime = millis(); // Initialize algorithm change time
- spawnInterval = random(21000, 46700); // Initial spawn interval(21 to 46.7 seconds)
- generateNewAlgorithm(); // Generate the initial algorithm
- }
- void initializeVoices() {
- for (int i=0; i<maxVoices; i++) {
- resetVoice(i); // Initialize or reset each shape
- spawnTimes[i] = millis(); // Initialize spawn time for each shape
- }
- }
- void resetVoice(int index) {
- x[index] = random(width); // Random X position(time/rhythm)
- y[index] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // Vertical position mapped to pitch
- sizes[index] = random(10, 100); // Variable sizes for different articulation(dynamics)
- speeds[index] = random(2, 6); // Speed of movement for rhythm variation
- colors[index] = color(random(255), random(255), random(255), 200); // Color representing timbre
- // Randomly determine whether the shape is a rectangle or an oval
- isRect[index] = random(1) > 0.5;
- // Assign long vs. short note(longer lifespan for smoother, evolving sounds)
- isLongNote[index] = random(1) > 0.5;
- }
- void draw() {
- // Draw motion blur effect by overlaying a semi-transparent background
- fill(0, feedbackAlpha); // Background with some transparency
- rect(0, 0, width, height);
- // Current time for tempo management
- float currentTime = millis();
- // Loop through all shapes(voices)
- for (int i=0; i<maxVoices; i++) {
- // Check if it's time to update the shape's position
- if (currentTime - spawnTimes[i] >= spawnInterval) {
- resetVoice(i); // Reinitialize shape properties
- spawnTimes[i] = currentTime; // Update the spawn time for the shape
- }
- // Apply the current algorithm to draw shapes
- applyAlgorithm(i);
- // Update movement and appearance
- x[i] += random(-speeds[i], speeds[i]); // Rhythmic movement
- y[i] += random(-1, 1); // Micro-variations in pitch
- sizes[i] += random(-0.5, 0.5); // Subtle size changes for articulation
- }
- // Check if it's time to generate a new algorithm
- if (currentTime - lastAlgorithmChangeTime >= algorithmChangeInterval) {
- generateNewAlgorithm(); // Generate a new algorithm
- lastAlgorithmChangeTime = currentTime; // Update the last algorithm change time
- }
- }
- void generateNewAlgorithm() {
- // Generate a new algorithm function
- currentAlgorithm =(int)random(0, 3); // Randomly select an algorithm(0, 1, or 2)
- println("Generated Algorithm: " + currentAlgorithm);
- }
- void applyAlgorithm(int index) {
- // Apply the generated algorithm to shape drawing
- switch(currentAlgorithm) {
- case 0: // Example of Algorithm 0: Basic Shapes
- fill(colors[index]);
- if (isRect[index]) {
- rect(x[index], y[index], sizes[index], sizes[index]);
- } else {
- ellipse(x[index], y[index], sizes[index], sizes[index]);
- }
- break;
- case 1: // Example of Algorithm 1: Dynamic Sizes
- fill(colors[index]);
- if (isRect[index]) {
- rect(x[index], y[index], sizes[index], sizes[index] * 1.5); // Change size dynamically
- } else {
- ellipse(x[index], y[index], sizes[index] * 1.5, sizes[index] * 0.5); // Ellipse with dynamic size
- }
- break;
- case 2: // Example of Algorithm 2: Variable Opacity
- fill(colors[index], random(100, 255)); // Variable opacity
- if (isRect[index]) {
- rect(x[index], y[index], sizes[index], sizes[index]);
- } else {
- ellipse(x[index], y[index], sizes[index], sizes[index]);
- }
- break;
- }
- }
- }
- class Visualization14 extends Visualization {
- int maxVoices = 6; // Limit to 3-6 simultaneous shapes(voices)
- float[] x = new float[maxVoices]; // X positions for shapes
- float[] y = new float[maxVoices]; // Y positions for shapes(pitch)
- float[] sizes = new float[maxVoices]; // Sizes representing articulation(dynamics)
- float[] spawnTimes = new float[maxVoices]; // Times at which shapes should respawn
- float[] speeds = new float[maxVoices]; // Speed of movement for rhythm variation
- color[] colors = new color[maxVoices]; // Colors representing timbre
- boolean[] isRect = new boolean[maxVoices]; // Whether the shape is a rectangle or an oval
- boolean[] isLongNote = new boolean[maxVoices]; // Short vs. Long note(lifespan)
- float spawnInterval; // Interval for updating shapes in milliseconds
- int feedbackAlpha = 50; // Alpha value for feedback effect
- // Algorithm parameters
- int currentAlgorithm = 0;
- float algorithmChangeInterval = 60000; // Time interval to change algorithm(60 seconds)
- float lastAlgorithmChangeTime; // Last time the algorithm was changed
- void setup() {
- size(800, 800);
- noStroke();
- initializeVoices(); // Initialize shapes' properties
- lastAlgorithmChangeTime = millis(); // Initialize algorithm change time
- spawnInterval = random(21000, 46700); // Initial spawn interval(21 to 46.7 seconds)
- generateNewAlgorithm(); // Generate the initial algorithm
- }
- void initializeVoices() {
- for (int i=0; i<maxVoices; i++) {
- resetVoice(i); // Initialize or reset each shape
- spawnTimes[i] = millis(); // Initialize spawn time for each shape
- }
- }
- void resetVoice(int index) {
- x[index] = random(width); // Random X position(time/rhythm)
- y[index] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // Vertical position mapped to pitch
- sizes[index] = random(10, 100); // Variable sizes for different articulation(dynamics)
- speeds[index] = random(2, 6); // Speed of movement for rhythm variation
- colors[index] = color(random(255), random(255), random(255), 200); // Color representing timbre
- // Randomly determine whether the shape is a rectangle or an oval
- isRect[index] = random(1) > 0.5;
- // Assign long vs. short note(longer lifespan for smoother, evolving sounds)
- isLongNote[index] = random(1) > 0.5;
- }
- void draw() {
- // Draw motion blur effect by overlaying a semi-transparent background
- fill(0, feedbackAlpha); // Background with some transparency
- rect(0, 0, width, height);
- // Current time for tempo management
- float currentTime = millis();
- // Loop through all shapes(voices)
- for (int i=0; i<maxVoices; i++) {
- // Check if it's time to update the shape's position
- if (currentTime - spawnTimes[i] >= spawnInterval) {
- resetVoice(i); // Reinitialize shape properties
- spawnTimes[i] = currentTime; // Update the spawn time for the shape
- }
- // Apply the current algorithm to draw shapes
- applyAlgorithm(i);
- // Update movement and appearance
- x[i] += random(-speeds[i], speeds[i]); // Rhythmic movement
- y[i] += random(-1, 1); // Micro-variations in pitch
- sizes[i] += random(-0.5, 0.5); // Subtle size changes for articulation
- }
- // Check if it's time to generate a new algorithm
- if (currentTime - lastAlgorithmChangeTime >= algorithmChangeInterval) {
- generateNewAlgorithm(); // Generate a new algorithm
- lastAlgorithmChangeTime = currentTime; // Update the last algorithm change time
- }
- }
- void generateNewAlgorithm() {
- // Generate a new algorithm function
- currentAlgorithm =(int)random(0, 3); // Randomly select an algorithm(0, 1, or 2)
- println("Generated Algorithm: " + currentAlgorithm);
- }
- void applyAlgorithm(int index) {
- // Apply the generated algorithm to shape drawing
- switch(currentAlgorithm) {
- case 0: // Example of Algorithm 0: Basic Shapes
- fill(colors[index]);
- if (isRect[index]) {
- rect(x[index], y[index], sizes[index], sizes[index]);
- } else {
- ellipse(x[index], y[index], sizes[index], sizes[index]);
- }
- break;
- case 1: // Example of Algorithm 1: Dynamic Sizes
- fill(colors[index]);
- if (isRect[index]) {
- rect(x[index], y[index], sizes[index], sizes[index] * 1.5); // Change size dynamically
- } else {
- ellipse(x[index], y[index], sizes[index] * 1.5, sizes[index] * 0.5); // Ellipse with dynamic size
- }
- break;
- case 2: // Example of Algorithm 2: Variable Opacity
- fill(colors[index], random(100, 255)); // Variable opacity
- if (isRect[index]) {
- rect(x[index], y[index], sizes[index], sizes[index]);
- } else {
- ellipse(x[index], y[index], sizes[index], sizes[index]);
- }
- break;
- }
- }
- }
- class Visualization15 extends Visualization {
- int maxVoices = 6; // Limit to 3-6 simultaneous shapes(voices)
- float[] x = new float[maxVoices]; // X positions for shapes
- float[] y = new float[maxVoices]; // Y positions for shapes(pitch)
- float[] sizes = new float[maxVoices]; // Sizes representing articulation(dynamics)
- float[] spawnTimes = new float[maxVoices]; // Times at which shapes should respawn
- float[] speeds = new float[maxVoices]; // Speed of movement for rhythm variation
- color[] colors = new color[maxVoices]; // Colors representing timbre
- boolean[] isRect = new boolean[maxVoices]; // Whether the shape is a rectangle or an oval
- boolean[] isLongNote = new boolean[maxVoices]; // Short vs. Long note(lifespan)
- float spawnInterval; // Interval for regenerating shapes in milliseconds
- float lastRegenerationTime; // Last time the shapes were regenerated
- int feedbackAlpha = 50; // Alpha value for feedback effect
- void setup() {
- size(800, 800);
- noStroke();
- spawnInterval = random(21000, 46700); // Random spawn interval(21 to 46.7 seconds)
- lastRegenerationTime = millis(); // Initialize last regeneration time
- regenerateVisuals(); // Initial configuration
- }
- void regenerateVisuals() {
- // Reset all shape properties for new configuration
- for (int i=0; i<maxVoices; i++) {
- resetVoice(i); // Initialize or reset each shape
- spawnTimes[i] = millis(); // Initialize spawn time for each shape
- }
- }
- void resetVoice(int index) {
- x[index] = random(width); // Random X position
- y[index] = map(random(0, 1), 0, 1, height * 0.1, height * 0.9); // Vertical position mapped to pitch
- sizes[index] = random(10, 100); // Variable sizes for different articulation(dynamics)
- speeds[index] = random(2, 6); // Speed of movement for rhythm variation
- colors[index] = color(random(255), random(255), random(255), 200); // Color representing timbre
- // Randomly determine whether the shape is a rectangle or an oval
- isRect[index] = random(1) > 0.5;
- // Assign long vs. short note(longer lifespan for smoother, evolving sounds)
- isLongNote[index] = random(1) > 0.5;
- }
- void draw() {
- // Draw motion blur effect by overlaying a semi-transparent background
- fill(0, feedbackAlpha); // Background with some transparency
- rect(0, 0, width, height);
- // Current time for regeneration management
- float currentTime = millis();
- // Loop through all shapes(voices)
- for (int i=0; i<maxVoices; i++) {
- // Update shape's appearance
- applyAlgorithm(i);
- // Update movement
- x[i] += random(-speeds[i], speeds[i]); // Rhythmic movement
- y[i] += random(-1, 1); // Micro-variations in pitch
- sizes[i] += random(-0.5, 0.5); // Subtle size changes for articulation
- // Check if it's time to regenerate the visuals
- if (currentTime - lastRegenerationTime >= spawnInterval) {
- regenerateVisuals(); // Generate a new configuration
- lastRegenerationTime = currentTime; // Update the last regeneration time
- spawnInterval = random(21000, 46700); // Randomize next spawn interval
- }
- }
- }
- void applyAlgorithm(int index) {
- // Draw shapes according to current configuration
- fill(colors[index]);
- if (isRect[index]) {
- rect(x[index], y[index], sizes[index], sizes[index]);
- } else {
- ellipse(x[index], y[index], sizes[index], sizes[index]);
- }
- }
- }
- ArrayList<Visualization> visualizations = new ArrayList<Visualization>();
- ArrayList<Float> offsets = new ArrayList<Float>();
- ArrayList<Float> timers = new ArrayList<Float>();
- int currentVisualizationIndex = -1;
- void setup() {
- size(800, 600);
- noLoop();
- // Instantiate and add visualizations
- Visualization vis1 = new Visualization1();
- Visualization vis2 = new Visualization2();
- Visualization vis3 = new Visualization3();
- Visualization vis4 = new Visualization4();
- Visualization vis5 = new Visualization5();
- Visualization vis6 = new Visualization6();
- Visualization vis7 = new Visualization7();
- Visualization vis8 = new Visualization8();
- Visualization vis9 = new Visualization9();
- Visualization vis10 = new Visualization10();
- Visualization vis11 = new Visualization11();
- Visualization vis12 = new Visualization12();
- Visualization vis13 = new Visualization13();
- Visualization vis14 = new Visualization14();
- Visualization vis15 = new Visualization15();
- // Add more instances as needed
- visualizations.add(vis1);
- visualizations.add(vis2);
- visualizations.add(vis3);
- visualizations.add(vis4);
- visualizations.add(vis5);
- visualizations.add(vis6);
- visualizations.add(vis7);
- visualizations.add(vis8);
- visualizations.add(vis9);
- visualizations.add(vis10);
- visualizations.add(vis11);
- visualizations.add(vis12);
- visualizations.add(vis13);
- visualizations.add(vis14);
- visualizations.add(vis15);
- // Call setup for each visualization
- for (Visualization vis : visualizations) {
- vis.setup();
- }
- // Initialize offsets and timers for each visualization
- for (int i = 0; i < visualizations.size(); i++) {
- offsets.add(random(21, 46.7));
- timers.add(millis());
- }
- }
- void draw() {
- background(0);
- if (visualizations.size() == 0) return;
- // Check the time for each visualization
- for (int i = 0; i < visualizations.size(); i++) {
- float elapsedTime = (millis() - timers.get(i)) / 1000.0;
- if (elapsedTime >= offsets.get(i)) {
- currentVisualizationIndex = i;
- timers.set(i, millis()); // Reset timer
- break; // Break loop to render only the current visualization
- }
- }
- // Display the current visualization
- if (currentVisualizationIndex != -1) {
- visualizations.get(currentVisualizationIndex).draw();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement