diff --git a/.gitignore b/.gitignore
index 9ca780152..68587f3e0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,3 +20,5 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
+
+java/.project
diff --git a/README.md b/README.md
index 19ba88c75..35146411b 100644
--- a/README.md
+++ b/README.md
@@ -1,89 +1,133 @@
# Music Visualiser Project
-Name:
+Name: Oludemilade Aina
-Student Number:
+Student Number: C21725659
-## Instructions
-- Fork this repository and use it a starter project for your assignment
-- Create a new package named your student number and put all your code in this package.
-- You should start by creating a subclass of ie.tudublin.Visual
-- There is an example visualiser called MyVisual in the example package
-- Check out the WaveForm and AudioBandsVisual for examples of how to call the Processing functions from other classes that are not subclasses of PApplet
+Name: Jared Leonard
+
+Student Number: C21468162
# Description of the assignment
+Our group visualization project is based on the song Killing My Love, which is a song with a high tempo. Our goal was to make a visual experience that matched this high tempo vibe, that feels as though the user who is running the program, is taken on a journey. Unfortunately we were unable to get the program to run as a single entity, which we are really disappointed about, as we had high ambitions and large ideas for the assignment. It turnt out to be too big of a task to put everything together. We learnt a lesson that is is better to keep things simpler and move from there, instead of starting big and trying to make a super complicated visual from the start.
-# Instructions
+## Instructions
+To run the program, unfortunately you have to edit the main file each time to display each visual.
# How it works
+## WarpedSpace
+
+
+The WarpedSpace visual is a visual that is inspired by Star Wars, when they move through Hyperspace. My goal was to make this feels as dynamic and interactive as possible, as I am aware that a lot of people are inspired to make a visual similar to this. Therefore I wanted to make mine as unique and cool as possible. When they visual starts, the user can use the mousescroll wheel to achieve different things. The first is that when they scroll up, the star particles start moving much faster towards the screen, and the color of the particles randomly change. On the other hand, if the user decides to scroll down on the mousewheel, the particles start slowing down and appear to separate from each other, while also randomly changing colours. I am really happy with the overall functionality of this visual and how interactive it is.
+
+## Celebration Station
+
+
+The CelebrationStation visual was created to be another visual that is interact and constantly in motion, to match the theme of our song. To start off, I drew a wirefram box that has a gradient colors that slowly changes over time. Inside of this box there are a couple of cools things that take place. The first being the fireworks that randomly appear within the box. These fireworks vary a little bit in size and have a really cool looking color to it that contrats the background display of the visual. Inside of the wireframe box, the user can swap between spawning a triangle or circle, by using he right and left arrow keys. This wa another funcion I wanted to add as I wanted to make my visual as interactive as possible and fun for the user.
+
+Another exciting adition was the camera movement I added. This allows the user to rotate the box and its contents in a 360 degree way. The box can also be rotated faster by using the up arrow, and slower using the down arrow. If the user wants to they can also use the mouse scroll button to zoom into the box, and even get inside of it! This gives this visual an even greater 360 feel which I find quite cool.
+
# What I am most proud of in the assignment
+Jared:
+I am most proud of how ambitious we were as a collective in trying to get a visual that was super interactive for the user. I am really happy with how the Warped Space visual turned out and I think it has a really unique twist to it. I am incredibly disappointed that we could not get everything to work and match the music, which is something I regret, but I don't regret trying to make it as much of an enjoyable and interactive experience as possible, even though it turned out to be too complicated to put together in the end. My goal is to put at least my visuals together and get it to work with the music in my own time
+
+
+# Description
+For this assignment, I have made three audio visualizers, one that was basic changes and another one that was meant to be very dynamic in nature but didn't change too much, due to the challenges of trying to move things in a 3d space.
+
+## Global Package
+The global package holds the features that were intended to be used in both of our visualizers.
+
+### Subtitles
+For the song, I used Whisper AI to transcribe the song into an SRT file. SRT format holds, information for when text is displayed on the screen and is the format that is generally used on YouTube videos to display closed captions on the video. The SRT file is made of 3 parts.
+
+1 - > here part
+00:01:00,000 --> 00:01:04,000 - > time code
+You give me love, and we dare to do this to my heart - > The text
+
+The bulk of the code is done in the subtitle handler class which parses through the file getting the start and ending times of a part and using this will the audio player time code to check when it is displayed on the screen.
+
+# C21725659 Package Explained
+
+## Prototype
+The prototype function was the main idea of the audio visualizer, where I want to make many changes. This was an idea to be iterated on. It has many functions. Such as a ball in the middle that changes and reacts based on the beat.
+## Sprites
+I have multiple sprite files, some of these files are not used, this is because they should have been used for my main audio visualizer DemiAudioVisualiser. The main idea was to make new items get added onto the screen based on the music, however, I was not able to get this done in time.
+### Note
+The note sprites is using some vectors and custom shapes to be added to the screen, the main idea was to get sprites to move around in the 3d object, however due to mistiming management. I was not able to implement this feature properly, there it doesn't work in my visualizer.
+#### Manager
+The note manager class has an array list of the instances of the Musical Note Sprite and holds the values of notes. This tracks the state of all the notes, and it uses the update function to check the lifetime of each note. Every time amplitude is above 0.1 in the music and a new note is added to the array list. The display method displays them.
+### Text
+The text sprite was an iteration of my idea using subtitles, it uses the DisplayCurrentSubtitle() method in the DemiAudioVisualiser, it uses the already existing text and splits them up into a word array and creates new sprites. However, again due to using 3d I was not able to implement the movement I was looking for potential because of the use of PVector and not just text I am not 100% sure.
+### Particle
+The particle system is a system that is internalized through the DemiAudioVisualizer, it makes the size whatever the amplitude is and was meant to create random colour and lifespan, however, this didn't happen.
+### Ripple echo.
+This was a visualizer I modified code online to use, however, it doesn't have the mouse movement functionality and the one-beat movement that mine has. This was achieved by creating a beat and update function that takes in amplitude now and creates random strokes.
+### Camera movement
+Camera movement was also implemented into the visualizer it allows the user to move around the 3d space.
+
+# Documentation
+### C21725659 package
+This package contains several classes for a music visualization project using Processing and the Minim library. The visualization includes various effects such as ripple echoes, particle systems, and 3D objects reacting to the music's amplitude and frequency bands.
-# Markdown Tutorial
+#### NoteManager class
+This class manages a collection of MusicalNoteSprite objects, updating and displaying them based on the amplitude of the audio input.
-This is *emphasis*
+- **NoteManager(PApplet parent)**: Constructor that initializes the Note Manager with a reference to the parent PApplet.
+- **update(float amplitude)**: Updates the state of each note based on the amplitude and removes any expired notes.
+- **display()**: Displays all active notes on the screen.
-This is a bulleted list
+#### MusicalNoteSprite class
+This class represents a single musical note sprite in the visualization.
-- Item
-- Item
+- **MusicalNoteSprite(PApplet parent, PVector position, float size, int noteType, float lifetime)**: Constructor that initializes the sprite with a position, size, type, and lifetime.
+- **update(float frameRate)**: Updates the state of the sprite, decreasing its lifetime and returning true if expired.
+- **display(PApplet parent)**: Displays the sprite on the screen.
-This is a numbered list
+#### Part class
+This class represents a single point in a Ripple Echo visualization.
-1. Item
-1. Item
+- **part(int x, int y, float dist)**: Constructor that initializes the part with an x, y position and a distance value.
+- **update(PVector m, Boolean mode, float distortion, float beatValue, float width, PApplet p)**: Updates the part's position based on the mouse position, mode, distortion, beat value, and the PApplet's width.
-This is a [hyperlink](http://bryanduggan.org)
+#### Particle class
+This class represents a single particle in a particle system.
-# Headings
-## Headings
-#### Headings
-##### Headings
+- **Particle(PApplet p, PVector position, PVector velocity, float size, int colour, float lifespan)**: Constructor that initializes the particle with position, velocity, size, colour, and lifespan.
+- **update()**: Updates the particle's position and decreases its lifespan.
+- **display()**: Displays the particle on the screen.
+- **isDead()**: Returns true if the particle's lifespan is zero or less.
-This is code:
+#### Prototype class
+This class is the main visualization sketch, combining various effects and displaying them on the screen.
-```Java
-public void render()
-{
- ui.noFill();
- ui.stroke(255);
- ui.rect(x, y, width, height);
- ui.textAlign(PApplet.CENTER, PApplet.CENTER);
- ui.text(text, x + width * 0.5f, y + height * 0.5f);
-}
-```
+#### Ripple Echo class
+This class is a visualization sketch that creates a ripple echo effect based on the amplitude and frequency of the audio input.
-So is this without specifying the language:
+- **RippleEcho()**: Constructor that initializes the RippleEcho visualization.
+- **settings()**: Sets the size of the PApplet window.
+- **setup()** : Initializes the RippleEcho visualization, including loading audio and creating part objects.
+- **draw()**: Renders the RippleEcho visualization, updating the part objects based on the audio input and mouse position.
+- **mousePressed()**: Toggles the mode of the Ripple Echo visualization when the mouse is pressed.
-```
-public void render()
-{
- ui.noFill();
- ui.stroke(255);
- ui.rect(x, y, width, height);
- ui.textAlign(PApplet.CENTER, PApplet.CENTER);
- ui.text(text, x + width * 0.5f, y + height * 0.5f);
-}
-```
+#### Text Sprites class
+This class represents a single text sprite in the visualization.
-This is an image using a relative URL:
+- **textSprites(PVector position, PVector velocity, String text, int textSize, int colour)**: Constructor that initializes the text sprite with position, velocity, text, text size, and colour.
+- **update()** : Updates the text sprite's position based on its velocity.
+- **display(PApplet p)**: Displays the text sprite on the screen.
-
+Visualizer one:
-This is an image using an absolute URL:
+
-
+Visualizer two:
-This is a youtube video:
+
-[](https://www.youtube.com/watch?v=J2kHSSFA4NU)
+Proud of the assignment:
+I was about to learn more about 3d space in games and how they are represented on the computer, It has made me want to pursue making 3d objects and present them in code. Creative coding as also thought the possibilities what I can make with simple shapes for loops, numbers, and math.
-This is a table:
-| Heading 1 | Heading 2 |
-|-----------|-----------|
-|Some stuff | Some more stuff in this column |
-|Some stuff | Some more stuff in this column |
-|Some stuff | Some more stuff in this column |
-|Some stuff | Some more stuff in this column |
diff --git a/images/Screenshot 2023-05-06 235310.png b/images/Screenshot 2023-05-06 235310.png
new file mode 100644
index 000000000..d199bafe5
Binary files /dev/null and b/images/Screenshot 2023-05-06 235310.png differ
diff --git a/images/Screenshot 2023-05-07 000300.png b/images/Screenshot 2023-05-07 000300.png
new file mode 100644
index 000000000..2397b3e0e
Binary files /dev/null and b/images/Screenshot 2023-05-07 000300.png differ
diff --git a/java/.project b/java/.project
index 0d5afed93..32f9aa030 100644
--- a/java/.project
+++ b/java/.project
@@ -16,12 +16,11 @@
- 1616413840733
30
org.eclipse.core.resources.regexFilterMatcher
- node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+ node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
diff --git a/java/bin/ie/tudublin/MusicVisualizer b/java/bin/ie/tudublin/MusicVisualizer
new file mode 100644
index 000000000..bef04cf68
--- /dev/null
+++ b/java/bin/ie/tudublin/MusicVisualizer
@@ -0,0 +1,21 @@
+// package ie.tudublin;
+
+// // Dependencies
+// import ddf.minim.AudioInput;
+// import ddf.minim.AudioBuffer;
+// import ddf.minim.Minim;
+// import ddf.minim.AudioPlayer;
+// import processing.core.PApplet;
+// import java.util.ArrayList;
+
+// //visuals
+
+// import C21468162.JaredVisual.JaredVisual;
+// //import C21725659.DemiAina.;
+
+// public class MusicVisualizer extends PApplet {
+// //Begin rendering visuals
+// JaredVisual jaredVisual;
+// //DemiAina demiAina;
+// // etc etc
+// }
\ No newline at end of file
diff --git a/java/data/InitialD-KillingMyLove.mp3 b/java/data/InitialD-KillingMyLove.mp3
new file mode 100644
index 000000000..f130e54c2
Binary files /dev/null and b/java/data/InitialD-KillingMyLove.mp3 differ
diff --git a/java/data/InitialD-KillingMyLove.mp3.srt b/java/data/InitialD-KillingMyLove.mp3.srt
new file mode 100644
index 000000000..c04e042b8
--- /dev/null
+++ b/java/data/InitialD-KillingMyLove.mp3.srt
@@ -0,0 +1,284 @@
+1
+00:01:00,000 --> 00:01:04,000
+You give me love, and we dare to do this to my heart
+
+2
+00:01:04,000 --> 00:01:07,000
+You give me always my surprise, so tell me tell me why
+
+3
+00:01:07,000 --> 00:01:10,000
+You treat me really like a toy
+
+4
+00:01:10,000 --> 00:01:13,000
+Baby, make a make a make up, you're my set to make up
+
+5
+00:01:13,000 --> 00:01:16,000
+Make it a just one that you need
+
+6
+00:01:16,000 --> 00:01:18,000
+Baby, love and love and love me
+
+7
+00:01:18,000 --> 00:01:22,000
+Love is one that's one thing, the most important thing to do
+
+8
+00:01:22,000 --> 00:01:25,000
+But you're killing my love, and everybody's sure
+
+9
+00:01:25,000 --> 00:01:27,000
+You put together my love
+
+10
+00:01:27,000 --> 00:01:30,000
+You give me love, and you love me forever
+
+11
+00:01:30,000 --> 00:01:33,000
+The places they never, I give you remember
+
+12
+00:01:33,000 --> 00:01:36,000
+The dreams they met, the hearts, you're killing my love
+
+13
+00:01:36,000 --> 00:01:39,000
+And you move this journey, put together my love
+
+14
+00:01:39,000 --> 00:01:42,000
+You give me love, and you love me forever
+
+15
+00:01:42,000 --> 00:01:44,000
+I'm gonna have a kiss with you together
+
+16
+00:01:44,000 --> 00:01:47,000
+I don't want to believe in love anymore
+
+17
+00:02:03,000 --> 00:02:05,000
+You're gonna destroy my life
+
+18
+00:02:05,000 --> 00:02:08,000
+I would think you'd do it come your way
+
+19
+00:02:08,000 --> 00:02:10,000
+You can't believe I'm your life
+
+20
+00:02:10,000 --> 00:02:12,000
+So tell me, tell me why
+
+21
+00:02:12,000 --> 00:02:14,000
+You've been a lollipop at your home
+
+22
+00:02:14,000 --> 00:02:16,000
+Baby, make a make a make a make up
+
+23
+00:02:16,000 --> 00:02:18,000
+You're my side to wake up
+
+24
+00:02:18,000 --> 00:02:20,000
+Baby, I just want to let you leave
+
+25
+00:02:20,000 --> 00:02:22,000
+Baby, I love, I love, I love me
+
+26
+00:02:22,000 --> 00:02:24,000
+Love is one, it's one thing
+
+27
+00:02:24,000 --> 00:02:26,000
+The most important thing to do
+
+28
+00:02:26,000 --> 00:02:28,000
+But you're killing my love
+
+29
+00:02:28,000 --> 00:02:30,000
+And I'm breathing strongly
+
+30
+00:02:30,000 --> 00:02:32,000
+But you're killing my love
+
+31
+00:02:32,000 --> 00:02:34,000
+What is up for anyone?
+
+32
+00:02:34,000 --> 00:02:36,000
+Love is forever for places
+
+33
+00:02:36,000 --> 00:02:38,000
+And never to keep you remember
+
+34
+00:02:38,000 --> 00:02:40,000
+You're killing my love
+
+35
+00:02:40,000 --> 00:02:42,000
+And you've been showing me
+
+36
+00:02:42,000 --> 00:02:44,000
+But you're killing my love
+
+37
+00:02:44,000 --> 00:02:46,000
+What is up for anyone?
+
+38
+00:02:46,000 --> 00:02:48,000
+You're killing my love
+
+39
+00:02:48,000 --> 00:02:50,000
+And you've been showing me
+
+40
+00:02:50,000 --> 00:02:52,000
+But you're killing my love
+
+41
+00:02:52,000 --> 00:03:10,000
+You're killing my love
+
+42
+00:03:10,000 --> 00:03:18,000
+You're killing my love
+
+43
+00:03:18,000 --> 00:03:22,000
+But you're killing my love
+
+44
+00:03:22,000 --> 00:03:24,000
+And you've been showing me
+
+45
+00:03:24,000 --> 00:03:26,000
+But you're killing my love
+
+46
+00:03:26,000 --> 00:03:28,000
+What is up for anyone?
+
+47
+00:03:28,000 --> 00:03:30,000
+You're killing my love
+
+48
+00:03:30,000 --> 00:03:58,000
+And you've been loving me more
+
+49
+00:03:58,000 --> 00:04:00,000
+Baby, make a make up, make a make up
+
+50
+00:04:00,000 --> 00:04:02,000
+You're my side to wake up
+
+51
+00:04:02,000 --> 00:04:04,000
+Baby, I just want to let you leave
+
+52
+00:04:04,000 --> 00:04:06,000
+Baby, I love, I love, I love me
+
+53
+00:04:06,000 --> 00:04:08,000
+Love is one, it's one thing
+
+54
+00:04:08,000 --> 00:04:10,000
+The most important thing to do
+
+55
+00:04:10,000 --> 00:04:12,000
+But you're killing my love
+
+56
+00:04:12,000 --> 00:04:14,000
+And I'm breathing strongly
+
+57
+00:04:14,000 --> 00:04:16,000
+But you're killing my love
+
+58
+00:04:16,000 --> 00:04:18,000
+What is up for anyone?
+
+59
+00:04:18,000 --> 00:04:20,000
+Love is forever for places
+
+60
+00:04:20,000 --> 00:04:22,000
+And never to keep you remember
+
+61
+00:04:22,000 --> 00:04:24,000
+You're killing my love
+
+62
+00:04:24,000 --> 00:04:26,000
+And you've been showing me
+
+63
+00:04:26,000 --> 00:04:28,000
+But you're killing my love
+
+64
+00:04:28,000 --> 00:04:30,000
+My views aren't performing
+
+65
+00:04:30,000 --> 00:04:32,000
+To hinder forever
+
+66
+00:04:32,000 --> 00:04:34,000
+It's просто between together
+
+67
+00:04:34,000 --> 00:04:36,000
+I don't want't believe in love anymore
+
+68
+00:04:36,000 --> 00:04:52,040
+are
+
+69
+00:04:52,040 --> 00:04:37,220
+KILL IT
+
+70
+00:04:52,500 --> 00:04:52,760
+leb
+
+71
+00:04:52,760 --> 00:04:54,760
+You
+
diff --git a/java/data/heroplanet.mp3 b/java/data/heroplanet.mp3
deleted file mode 100644
index 681f02d31..000000000
Binary files a/java/data/heroplanet.mp3 and /dev/null differ
diff --git a/java/src/C21468162/CelebrationStation.java b/java/src/C21468162/CelebrationStation.java
new file mode 100644
index 000000000..6e7d00c26
--- /dev/null
+++ b/java/src/C21468162/CelebrationStation.java
@@ -0,0 +1,101 @@
+package C21468162;
+
+import processing.core.PApplet;
+import processing.core.PVector;
+import processing.event.MouseEvent;
+import java.util.ArrayList;
+
+public class CelebrationStation extends PApplet {
+
+ ArrayList fireworks = new ArrayList<>();
+ float renderBox = 800;
+ float t = 0;
+ float camSpeed = 0.005f;
+ float camAngle = 0;
+ float orbitRadius = 1300;
+ PVector camPos;
+ float prevX, prevY;
+
+ public void settings() {
+ size(800, 600, P3D);
+ }
+
+ public void setup() {
+ smooth();
+ camPos = new PVector(0, 0, orbitRadius);
+ }
+
+ public int getGradientColor(float t) {
+ // Calculate red, green, and blue values as functions of time
+ int r = (int)(127 * (sin(0.1f*t + 0) + 1));
+ int g = (int)(127 * (sin(0.1f*t + 2) + 1));
+ int b = (int)(127 * (sin(0.1f*t + 4) + 1));
+
+ // Combine red, green, and blue values into an RGB color
+ return color(r, g, b);
+ }
+
+ public void draw() {
+ background(20);
+ lights();
+
+ // Create new firework randomly
+ if (random(1) < 0.05) {
+ fireworks.add(new Firework(this, new PVector(random(-renderBox/2, renderBox/2), random(-renderBox/2, renderBox/2), random(-renderBox/2, renderBox/2))));
+ }
+
+ // Update and show fireworks
+ for (int i = fireworks.size() - 1; i >= 0; i--) {
+ Firework fw = fireworks.get(i);
+ fw.applyForce(new PVector(0, 0.05f, 0));
+ fw.update();
+ if (fw.isDone()) {
+ fireworks.remove(i);
+ } else {
+ fw.show();
+ }
+ }
+
+ // Move camera around the origin
+ camPos.x = orbitRadius * cos(camAngle);
+ camPos.z = orbitRadius * sin(camAngle);
+ camera(camPos.x, camPos.y, camPos.z, 0, 0, 0, 0, 1, 0);
+ camAngle += camSpeed;
+
+
+ // Draw a rotating wireframe box
+ noFill();
+ stroke(getGradientColor(t * 0.05f));
+ smooth();
+ rotateY(t * 0.0005f);
+ box(renderBox);
+
+ t++;
+
+ if (keyCode == LEFT) {
+ // Change box to triangle
+ beginShape();
+ vertex(0, -renderBox/2, 0);
+ vertex(-renderBox/2, renderBox/2, 0);
+ vertex(renderBox/2, renderBox/2, 0);
+ endShape(CLOSE);
+ } else if (keyCode == RIGHT) {
+ // Change box to circle
+ ellipse(0, 0, renderBox, renderBox);
+ }
+ }
+
+ public void mouseWheel(MouseEvent event) {
+ orbitRadius += event.getCount() * 10;
+ }
+
+ public void keyPressed() {
+ if (keyCode == DOWN) {
+ camSpeed -= 0.001f;
+ }
+ if (keyCode == UP) {
+ camSpeed += 0.001f;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/java/src/C21468162/Firework.java b/java/src/C21468162/Firework.java
new file mode 100644
index 000000000..164d39de7
--- /dev/null
+++ b/java/src/C21468162/Firework.java
@@ -0,0 +1,50 @@
+package C21468162;
+
+import processing.core.PApplet;
+import processing.core.PVector;
+
+import java.util.ArrayList;
+
+public class Firework {
+
+ PApplet sketch;
+ ArrayList particles;
+ PVector pos;
+
+ public Firework(PApplet sketch, PVector pos) {
+ this.sketch = sketch;
+ this.pos = pos.copy();
+ particles = new ArrayList<>();
+ int numParticles = PApplet.floor(sketch.random(50, 80));
+ for (int i = 0; i < numParticles; i++) {
+ float size = sketch.random(5, 10);
+ particles.add(new Particle(sketch, pos, size));
+ }
+ }
+
+ public void applyForce(PVector force) {
+ for (Particle p : particles) {
+ p.applyForce(force);
+ }
+ }
+
+ public void update() {
+ for (int i = particles.size() - 1; i >= 0; i--) {
+ Particle p = particles.get(i);
+ p.update();
+ if (p.isDone()) {
+ particles.remove(i);
+ }
+ }
+ }
+
+ public void show() {
+ for (Particle p : particles) {
+ p.show();
+ }
+ }
+
+ public boolean isDone() {
+ return particles.isEmpty();
+ }
+}
\ No newline at end of file
diff --git a/java/src/C21468162/Particle.java b/java/src/C21468162/Particle.java
new file mode 100644
index 000000000..44b44afe4
--- /dev/null
+++ b/java/src/C21468162/Particle.java
@@ -0,0 +1,51 @@
+package C21468162;
+
+import processing.core.PApplet;
+import processing.core.PVector;
+
+public class Particle {
+
+ PApplet sketch;
+ PVector pos;
+ PVector vel;
+ PVector acc;
+ float lifespan;
+ float size;
+
+ public Particle(PApplet sketch, PVector pos, float size) {
+ this.sketch = sketch;
+ this.pos = pos.copy();
+ vel = new PVector(sketch.random(-1, 1), sketch.random(-2, 0), sketch.random(-1, 1));
+ acc = new PVector(0, 0, 0);
+ lifespan = 750;
+ this.size = size;
+ }
+
+ public void applyForce(PVector force) {
+ acc.add(force);
+ }
+
+ public void update() {
+ vel.add(acc);
+ pos.add(vel);
+ acc.mult(0);
+ lifespan -= 2;
+ }
+
+ public void show() {
+ sketch.pushMatrix();
+ sketch.translate(pos.x, pos.y, pos.z);
+ sketch.colorMode(PApplet.RGB);
+ sketch.strokeWeight(2);
+ sketch.stroke(sketch.random(255), sketch.random(255), sketch.random(255), lifespan);
+ sketch.ellipse(0, 0, size, size);
+ sketch.popMatrix();
+ }
+
+ public boolean isDone() {
+ float boxSize = sketch.width;
+ return pos.x < -boxSize/2 || pos.x > boxSize/2 ||
+ pos.y < -boxSize/2 || pos.y > boxSize/2 ||
+ pos.z < -boxSize/2 || pos.z > boxSize/2;
+ }
+}
\ No newline at end of file
diff --git a/java/src/C21468162/WarpedSpace.java b/java/src/C21468162/WarpedSpace.java
new file mode 100644
index 000000000..7d200e819
--- /dev/null
+++ b/java/src/C21468162/WarpedSpace.java
@@ -0,0 +1,73 @@
+package C21468162;
+
+import processing.core.PApplet;
+import processing.event.MouseEvent;
+
+public class WarpedSpace extends PApplet {
+
+ double speed;
+ Star[] stars;
+
+ public void settings() {
+ size(800,600); //screen width and height
+ }
+
+ public void setup() {
+ speed = 10; //increase speed to make the particles appear longer
+ stars = new Star[2500];
+ for (int i = 0; i < 2500; i++) stars[i] = new Star();
+ translate(width/2, height/2);
+ }
+
+ public void draw() {
+ background(0, 0, 0, 10);
+ translate(width / 2, height / 2);
+ for (Star s : stars) {
+ s.update();
+ s.show();
+ }
+ }
+
+ //on mouse scroll changes speed and color
+ public void mouseWheel(MouseEvent event) {
+ stroke(random(255), random(255), random(255));
+ if (event.getCount() < 0) speed *= 1.1;
+ else speed *= 0.9;
+ if (speed < 0.01) speed = 0.01;
+ else if (speed > 0.1) speed = 0.1;
+ }
+
+ public class Star {
+ float x, y, px, py, z;
+
+ public Star() {
+ //initializing
+ x = random(width)-width/2; //random x
+ y = random(height)-height/2; //random y
+ z = random(4); //random z
+ }
+
+ public void update() {
+ //stores previous x, y and z and generates new coordinates
+ px = x;
+ py = y;
+ z += speed;
+ x += x*(speed*0.2)*z;
+ y += y*(speed*0.2)*z;
+ if (x > width/2+50 || x < -width/2-50 ||
+ y > height/2+50 || y < -height/2-50) {
+ x = random(width)-width/2;
+ y = random(height)-height/2;
+ px = x;
+ py = y;
+ z = 0;
+ }
+ }
+
+ //draws line from x,y to px,py
+ public void show() {
+ strokeWeight((float) (z * 0.8));
+ line(x, y, x + (x - px) * z, y + (y - py) * z);
+ }
+ }
+}
diff --git a/java/src/C21725659/Check.java b/java/src/C21725659/Check.java
new file mode 100644
index 000000000..fc4ee649f
--- /dev/null
+++ b/java/src/C21725659/Check.java
@@ -0,0 +1,249 @@
+package C21725659;
+
+import ie.tudublin.Visual;
+import ie.tudublin.VisualException;
+import processing.core.PFont;
+import processing.core.PVector;
+import Global.*;
+
+import java.util.ArrayList;
+
+public class Check extends Visual {
+
+ ArrayList particles = new ArrayList();
+ int currentTime = 0;
+ SubtitleHandler subtitleHandler;
+ ArrayList subtitles;
+ int currentSubtitleIndex = 0;
+ int previousSubtitleIndex = -1;
+ PFont subtitleFont;
+ float strobeTimer = 0;
+ float strobeInterval = 0;
+
+
+
+ public void settings() {
+ size(1280, 720, P3D);
+ }
+
+ float eyeX = 0;
+ float eyeY = -500;
+ float eyeZ = 500;
+ float centerX = 0;
+ float centerY = 0;
+ float centerZ = 0;
+ float upX = 0;
+ float upY = 1;
+ float upZ = 0;
+
+ boolean[] keys = new boolean[128];
+
+ public void keyPressed() {
+ if (key >= 0 && key < keys.length) {
+ keys[key] = true;
+ }
+ }
+
+ public void keyReleased() {
+ if (key >= 0 && key < keys.length) {
+ keys[key] = false;
+ }
+ }
+
+ public void updateCamera() {
+ float cameraMoveAmount = 5;
+ float cameraRotAmount = 0.01f;
+
+ if (keys[UP]) {
+ eyeY += cameraMoveAmount;
+ }
+ if (keys[DOWN]) {
+ eyeY -= cameraMoveAmount;
+ }
+ if (keys[LEFT]) {
+ eyeX += cameraMoveAmount;
+ }
+ if (keys[RIGHT]) {
+ eyeX -= cameraMoveAmount;
+ }
+ if (keys['Q'] || keys['q']) {
+ centerX += cameraMoveAmount;
+ }
+ if (keys['A'] || keys['a']) {
+ centerX -= cameraMoveAmount;
+ }
+ if (keys['W'] || keys['w']) {
+ centerY += cameraMoveAmount;
+ }
+ if (keys['S'] || keys['s']) {
+ centerY -= cameraMoveAmount;
+ }
+ if (keys['E'] || keys['e']) {
+ centerZ += cameraMoveAmount;
+ }
+ if (keys['D'] || keys['d']) {
+ centerZ -= cameraMoveAmount;
+ }
+ }
+
+ public void setup() {
+ textSize(20);
+ subtitleFont = createFont("Arial", 20);
+ textFont(subtitleFont);
+ colorMode(HSB);
+ SubtitleHandler subtitleHandler = new SubtitleHandler(this);
+ subtitles = subtitleHandler.parseSrt("InitialD-KillingMyLove.mp3.srt");
+ startMinim();
+ loadAudio("InitialD-KillingMyLove.mp3");
+ getAudioPlayer().play();
+ getAudioPlayer().cue(60000);
+ }
+
+ float radius = 200;
+ float rot = 0;
+
+ public void draw() {
+ calculateAverageAmplitude();
+ try {
+ calculateFFT();
+ } catch (VisualException e) {
+ e.printStackTrace();
+ }
+ calculateFrequencyBands();
+ // Strobe effect on background
+ // m
+ if (getSmoothedAmplitude() > 0.1) {
+ strobeTimer += getSmoothedAmplitude() * 0.1f;
+ if (strobeTimer > strobeInterval) {
+ strobeTimer = 0;
+ strobeInterval = random(0.1f, 0.5f);
+ background(255);
+ } else {
+ background(0);
+ }
+ } else {
+ background(0);
+ }
+
+
+
+
+ noFill();
+ stroke(255);
+ lights();
+ stroke(map(getSmoothedAmplitude(), 0, 1, 0, 255), 255, 255);
+ updateCamera();
+ camera(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);
+ rot += getAmplitude() / 8.0f;
+ textAlign(CENTER, CENTER);
+ rotateY(rot);
+
+ displayCurrentSubtitle();
+
+ // // Draw fractical tree
+ // pushMatrix();
+ // drawBranch(200);
+ // popMatrix();
+
+
+
+ float[] bands = getSmoothedBands();
+ for (int i = 0; i < bands.length; i++) {
+ float theta = map(i, 0, bands.length, 0, TWO_PI);
+ stroke(map(i, 0, bands.length, 0, 255), 255, 255);
+ float x = sin(theta) * radius;
+ float z = cos(theta) * radius;
+ float h = bands[i];
+ pushMatrix();
+ translate(x, -h / 2, z);
+ rotateY(theta);
+ box(50, h, 50);
+ popMatrix();
+ }
+
+ // Particle system
+ if (getAmplitude() > 0.1) {
+ PVector position = new PVector(0, 0, 0);
+ PVector velocity = PVector.random3D().mult(getAmplitude() * 200);
+ float size = map(getAmplitude(), 0, 1, 5, 20);
+ int color = color(random(255), random(255), random(255));
+ float lifespan = random(20, 100);
+ particles.add(new Particle(this, position, velocity, size, color, lifespan));
+ }
+
+ for (int i = particles.size() - 1; i >= 0; i--) {
+ Particle p = particles.get(i);
+ p.update();
+ p.display();
+
+ if (p.isDead()) {
+ particles.remove(i);
+ }
+ }
+ }
+
+
+
+ void drawBranch(float len) {
+ float amplitudeScaling = map(getSmoothedAmplitude(), 0, 1, 0.5f, 2);
+ len *= amplitudeScaling;
+ line(0, 0, 0, -len);
+ translate(0, -len);
+
+ if (len > 4) {
+ pushMatrix();
+ rotate(QUARTER_PI / 2 * amplitudeScaling);
+ drawBranch(len * 0.67f);
+ popMatrix();
+
+ pushMatrix();
+ rotate(-QUARTER_PI / 2 * amplitudeScaling);
+ drawBranch(len * 0.67f);
+ popMatrix();
+ }
+ }
+
+
+
+ public void displayCurrentSubtitle() {
+ int playPosition = getAudioPlayer().position();
+ int totalTimeInSeconds = playPosition / 1000;
+ int subtitleIndex = -1;
+
+ for (int i = 0; i < subtitles.size(); i++) {
+ Subtitle subtitle = subtitles.get(i);
+ if (totalTimeInSeconds >= subtitle.getStart() / 1000.0f
+ && totalTimeInSeconds <= subtitle.getEnd() / 1000.0f) {
+ subtitleIndex = i;
+ break;
+ }
+ }
+
+ if (subtitleIndex != currentSubtitleIndex) {
+ currentSubtitleIndex = subtitleIndex;
+ }
+
+ if (currentSubtitleIndex >= 0 && currentSubtitleIndex < subtitles.size()) {
+ // Display the subtitle text on the screen
+ String currentSubtitle = subtitles.get(currentSubtitleIndex).getText();
+
+ textAlign(CENTER);
+ fill(255);
+ text(currentSubtitle, 0, -300); // Adjust the position to be centered and close to the top
+
+
+ }
+ noFill();
+ pushMatrix();
+ translate(0, -200, 0);
+ float sphereSize = map(getAmplitude(), 0, 1, 0, 200);
+ noStroke();
+ fill(map(getAmplitude(), 0, 1, 0, 255), 255, 255);
+ sphere(sphereSize);
+ popMatrix();
+ noFill();
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/java/src/C21725659/DemiAudioVisualiser.java b/java/src/C21725659/DemiAudioVisualiser.java
new file mode 100644
index 000000000..878e69b66
--- /dev/null
+++ b/java/src/C21725659/DemiAudioVisualiser.java
@@ -0,0 +1,321 @@
+package C21725659;
+
+import ie.tudublin.Visual;
+import ie.tudublin.VisualException;
+import processing.core.PFont;
+import processing.core.PVector;
+import Global.*;
+
+import java.util.ArrayList;
+
+public class DemiAudioVisualiser extends Visual {
+
+ // Sphere variables
+ PVector[][] globe;
+ int r = 200;
+ int total = 25;
+ float angleX = 0;
+ float angleY = 0;
+
+ ArrayList particles = new ArrayList();
+ ArrayList noteSprites = new ArrayList();
+ ArrayList notes = new ArrayList();
+ int currentTime = 0;
+ SubtitleHandler subtitleHandler;
+ ArrayList subtitles;
+ int currentSubtitleIndex = 0;
+ int previousSubtitleIndex = -1;
+ PFont subtitleFont;
+ float strobeTimer = 0;
+ float strobeInterval = 0;
+ NoteManager noteManager;
+ String words[];
+
+ public void settings() {
+ size(1280, 720, P3D);
+ }
+
+ float eyeX = 0;
+ float eyeY = -500;
+ float eyeZ = 500;
+ float centerX = 0;
+ float centerY = 0;
+ float centerZ = 0;
+ float upX = 0;
+ float upY = 1;
+ float upZ = 0;
+
+ boolean[] keys = new boolean[128];
+
+ public void keyPressed() {
+ if (key >= 0 && key < keys.length) {
+ keys[key] = true;
+ }
+ }
+
+ public void keyReleased() {
+ if (key >= 0 && key < keys.length) {
+ keys[key] = false;
+ }
+ }
+
+ public void updateCamera() {
+ float cameraMoveAmount = 5;
+ float cameraRotAmount = 0.01f;
+
+ if (keys[UP]) {
+ eyeY += cameraMoveAmount;
+ }
+ if (keys[DOWN]) {
+ eyeY -= cameraMoveAmount;
+ }
+ if (keys[LEFT]) {
+ eyeX += cameraMoveAmount;
+ }
+ if (keys[RIGHT]) {
+ eyeX -= cameraMoveAmount;
+ }
+ if (keys['Q'] || keys['q']) {
+ centerX += cameraMoveAmount;
+ }
+ if (keys['A'] || keys['a']) {
+ centerX -= cameraMoveAmount;
+ }
+ if (keys['W'] || keys['w']) {
+ centerY += cameraMoveAmount;
+ }
+ if (keys['S'] || keys['s']) {
+ centerY -= cameraMoveAmount;
+ }
+ if (keys['E'] || keys['e']) {
+ centerZ += cameraMoveAmount;
+ }
+ if (keys['D'] || keys['d']) {
+ centerZ -= cameraMoveAmount;
+ }
+ }
+
+ int getNoteTypeFromAmplitude(float amplitude) {
+ if (amplitude >= 0 && amplitude < 1.0 / 3.0) {
+ return 0;
+ } else if (amplitude >= 1.0 / 3.0 && amplitude < 2.0 / 3.0) {
+ return 1;
+ } else {
+ return 2;
+ }
+ }
+
+ public void setup() {
+ // Sphere setup
+ globe = new PVector[total + 1][total + 1];
+
+ for (int i = 0; i < total + 1; i++) {
+ for (int j = 0; j < total + 1; j++) {
+ float lat = map(i, 0, total, 0, PI);
+ float lon = map(j, 0, total, 0, TWO_PI);
+ float x = r * sin(lat) * cos(lon);
+ float y = r * sin(lat) * sin(lon);
+ float z = r * cos(lat);
+ globe[i][j] = new PVector(x, y, z);
+ }
+ }
+
+ textSize(20);
+ subtitleFont = createFont("Arial", 20);
+ textFont(subtitleFont);
+ colorMode(HSB);
+ SubtitleHandler subtitleHandler = new SubtitleHandler(this);
+ NoteManager noteManager = new NoteManager(this);
+ subtitles = subtitleHandler.parseSrt("InitialD-KillingMyLove.mp3.srt");
+ startMinim();
+ loadAudio("InitialD-KillingMyLove.mp3");
+ getAudioPlayer().play();
+ getAudioPlayer().cue(60000);
+ }
+
+ float radius = 200;
+ float rot = 0;
+
+ public void draw() {
+ calculateAverageAmplitude();
+ try {
+ calculateFFT();
+ } catch (VisualException e) {
+ e.printStackTrace();
+ }
+ calculateFrequencyBands();
+ // Strobe effect on background
+ if (getSmoothedAmplitude() > 0.1) {
+ strobeTimer += getSmoothedAmplitude() * 0.1f;
+ if (strobeTimer > strobeInterval) {
+ strobeTimer = 0;
+ strobeInterval = random(0.1f, 0.5f);
+ background(255);
+ } else {
+ background(0);
+ }
+ } else {
+ background(0);
+ }
+
+ noFill();
+ stroke(255);
+ lights();
+ stroke(map(getSmoothedAmplitude(), 0, 1, 0, 255), 255, 255);
+ updateCamera();
+ camera(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);
+ rot += getAmplitude() / 8.0f;
+ textAlign(CENTER, CENTER);
+ rotateY(rot);
+
+ displayCurrentSubtitle();
+
+ // // Draw fractical tree
+ // pushMatrix();
+ // drawBranch(200);
+ // popMatrix();
+
+
+ // Sphere drawing code
+ pushMatrix();
+ translate(width / 2, height / 2, 10);
+ rotateX(angleX);
+ rotateY(angleY);
+
+ for (int i = 0; i < total; i++) {
+ beginShape(TRIANGLE_STRIP);
+ for (int j = 0; j < total + 1; j++) {
+ PVector v1 = globe[i][j];
+ vertex(v1.x, v1.y, v1.z);
+ PVector v2 = globe[i + 1][j];
+ vertex(v2.x, v2.y, v2.z);
+ }
+ endShape();
+ }
+
+ angleX += 0.005;
+ angleY += 0.006;
+ popMatrix();
+
+ // Frequency bands drawing code (remains the same)
+ float bands[] = getSmoothedBands();
+ for (int i = 0; i < bands.length; i++) {
+ float theta = map(i, 0, bands.length, 0, TWO_PI);
+ stroke(map(i, 0, bands.length, 0, 255), 255, 255);
+ float x = sin(theta) * radius;
+ float z = cos(theta) * radius;
+ float h = bands[i];
+ pushMatrix();
+ translate(x, -h / 2, z);
+ rotateY(theta);
+ box(50, h, 50);
+ popMatrix();
+ }
+
+ // Particle system
+ if (getAmplitude() > 0.1) {
+ PVector position = new PVector(0, 0, 0);
+ PVector velocity = PVector.random3D().mult(getAmplitude() * 200);
+ float size = map(getAmplitude(), 0, 1, 5, 20);
+ int color = color(random(255), random(255), random(255));
+ float lifespan = random(20, 100);
+ particles.add(new Particle(this, position, velocity, size, color, lifespan));
+ }
+ // Note system
+ if (getAmplitude() > 0.1) {
+ PVector position = new PVector(0, 0, 0);
+ float size = map(getAmplitude(), 0, 1, 5, 20);
+ int noteType = (int) random(0, 2); // Randomly choose between noteType 0 and 1
+ float lifetime = random(20, 100);
+ noteSprites.add(new MusicalNoteSprite(this, position, size, noteType, lifetime));
+ }
+
+ for (int i = particles.size() - 1; i >= 0; i--) {
+ Particle p = particles.get(i);
+ p.update();
+ p.display();
+
+ if (p.isDead()) {
+ particles.remove(i);
+ }
+ }
+ for (int i = noteSprites.size() - 1; i >= 0; i--) {
+ MusicalNoteSprite noteSprite = noteSprites.get(i);
+ noteSprite.display(this);
+ boolean expired = noteSprite.update(1); // You can adjust the deltaTime value accordingly
+
+ if (expired) {
+ noteSprites.remove(i);
+ }
+ }
+
+ }
+
+ void drawBranch(float len) {
+ float amplitudeScaling = map(getSmoothedAmplitude(), 0, 1, 0.5f, 2);
+ len *= amplitudeScaling;
+ line(0, 0, 0, -len);
+ translate(0, -len);
+
+ if (len > 4) {
+ pushMatrix();
+ rotate(QUARTER_PI / 2 * amplitudeScaling);
+ drawBranch(len * 0.67f);
+ popMatrix();
+
+ pushMatrix();
+ rotate(-QUARTER_PI / 2 * amplitudeScaling);
+ drawBranch(len * 0.67f);
+ popMatrix();
+ }
+ }
+
+ public void displayCurrentSubtitle() {
+ int playPosition = getAudioPlayer().position();
+ int totalTimeInSeconds = playPosition / 1000;
+ int subtitleIndex = -1;
+
+ for (int i = 0; i < subtitles.size(); i++) {
+ Subtitle subtitle = subtitles.get(i);
+ if (totalTimeInSeconds >= subtitle.getStart() / 1000.0f
+ && totalTimeInSeconds <= subtitle.getEnd() / 1000.0f) {
+ subtitleIndex = i;
+ break;
+ }
+ }
+
+ if (subtitleIndex != -1 && subtitleIndex != currentSubtitleIndex) {
+ currentSubtitleIndex = subtitleIndex;
+
+ // This is the code in the middle
+ Subtitle currentSubtitle = subtitles.get(currentSubtitleIndex);
+ words = currentSubtitle.getText().split("\\s+");
+ notes.clear(); // Clear existing text sprites
+
+ for (String word : words) {
+ PVector position = new PVector(random(width), random(height));
+ PVector velocity = new PVector(random(-1, 1), random(-1, 1));
+ int textSize = 24;
+ int color = color(255, 255, 255); // white text
+ notes.add(new textSprites(position, velocity, word, textSize, color));
+ }
+ }
+
+ if (currentSubtitleIndex >= 0 && currentSubtitleIndex < subtitles.size()) {
+ // Display the subtitle text on the screen
+ String currentSubtitle = subtitles.get(currentSubtitleIndex).getText();
+
+ textAlign(CENTER);
+ fill(255);
+ text(currentSubtitle, 0, -300); // Adjust the position to be centered and close to the top
+ noFill();
+ }
+
+ // Update and display text sprites
+ for (int i = notes.size() - 1; i >= 0; i--) {
+ textSprites textSprite = notes.get(i);
+ textSprite.display(this);
+ textSprite.update();
+ }
+ }
+}
\ No newline at end of file
diff --git a/java/src/C21725659/MusicalNoteSprite.java b/java/src/C21725659/MusicalNoteSprite.java
new file mode 100644
index 000000000..511a8d908
--- /dev/null
+++ b/java/src/C21725659/MusicalNoteSprite.java
@@ -0,0 +1,69 @@
+package C21725659;
+
+import processing.core.PApplet;
+import processing.core.PVector;
+
+class MusicalNoteSprite {
+ PVector position;
+ float size;
+ int noteType;
+ float lifetime;
+ float remainingLifetime;
+
+ MusicalNoteSprite(PApplet parent, PVector position, float size, int noteType, float lifetime) {
+ this.position = position;
+ this.size = size;
+ this.noteType = noteType;
+ this.lifetime = lifetime;
+ this.remainingLifetime = lifetime;
+ }
+
+ void display(PApplet parent) {
+ parent.pushMatrix();
+ parent.translate(position.x, position.y, position.z);
+ parent.rotateY(parent.frameCount * 0.01f);
+ parent.scale(size);
+ parent.noStroke();
+ parent.fill(255);
+ switch (noteType) {
+ case 0:
+ displayQuarterNote(parent);
+ break;
+ case 1:
+ displayEighthNote(parent);
+ break;
+ default:
+ break;
+ }
+ parent.popMatrix();
+ }
+
+ void displayQuarterNote(PApplet parent) {
+ parent.sphere(size * 0.25f);
+ drawCylinder(parent, size * 0.125f, size);
+ }
+
+ void displayEighthNote(PApplet parent) {
+ parent.sphere(size * 0.125f);
+ drawCylinder(parent, size * 0.0625f, size);
+ }
+
+ void drawCylinder(PApplet parent, float r, float h) {
+ int sides = 16;
+ parent.beginShape(PApplet.QUAD_STRIP);
+ for (int i = 0; i <= sides; i++) {
+ float angle = PApplet.TWO_PI / sides * i;
+ float x = PApplet.cos(angle) * r;
+ float y = PApplet.sin(angle) * r;
+ parent.vertex(x, y, 0);
+ parent.vertex(x, y, h);
+ }
+ parent.endShape();
+ }
+
+ boolean update(float deltaTime){
+ remainingLifetime -= deltaTime;
+ return remainingLifetime <= 0;
+ }
+}
+
diff --git a/java/src/C21725659/NoteManager.java b/java/src/C21725659/NoteManager.java
new file mode 100644
index 000000000..6e83dc499
--- /dev/null
+++ b/java/src/C21725659/NoteManager.java
@@ -0,0 +1,42 @@
+package C21725659;
+
+import java.util.ArrayList;
+
+import processing.core.PApplet;
+import processing.core.PVector;
+
+class NoteManager {
+ ArrayList notes;
+ PApplet parent;
+
+ NoteManager(PApplet parent) {
+ this.parent = parent;
+ notes = new ArrayList<>();
+ }
+
+ void update(float amplitude) {
+ for (int i = notes.size() - 1; i >= 0; i--) {
+ MusicalNoteSprite note = notes.get(i);
+ if (note.update(parent.frameRate)) {
+ notes.remove(i);
+ }
+ }
+
+ if (amplitude > 0.1) {
+ float x = parent.random(-parent.width * 0.5f, parent.width * 0.5f);
+ float y = parent.random(-parent.height * 0.5f, parent.height * 0.5f);
+ float z = parent.random(-100, 100);
+ PVector position = new PVector(x, y, z);
+ float size = parent.random(1, 5);
+ int noteType = (int) parent.random(0, 2);
+ float lifetime = parent.random(60, 240);
+ notes.add(new MusicalNoteSprite(parent, position, size, noteType, lifetime));
+ }
+ }
+
+ void display() {
+ for (MusicalNoteSprite note : notes) {
+ note.display(parent);
+ }
+ }
+}
diff --git a/java/src/C21725659/Prototype.java b/java/src/C21725659/Prototype.java
new file mode 100644
index 000000000..e93f0107d
--- /dev/null
+++ b/java/src/C21725659/Prototype.java
@@ -0,0 +1,246 @@
+package C21725659;
+
+import ie.tudublin.Visual;
+import ie.tudublin.VisualException;
+import processing.core.PFont;
+import processing.core.PVector;
+import Global.*;
+
+import java.util.ArrayList;
+
+public class Prototype extends Visual {
+
+ ArrayList particles = new ArrayList();
+ int currentTime = 0;
+ SubtitleHandler subtitleHandler;
+ ArrayList subtitles;
+ int currentSubtitleIndex = 0;
+ int previousSubtitleIndex = -1;
+ PFont subtitleFont;
+ float strobeTimer = 0;
+ float strobeInterval = 0;
+
+ public void settings() {
+ size(1280, 720, P3D);
+ }
+
+ float eyeX = 0;
+ float eyeY = -500;
+ float eyeZ = 500;
+ float centerX = 0;
+ float centerY = 0;
+ float centerZ = 0;
+ float upX = 0;
+ float upY = 1;
+ float upZ = 0;
+
+ boolean[] keys = new boolean[128];
+
+ public void keyPressed() {
+ if (key >= 0 && key < keys.length) {
+ keys[key] = true;
+ }
+ }
+
+ public void keyReleased() {
+ if (key >= 0 && key < keys.length) {
+ keys[key] = false;
+ }
+ }
+
+ public void updateCamera() {
+ float cameraMoveAmount = 5;
+ float cameraRotAmount = 0.01f;
+
+ if (keys[UP]) {
+ eyeY += cameraMoveAmount;
+ }
+ if (keys[DOWN]) {
+ eyeY -= cameraMoveAmount;
+ }
+ if (keys[LEFT]) {
+ eyeX += cameraMoveAmount;
+ }
+ if (keys[RIGHT]) {
+ eyeX -= cameraMoveAmount;
+ }
+ if (keys['Q'] || keys['q']) {
+ centerX += cameraMoveAmount;
+ }
+ if (keys['A'] || keys['a']) {
+ centerX -= cameraMoveAmount;
+ }
+ if (keys['W'] || keys['w']) {
+ centerY += cameraMoveAmount;
+ }
+ if (keys['S'] || keys['s']) {
+ centerY -= cameraMoveAmount;
+ }
+ if (keys['E'] || keys['e']) {
+ centerZ += cameraMoveAmount;
+ }
+ if (keys['D'] || keys['d']) {
+ centerZ -= cameraMoveAmount;
+ }
+ }
+
+ public void setup() {
+ textSize(20);
+ subtitleFont = createFont("Arial", 20);
+ textFont(subtitleFont);
+ colorMode(HSB);
+ SubtitleHandler subtitleHandler = new SubtitleHandler(this);
+ subtitles = subtitleHandler.parseSrt("InitialD-KillingMyLove.mp3.srt");
+ startMinim();
+ loadAudio("InitialD-KillingMyLove.mp3");
+ getAudioPlayer().play();
+ getAudioPlayer().cue(60000);
+ }
+
+ float radius = 200;
+ float rot = 0;
+
+ public void draw() {
+ calculateAverageAmplitude();
+ try {
+ calculateFFT();
+ } catch (VisualException e) {
+ e.printStackTrace();
+ }
+ calculateFrequencyBands();
+ // Strobe effect on background
+ // m
+ if (getSmoothedAmplitude() > 0.1) {
+ strobeTimer += getSmoothedAmplitude() * 0.1f;
+ if (strobeTimer > strobeInterval) {
+ strobeTimer = 0;
+ strobeInterval = random(0.1f, 0.5f);
+ background(255);
+ } else {
+ background(0);
+ }
+ } else {
+ background(0);
+ }
+
+
+
+
+ noFill();
+ stroke(255);
+ lights();
+ stroke(map(getSmoothedAmplitude(), 0, 1, 0, 255), 255, 255);
+ updateCamera();
+ camera(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);
+ rot += getAmplitude() / 8.0f;
+ textAlign(CENTER, CENTER);
+ rotateY(rot);
+
+ displayCurrentSubtitle();
+
+ pushMatrix();
+ drawBranch(200);
+ popMatrix();
+
+
+
+ float[] bands = getSmoothedBands();
+ for (int i = 0; i < bands.length; i++) {
+ float theta = map(i, 0, bands.length, 0, TWO_PI);
+ stroke(map(i, 0, bands.length, 0, 255), 255, 255);
+ float x = sin(theta) * radius;
+ float z = cos(theta) * radius;
+ float h = bands[i];
+ pushMatrix();
+ translate(x, -h / 2, z);
+ rotateY(theta);
+ box(50, h, 50);
+ popMatrix();
+ }
+
+ // Particle system
+ if (getAmplitude() > 0.1) {
+ PVector position = new PVector(0, 0, 0);
+ PVector velocity = PVector.random3D().mult(getAmplitude() * 200);
+ float size = map(getAmplitude(), 0, 1, 5, 20);
+ int color = color(random(255), random(255), random(255));
+ float lifespan = random(20, 100);
+ particles.add(new Particle(this, position, velocity, size, color, lifespan));
+ }
+
+ for (int i = particles.size() - 1; i >= 0; i--) {
+ Particle p = particles.get(i);
+ p.update();
+ p.display();
+
+ if (p.isDead()) {
+ particles.remove(i);
+ }
+ }
+ }
+
+
+
+ void drawBranch(float len) {
+ float amplitudeScaling = map(getSmoothedAmplitude(), 0, 1, 0.5f, 2);
+ len *= amplitudeScaling;
+ line(0, 0, 0, -len);
+ translate(0, -len);
+
+ if (len > 4) {
+ pushMatrix();
+ rotate(QUARTER_PI / 2 * amplitudeScaling);
+ drawBranch(len * 0.67f);
+ popMatrix();
+
+ pushMatrix();
+ rotate(-QUARTER_PI / 2 * amplitudeScaling);
+ drawBranch(len * 0.67f);
+ popMatrix();
+ }
+ }
+
+
+
+ public void displayCurrentSubtitle() {
+ int playPosition = getAudioPlayer().position();
+ int totalTimeInSeconds = playPosition / 1000;
+ int subtitleIndex = -1;
+
+ for (int i = 0; i < subtitles.size(); i++) {
+ Subtitle subtitle = subtitles.get(i);
+ if (totalTimeInSeconds >= subtitle.getStart() / 1000.0f
+ && totalTimeInSeconds <= subtitle.getEnd() / 1000.0f) {
+ subtitleIndex = i;
+ break;
+ }
+ }
+
+ if (subtitleIndex != currentSubtitleIndex) {
+ currentSubtitleIndex = subtitleIndex;
+ }
+
+ if (currentSubtitleIndex >= 0 && currentSubtitleIndex < subtitles.size()) {
+ // Display the subtitle text on the screen
+ String currentSubtitle = subtitles.get(currentSubtitleIndex).getText();
+
+ textAlign(CENTER);
+ fill(255);
+ text(currentSubtitle, 0, -300); // Adjust the position to be centered and close to the top
+
+
+ }
+ noFill();
+ pushMatrix();
+ translate(0, -200, 0);
+ float sphereSize = map(getAmplitude(), 0, 1, 0, 200);
+ noStroke();
+ fill(map(getAmplitude(), 0, 1, 0, 255), 255, 255);
+ sphere(sphereSize);
+ popMatrix();
+ noFill();
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/java/src/C21725659/RippleEcho.java b/java/src/C21725659/RippleEcho.java
new file mode 100644
index 000000000..45655f902
--- /dev/null
+++ b/java/src/C21725659/RippleEcho.java
@@ -0,0 +1,68 @@
+package C21725659;
+
+import ddf.minim.AudioInput;
+import ddf.minim.analysis.BeatDetect;
+import ie.tudublin.Visual;
+import processing.core.PApplet;
+import processing.core.PVector;
+
+public class RippleEcho extends Visual {
+
+ final int nb = 90;
+ final int step = 8;
+ final float DIST = 100;
+ float DISTORTION = 110;
+ part[][] parts = new part[nb][nb];
+ Boolean mode = true;
+ BeatDetect beat;
+ float beatValue = 1;
+
+ public void settings() {
+ size(800, 800, P3D);
+ println("CWD: " + System.getProperty("user.dir"));
+ }
+
+ public void setup() {
+
+ setFrameSize(256);
+
+ startMinim();
+ loadAudio("InitialD-KillingMyLove.mp3");
+ getAudioPlayer().play();
+ getAudioPlayer().cue(60000);
+
+ beat = new BeatDetect();
+
+ int dx = (width - nb * step) / 2;
+ for (int i = 0; i < nb; i++) {
+ for (int j = 0; j < nb; j++) {
+ parts[i][j] = new part(i * step + dx, j * step + dx, DIST);
+ }
+ }
+ }
+
+ public void draw() {
+ background(0);
+ PVector m = new PVector(mouseX, mouseY);
+
+ beat.detect(getAudioPlayer().mix);
+ if (beat.isOnset()) {
+ beatValue = 1;
+ } else {
+ beatValue *= 0.98;
+ }
+
+ for (int i = 0; i < nb; i++) {
+ for (int j = 0; j < nb; j++) {
+ if (beat.isOnset()) {
+ stroke(random(50, 150), random(50, 150), random(50, 150), 200);
+ }
+ parts[i][j].update(m, mode, DISTORTION, beatValue, width, this);
+ }
+ }
+ }
+
+ public void mousePressed() {
+ mode = !mode;
+ }
+}
diff --git a/java/src/C21725659/TestingSubtitles.java b/java/src/C21725659/TestingSubtitles.java
new file mode 100644
index 000000000..7a15b5a15
--- /dev/null
+++ b/java/src/C21725659/TestingSubtitles.java
@@ -0,0 +1,152 @@
+package C21725659;
+import java.util.ArrayList;
+
+import Global.*;
+
+import ie.tudublin.Visual;
+import ie.tudublin.VisualException;
+
+public class TestingSubtitles extends Visual {
+
+ int currentTime = 0;
+ boolean isPlaying = false;
+ SubtitleHandler subtitleHandler;
+ ArrayList subtitles;
+ int currentSubtitleIndex = 0;
+ int previousSubtitleIndex = -1;
+
+ public void settings()
+ {
+ size(800, 800, P3D);
+ println("CWD: " + System.getProperty("user.dir"));
+ }
+
+ public void keyPressed()
+ {
+ if (key == ' ')
+ {
+ currentTime = getAudioPlayer().position();
+ if(isPlaying){
+ getAudioPlayer().pause();
+ getAudioPlayer().cue(currentTime);
+ isPlaying = false;
+ }
+ else{
+ getAudioPlayer().play();
+ getAudioPlayer().cue(currentTime);
+ isPlaying = true;
+ }
+
+ }
+ if(key == 'r'){
+ getAudioPlayer().cue(0);
+ getAudioPlayer().play();
+ }
+ }
+
+ public void setup()
+ {
+ colorMode(HSB);
+ noCursor();
+
+ SubtitleHandler subtitleHandler = new SubtitleHandler(this);
+ subtitles = subtitleHandler.parseSrt("InitialD-KillingMyLove.mp3.srt");
+
+ setFrameSize(256);
+
+ startMinim();
+ loadAudio("InitialD-KillingMyLove.mp3");
+ getAudioPlayer().play();
+ // Set time to 1 minute
+ getAudioPlayer().cue(60000);
+ //startListening();
+
+ }
+
+ public void RotatingAudioCube(){
+ calculateAverageAmplitude();
+ try
+ {
+ calculateFFT();
+ }
+ catch(VisualException e)
+ {
+ e.printStackTrace();
+ }
+ calculateFrequencyBands();
+ background(0);
+ noFill();
+ stroke(255);
+ lights();
+ stroke(map(getSmoothedAmplitude(), 0, 1, 0, 255), 255, 255);
+ camera(0, -500, 500, 0, 0, 0, 0, 1, 0);
+ //translate(0, 0, -250);
+
+ rot += getAmplitude() / 8.0f;
+
+ rotateY(rot);
+ float[] bands = getSmoothedBands();
+ for(int i = 0 ; i < bands.length ; i ++)
+ {
+ float theta = map(i, 0, bands.length, 0, TWO_PI);
+
+ stroke(map(i, 0, bands.length, 0, 255), 255, 255);
+ float x = sin(theta) * radius;
+ float z = cos(theta) * radius;
+ float h = bands[i];
+ pushMatrix();
+ translate(x, - h / 2 , z);
+ rotateY(theta);
+ box(50, h, 50);
+ popMatrix();
+ }
+ }
+
+ float radius = 200;
+
+ float smoothedBoxSize = 0;
+
+ float rot = 0;
+ public void displayCurrentSubtitle() {
+ int playPosition = getAudioPlayer().position();
+ int totalTimeInSeconds = playPosition / 1000;
+ int subtitleIndex = -1;
+
+ for (int i = 0; i < subtitles.size(); i++) {
+ Subtitle subtitle = subtitles.get(i);
+ if (totalTimeInSeconds >= subtitle.getStart() / 1000.0f && totalTimeInSeconds <= subtitle.getEnd() / 1000.0f) {
+ subtitleIndex = i;
+ break;
+ }
+ }
+
+ if (subtitleIndex != currentSubtitleIndex) {
+ currentSubtitleIndex = subtitleIndex;
+ }
+
+ if (currentSubtitleIndex >= 0 && currentSubtitleIndex < subtitles.size()) {
+ // Display the subtitle text on the screen
+ String currentSubtitle = subtitles.get(currentSubtitleIndex).getText();
+ textAlign(CENTER, CENTER);
+ // White text
+ fill(255);
+ textSize(12);
+ text(currentSubtitle, width / 2, height - 100);
+ println("Current subtitle: " + currentSubtitle);
+ }
+ }
+
+
+
+
+ public void draw()
+ {
+ background(0);
+ // Print subtitles
+ displayCurrentSubtitle();
+
+
+ }
+ float angle = 0;
+
+}
\ No newline at end of file
diff --git a/java/src/C21725659/part.java b/java/src/C21725659/part.java
new file mode 100644
index 000000000..766c077cb
--- /dev/null
+++ b/java/src/C21725659/part.java
@@ -0,0 +1,52 @@
+package C21725659;
+
+import processing.core.PApplet;
+import processing.core.PVector;
+
+public class part {
+ PVector pos, speed, origin;
+ final float DIST;
+ float DISTORTION;
+
+ part(int x, int y, float dist) {
+ pos = new PVector(x, y);
+ origin = pos.get();
+ speed = new PVector(0, 0);
+ DIST = dist;
+ }
+
+ void update(PVector m, Boolean mode, float distortion, float beatValue, float width, PApplet p) {
+ PVector tmp = origin.get();
+ tmp.sub(m);
+ float d = tmp.mag();
+ float c = PApplet.map(d, 0, DIST, 0, PApplet.PI);
+ tmp.normalize();
+
+ PVector beatMovement = tmp.copy();
+ if (mode) {
+ beatMovement.mult(distortion * PApplet.sin(c) * beatValue);
+ }
+
+ PVector mouseMovement = tmp.copy();
+ if (d < DIST) {
+ p.strokeWeight(1 + 10 * PApplet.abs(PApplet.cos(c / 2)));
+ if (!mode) {
+ mouseMovement.mult(distortion * PApplet.sin(c) * beatValue);
+ }
+ } else {
+ p.strokeWeight(PApplet.map(PApplet.min(d, width), 0f, width, 6f, (float) .3));
+ }
+
+ // Calculate the weighted average of beat and mouse movement
+ PVector weightedMovement = PVector.add(beatMovement.mult(0.7f), mouseMovement.mult(0.3f));
+
+ PVector target = PVector.add(origin, weightedMovement);
+ tmp = pos.get();
+ tmp.sub(target);
+ tmp.mult(-PApplet.map(m.dist(pos), 0f, 2f * width, .1f, .01f));
+ speed.add(tmp);
+ speed.mult(.57f);
+ pos.add(speed);
+ p.point(pos.x, pos.y);
+ }
+}
diff --git a/java/src/C21725659/particle.java b/java/src/C21725659/particle.java
new file mode 100644
index 000000000..f877c6900
--- /dev/null
+++ b/java/src/C21725659/particle.java
@@ -0,0 +1,39 @@
+package C21725659;
+
+import processing.core.PApplet;
+import processing.core.PVector;
+
+class Particle {
+ PApplet p;
+ PVector position;
+ PVector velocity;
+ float size;
+ int color;
+ float lifespan;
+
+ Particle( PApplet p,PVector position, PVector velocity, float size, int color, float lifespan) {
+ this.p = p;
+ this.position = position;
+ this.velocity = velocity;
+ this.size = size;
+ this.color = color;
+ this.lifespan = lifespan;
+ }
+
+ void update() {
+ position.add(velocity);
+ lifespan--;
+ }
+
+ void display() {
+ p.pushMatrix();
+ p.translate(position.x, position.y, position.z);
+ p.fill(color, lifespan);
+ p.sphere(size);
+ p.popMatrix();
+ }
+
+ boolean isDead() {
+ return lifespan <= 0;
+ }
+}
\ No newline at end of file
diff --git a/java/src/C21725659/textSprites.java b/java/src/C21725659/textSprites.java
new file mode 100644
index 000000000..00a6ea087
--- /dev/null
+++ b/java/src/C21725659/textSprites.java
@@ -0,0 +1,33 @@
+package C21725659;
+
+import processing.core.PApplet;
+import processing.core.PVector;
+
+public class textSprites {
+ private PVector position;
+ private PVector velocity;
+ private String text;
+ private int textSize;
+ private int color;
+
+ public textSprites(PVector position, PVector velocity, String text, int textSize, int color) {
+ this.position = position;
+ this.velocity = velocity;
+ this.text = text;
+ this.textSize = textSize;
+ this.color = color;
+ }
+
+ public void update() {
+ position.add(velocity);
+ }
+
+ public void display(PApplet p) {
+ p.pushStyle();
+ p.textAlign(PApplet.CENTER, PApplet.CENTER);
+ p.textSize(textSize);
+ p.fill(color);
+ p.text(text, position.x, position.y);
+ p.popStyle();
+ }
+}
diff --git a/java/src/Global/Subtitle.java b/java/src/Global/Subtitle.java
new file mode 100644
index 000000000..345bceb5f
--- /dev/null
+++ b/java/src/Global/Subtitle.java
@@ -0,0 +1,60 @@
+package Global;
+
+public class Subtitle {
+ private int index;
+ private int start;
+ private int end;
+ private String text;
+
+ Subtitle(int index, int start, int end, String text) {
+ this.index = index;
+ this.start = start;
+ this.end = end;
+ this.text = text;
+ }
+
+ public int getIndex() {
+ return index;
+ }
+
+ public void setIndex(int index) {
+ this.index = index;
+ }
+
+ public int getStart() {
+ return start;
+ }
+
+ public void setStart(int start) {
+ this.start = start;
+ }
+
+ public int getEnd() {
+ return end;
+ }
+
+ public void setEnd(int end) {
+ this.end = end;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ String timestampToString() {
+ int startHours = start / 3600000;
+ int startMinutes = (start / 60000) % 60;
+ int startSeconds = (start / 1000) % 60;
+ int startMilliseconds = start % 1000;
+ int endHours = end / 3600000;
+ int endMinutes = (end / 60000) % 60;
+ int endSeconds = (end / 1000) % 60;
+ int endMilliseconds = end % 1000;
+ return String.format("%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d", startHours, startMinutes, startSeconds,
+ startMilliseconds, endHours, endMinutes, endSeconds, endMilliseconds);
+ }
+}
diff --git a/java/src/Global/SubtitleHandler.java b/java/src/Global/SubtitleHandler.java
new file mode 100644
index 000000000..7420ad6b3
--- /dev/null
+++ b/java/src/Global/SubtitleHandler.java
@@ -0,0 +1,63 @@
+package Global;
+import processing.core.PApplet;
+import java.util.ArrayList;
+
+
+// SubtitleHandler.pde
+
+
+public class SubtitleHandler {
+
+
+ private PApplet p;
+ private String filename;
+
+ public SubtitleHandler(PApplet p) {
+ this.p = p;
+ this.filename = filename;
+ }
+
+
+ public ArrayList parseSrt(String filename) {
+ ArrayList subtitles = new ArrayList();
+
+ String[] lines = p.loadStrings(filename);
+ int index = 1;
+ for (int i = 0; i < lines.length; i++) {
+ String line = lines[i].trim();
+ if (line.matches("\\d+")) {
+ index = Integer.parseInt(line);
+ } else if (line.matches("\\d\\d:\\d\\d:\\d\\d,\\d\\d\\d --> \\d\\d:\\d\\d:\\d\\d,\\d\\d\\d")) {
+ String[] times = line.split(" --> ");
+ int start = parseTimecode(times[0]);
+ int end = parseTimecode(times[1]);
+ String text = "";
+ i++;
+ while (i < lines.length && !lines[i].trim().isEmpty()) {
+ text += lines[i] + "\n";
+ i++;
+ }
+ if (text.isEmpty()) {
+ i--;
+ }
+ subtitles.add(new Subtitle(index, start, end, text.trim()));
+ }
+ }
+
+ return subtitles;
+ }
+
+ int parseTimecode(String timecode) {
+ String[] parts = timecode.split(":|,");
+ int hours = Integer.parseInt(parts[0]);
+ int minutes = Integer.parseInt(parts[1]);
+ int seconds = Integer.parseInt(parts[2]);
+ int milliseconds = Integer.parseInt(parts[3]);
+ return hours * 3600000 + minutes * 60000 + seconds * 1000 + milliseconds;
+ }
+
+ String displaySubtitle(ArrayList subtitles, int index) {
+ Subtitle subtitle = subtitles.get(index);
+ return subtitle.getIndex() + "\n" + subtitle.timestampToString() + "\n" + subtitle.getText();
+ }
+}
diff --git a/java/src/c123456/BryansVisual.java b/java/src/c123456/BryansVisual.java
deleted file mode 100644
index e69de29bb..000000000
diff --git a/java/src/example/CubeVisual.java b/java/src/example/CubeVisual.java
index ff8e58798..f23bbe2bf 100644
--- a/java/src/example/CubeVisual.java
+++ b/java/src/example/CubeVisual.java
@@ -1,90 +1,90 @@
-package example;
-
-import ie.tudublin.Visual;
-
-public class CubeVisual extends Visual
-{
- boolean twocubes = false;
-
- public void settings()
- {
- size(800, 800, P3D);
- println("CWD: " + System.getProperty("user.dir"));
- //fullScreen(P3D, SPAN);
- }
-
- public void keyPressed()
- {
- if (key == ' ')
- {
- getAudioPlayer().cue(0);
- getAudioPlayer().play();
-
- }
- if (key == '1')
- {
- twocubes = ! twocubes;
-
- }
- }
-
- public void setup()
- {
- colorMode(HSB);
- noCursor();
-
- setFrameSize(256);
-
- startMinim();
- loadAudio("heroplanet.mp3");
- //getAp().play();
- //startListening();
-
- }
-
- float smoothedBoxSize = 0;
-
- public void draw()
- {
- calculateAverageAmplitude();
- background(0);
- noFill();
- lights();
- stroke(map(getSmoothedAmplitude(), 0, 1, 0, 255), 255, 255);
- camera(0, 0, 0, 0, 0, -1, 0, 1, 0);
- translate(0, 0, -250);
-
- float boxSize = 50 + (getAmplitude() * 300);//map(average, 0, 1, 100, 400);
- smoothedBoxSize = lerp(smoothedBoxSize, boxSize, 0.2f);
- if (twocubes)
- {
- pushMatrix();
- translate(-100, 0, 0);
- rotateY(angle);
- rotateX(angle);
- box(smoothedBoxSize);
- //strokeWeight(1);
- //sphere(smoothedBoxSize);
- popMatrix();
- pushMatrix();
- translate(100, 0, 0);
- rotateY(angle);
- rotateX(angle);
- strokeWeight(5);
- box(smoothedBoxSize);
- popMatrix();
- }
- else
- {
- rotateY(angle);
- rotateX(angle);
- //strokeWeight(1);
- //sphere(smoothedBoxSize/ 2);
- strokeWeight(5);
-
- box(smoothedBoxSize);
- }
- angle += 0.01f;
- }
- float angle = 0;
+package example;
+
+import ie.tudublin.Visual;
+
+public class CubeVisual extends Visual
+{
+ boolean twocubes = false;
+
+ public void settings()
+ {
+ size(800, 800, P3D);
+ println("CWD: " + System.getProperty("user.dir"));
+ //fullScreen(P3D, SPAN);
+ }
+
+ public void keyPressed()
+ {
+ if (key == ' ')
+ {
+ getAudioPlayer().cue(0);
+ getAudioPlayer().play();
+
+ }
+ if (key == '1')
+ {
+ twocubes = ! twocubes;
+
+ }
+ }
+
+ public void setup()
+ {
+ colorMode(HSB);
+ noCursor();
+
+ setFrameSize(256);
+
+ startMinim();
+ loadAudio("heroplanet.mp3");
+ //getAp().play();
+ //startListening();
+
+ }
+
+ float smoothedBoxSize = 0;
+
+ public void draw()
+ {
+ calculateAverageAmplitude();
+ background(0);
+ noFill();
+ lights();
+ stroke(map(getSmoothedAmplitude(), 0, 1, 0, 255), 255, 255);
+ camera(0, 0, 0, 0, 0, -1, 0, 1, 0);
+ translate(0, 0, -250);
+
+ float boxSize = 50 + (getAmplitude() * 300);//map(average, 0, 1, 100, 400);
+ smoothedBoxSize = lerp(smoothedBoxSize, boxSize, 0.2f);
+ if (twocubes)
+ {
+ pushMatrix();
+ translate(-100, 0, 0);
+ rotateY(angle);
+ rotateX(angle);
+ box(smoothedBoxSize);
+ //strokeWeight(1);
+ //sphere(smoothedBoxSize);
+ popMatrix();
+ pushMatrix();
+ translate(100, 0, 0);
+ rotateY(angle);
+ rotateX(angle);
+ strokeWeight(5);
+ box(smoothedBoxSize);
+ popMatrix();
+ }
+ else
+ {
+ rotateY(angle);
+ rotateX(angle);
+ //strokeWeight(1);
+ //sphere(smoothedBoxSize/ 2);
+ strokeWeight(5);
+
+ box(smoothedBoxSize);
+ }
+ angle += 0.01f;
+ }
+ float angle = 0;
}
\ No newline at end of file
diff --git a/java/src/example/CubeVisual1.java b/java/src/example/CubeVisual1.java
deleted file mode 100644
index 8eebd97f8..000000000
--- a/java/src/example/CubeVisual1.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package example;
-
-import ie.tudublin.Visual;
-
-public class CubeVisual1 extends Visual
-{
- public void settings()
- {
- size(800, 600, P3D);
- //fullScreen(P3D, SPAN);
- }
-
- public void setup()
- {
- startMinim();
- //startListening();
- loadAudio("heroplanet.mp3");
- colorMode(HSB);
- }
-
- public void keyPressed()
- {
- if (key == ' ')
- {
- getAudioPlayer().cue(0);
- getAudioPlayer().play();
- }
- }
-
- float angle = 0;
-
- public void draw()
- {
- background(0);
- calculateAverageAmplitude();
- stroke(map(getSmoothedAmplitude(), 0, 1, 0, 255), 255, 255);
- strokeWeight(5);
- noFill();
- lights();
- pushMatrix();
- //
- camera(0, 0, 0, 0, 0, -1, 0, 1, 0);
- translate(0, 0, -200);
- rotateX(angle);
- rotateZ(angle);
- float boxSize = 50 + (200 * getSmoothedAmplitude());
- box(boxSize);
- popMatrix();
- angle += 0.01f;
- }
-
-
-}
\ No newline at end of file
diff --git a/java/src/ie/tudublin/Main.java b/java/src/ie/tudublin/Main.java
index 27489f824..b492c0ca8 100644
--- a/java/src/ie/tudublin/Main.java
+++ b/java/src/ie/tudublin/Main.java
@@ -1,21 +1,23 @@
package ie.tudublin;
+import C21725659.Check;
+import C21725659.DemiAudioVisualiser;
+import C21725659.RippleEcho;
+import C21725659.TestingSubtitles;
import example.CubeVisual;
import example.MyVisual;
import example.RotatingAudioBands;
-public class Main
-{
+public class Main {
- public void startUI()
- {
- String[] a = {"MAIN"};
- processing.core.PApplet.runSketch( a, new MyVisual());
+ public void startUI() {
+ String[] a = { "MAIN" };
+ processing.core.PApplet.runSketch(a, new RippleEcho());
}
- public static void main(String[] args)
- {
+ public static void main(String[] args) {
Main main = new Main();
- main.startUI();
+ main.startUI();
}
-}
\ No newline at end of file
+}
+
diff --git a/java/src/ie/tudublin/MusicVisualizer b/java/src/ie/tudublin/MusicVisualizer
new file mode 100644
index 000000000..bef04cf68
--- /dev/null
+++ b/java/src/ie/tudublin/MusicVisualizer
@@ -0,0 +1,21 @@
+// package ie.tudublin;
+
+// // Dependencies
+// import ddf.minim.AudioInput;
+// import ddf.minim.AudioBuffer;
+// import ddf.minim.Minim;
+// import ddf.minim.AudioPlayer;
+// import processing.core.PApplet;
+// import java.util.ArrayList;
+
+// //visuals
+
+// import C21468162.JaredVisual.JaredVisual;
+// //import C21725659.DemiAina.;
+
+// public class MusicVisualizer extends PApplet {
+// //Begin rendering visuals
+// JaredVisual jaredVisual;
+// //DemiAina demiAina;
+// // etc etc
+// }
\ No newline at end of file