Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing branch merge #31

Open
wants to merge 57 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
f7d9900
Added our names to the readme.md file
AlexMackey1 Mar 13, 2024
103184f
fixed names
c22483302 Mar 13, 2024
bba7a3a
description in read me
AaronConnolly Mar 13, 2024
33fbd14
Created my file for my visuals
AlexMackey1 Mar 14, 2024
5509287
Created a package and moved my file into it
AlexMackey1 Mar 14, 2024
2b49e36
Added Aaron Visual and called it in main
AaronConnolly Mar 14, 2024
3e73104
Merge branch 'master' of https://github.com/AlexMackey1/MusicVisuals
AaronConnolly Mar 14, 2024
0851342
Added started code to my visual
AlexMackey1 Mar 14, 2024
7eb5781
testing
AaronConnolly Mar 14, 2024
6e78a88
Added song choice to readme.md
AlexMackey1 Mar 14, 2024
e68618d
merge practice
AaronConnolly Mar 14, 2024
c826c53
Got Audio to work
AaronConnolly Mar 20, 2024
ac52cd3
Audio now working
AaronConnolly Mar 20, 2024
13ecd9c
made changes here and there, sure you know yourself like
AlexMackey1 Mar 20, 2024
8aaed71
Merge branch 'master' of https://github.com/AlexMackey1/MusicVisuals
AlexMackey1 Mar 20, 2024
377fdf0
new song plays
AlexMackey1 Mar 20, 2024
70f1b80
bla
AaronConnolly Mar 20, 2024
81fe0e6
bla
AaronConnolly Mar 20, 2024
0089758
Made a file for our masterpiece
AlexMackey1 Mar 20, 2024
e4eea4e
added sergei folder
c22483302 Mar 20, 2024
715c016
Merge branch 'master' of https://github.com/AlexMackey1/MusicVisuals
c22483302 Mar 20, 2024
1012f0f
added sergei to test
AlexMackey1 Mar 20, 2024
a55ad2c
renamed file
AlexMackey1 Mar 20, 2024
93a6ffc
Added KeyPressed to allow changing between scenes, added starter code…
AlexMackey1 Mar 20, 2024
13bbc03
Added my visuals, updated ReadMe
c22483302 Mar 20, 2024
abc7e08
Begin to add my visuals
c22483302 Mar 20, 2024
b93916d
Fixed sound
AaronConnolly Apr 10, 2024
d9541b1
Update BohemianRhapsody.java
AlexMackey1 Apr 10, 2024
1abd637
bla
AaronConnolly Apr 10, 2024
31d3fad
bla
AaronConnolly Apr 10, 2024
33e8fc2
bla
AlexMackey1 Apr 10, 2024
b7379f6
Merge branch 'master' of https://github.com/AlexMackey1/MusicVisuals
AlexMackey1 Apr 10, 2024
ae3d043
Testing adding images to the visual
AlexMackey1 Apr 10, 2024
136a4af
End of Wed 10/04/24
AlexMackey1 Apr 10, 2024
09b14af
Lots of progress on my visual
AaronConnolly Apr 16, 2024
ee9e8c4
fixed small thing
AaronConnolly Apr 16, 2024
3aa225e
Merge branch 'ALexBranch'
AlexMackey1 Apr 16, 2024
f8c7b3a
Added bands
AlexMackey1 Apr 16, 2024
461627e
changed times ideas secgtion
c22483302 Apr 17, 2024
d0bdade
Added Frequency bands and colors
AlexMackey1 Apr 17, 2024
5810df0
added some more cool stuff, diamond shape, expanded size
AlexMackey1 Apr 17, 2024
0b1e3f7
messed with screen size
AlexMackey1 Apr 17, 2024
f2e75d8
Added moving circles to the background, its not what i want but its a…
AlexMackey1 Apr 17, 2024
fc98a83
toned down the circles, ALOT
AlexMackey1 Apr 17, 2024
387d160
toned down circles again and toned down boxes
AlexMackey1 Apr 17, 2024
bed67ac
bla
AaronConnolly Apr 18, 2024
30ba7a9
Merge branch 'master' of https://github.com/AlexMackey1/MusicVisuals
AaronConnolly Apr 18, 2024
587bfa0
After many many iterations, im happy with the updated visuals
AlexMackey1 Apr 22, 2024
247031f
toned down the circles and made the background colour reactive
AlexMackey1 Apr 23, 2024
9a2784e
visuals added
c22483302 Apr 23, 2024
6c049c3
Merge branch 'master' of https://github.com/AlexMackey1/MusicVisuals
c22483302 Apr 23, 2024
496fac9
Lines
AaronConnolly Apr 23, 2024
a45ab23
Merge branch 'AlexBranch'
AlexMackey1 Apr 23, 2024
be809ce
Merge branch 'master' of https://github.com/AlexMackey1/MusicVisuals
AlexMackey1 Apr 23, 2024
0e4410d
bla
AaronConnolly Apr 23, 2024
adcaa7c
bla
AaronConnolly Apr 23, 2024
64a7f59
start page
AaronConnolly Apr 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Music Visualiser Project

Name:

Student Number:
Student Number and Student Name: Alex Mackey - C22739165
Aaron Connolly - C22410766
Sergei Larionov - C22483302

## Instructions
- Fork this repository and use it a starter project for your assignment
Expand All @@ -11,10 +11,19 @@ Student Number:
- 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

# IDEAS
0:00 - 0:16
0:16 - 1:57
1:57 - 3:04
3:04 - 4:09
4:09 - 5:59


# Description of the assignment
visuals of Bohemian Rhapsody

# Instructions

merge practice
# How it works

# What I am most proud of in the assignment
Expand Down
Binary file modified java/.DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions java/.project
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
</natures>
<filteredResources>
<filter>
<id>1616413840733</id>
<id>1710348951264</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
Expand Down
Binary file added java/data/.DS_Store
Binary file not shown.
Binary file added java/data/QueenBohemianRhapsody.mp3
Binary file not shown.
Binary file added java/data/Section3.mp3
Binary file not shown.
Binary file added java/data/test.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
156 changes: 156 additions & 0 deletions java/src/C22410766/AaronVisual.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
package C22410766;

import java.util.ArrayList;

import ie.tudublin.Visual;
import ie.tudublin.VisualException;
import processing.core.PApplet;


public class AaronVisual {
Visual visual;
ArrayList<Particle> particles = new ArrayList<>();
ArrayList<ArrayList<Lines>> lineSets = new ArrayList<>();


int len, linesPerBand = 20;
float amplitude, centerX, centerY;
float[] bands;
int radius = 200;

public AaronVisual(Visual visual) {
this.visual = visual;
visual.startMinim();

this.centerX = visual.width / 2;
this.centerY = visual.height / 2;



visual.calculateFrequencyBands(); // Calculate frequency bands
visual.calculateAverageAmplitude(); // Calculate amplitude
this.bands = visual.getSmoothedBands(); // max 667
this.len = bands.length;
this.amplitude = visual.getSmoothedAmplitude(); // max value is 0.233

float[] bandLengthsstart = {radius, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600}; // Example specific lengths for each band
float[] bandLengthsend = {100, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600}; // Example specific lengths for each band
int[] bandColors = {visual.color(255, 255, 125), // Red
visual.color(20, 165, 120), // Orange
visual.color(40, 255, 125), // Yellow
visual.color(100, 255, 125), // Green
visual.color(150, 55, 125), // Blue
visual.color(195, 255, 120), // Indigo
visual.color(218, 230, 128),// Violet
visual.color(225, 230, 125), // Magenta
visual.color(255, 192, 123) // Pink
};

for (int i = 0; i < len; i++) {
ArrayList<Lines> lines = new ArrayList<>();
for (int j = 0; j < linesPerBand; j++) {
float angle = visual.TWO_PI / linesPerBand * j + visual.TWO_PI / len * i;
float strokeWeight = visual.random(1, 3);
lines.add(new Lines(visual, 0, 0, bandLengthsstart[0], angle, bandLengthsend[i], bandColors[i], strokeWeight));
}
lineSets.add(lines);
}

}

float b = 0; // Angle of rotation
float offset = (float) (visual.PI/24.0); // Angle offset between boxes
int num = 60;



public void draw() {
visual.background(0);

//float bgHue = visual.map(amplitude, 0, 0.3f, 0, 360); // Use full color wheel
//visual.background(bgHue, 100, 100, 1); // Set background with HSB color mode


try {
visual.calculateFFT(); // Perform FFT analysis
} catch (VisualException e) {
e.printStackTrace();
}

visual.calculateFrequencyBands(); // Calculate frequency bands
visual.calculateAverageAmplitude(); // Calculate amplitude
bands = visual.getSmoothedBands(); // max 667

amplitude = visual.getSmoothedAmplitude(); // max value is 0.233
float radius = visual.map(amplitude, 0, 0.3f, 200, 400);


float hue = visual.map(amplitude, 0.15f, 0.3f, 100, 255);
//visual.strokeWeight(10);

visual.noFill();

visual.lights();
visual.translate(centerX, centerY); // Center translate to middle of window
float rotateVelocity = visual.map(amplitude, 0.1f, 0.24f, 0.4f, 1.1f) * offset;


for (int i = 0; i < num; i++) {
float gray = visual.map(i, 0, num - 1, 0, 255);
visual.pushMatrix();
//visual.fill(gray);
visual.stroke(hue, 255, 255);
visual.rotateY(b + rotateVelocity * i); // Rotate around Y axis
visual.rotateX(b / 2 + rotateVelocity * i); // Rotate around X axis
visual.ellipse(0, 0, radius, radius);
visual.popMatrix();
}

b += 0.01; // Increment angle
if (b > visual.TWO_PI) { // Reset 'b' to avoid overflow
b = 0;
}
// Draw each circle


for (int i = particles.size() - 1; i >= 0; i--) {
Particle p = particles.get(i);
p.run(); // Update and display the particle

if (p.isDead()) {
particles.remove(i); // Remove dead particles
}
}

// Add new particles based on some condition (e.g., on beats)
int numParticlesToSpawn = (int) (amplitude * 350); // Scale number of particles with amplitude
for (int i = 0; i < numParticlesToSpawn; i++) {
float angle = visual.random(visual.TWO_PI);
float velocityFactor = visual.map(amplitude, 0.1f, 0.24f, 1, 7); // Map the band amplitude to a useful velocity range
particles.add(new Particle(visual, 0, 0, radius/2, angle, velocityFactor));
}


int maxBandIndex = 0;
float maxBandValue = 0;
for (int i = 0; i < len; i++) {
if (bands[i] > maxBandValue) {
maxBandValue = bands[i];
maxBandIndex = i;
}
}


// Draw only the lines of the band with the highest current value
for (int i = 0; i < len; i++) {
for (Lines line : lineSets.get(i)) {
if (i == maxBandIndex) {
line.display();
}
}
}


}

}
31 changes: 31 additions & 0 deletions java/src/C22410766/Lines.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package C22410766;

import ie.tudublin.Visual;

public class Lines {
float x, y, endX, endY;
Visual parent;
float angle, length;
int strokeColor;
float strokeWeight;

public Lines(Visual parent, float centerX, float centerY, float radius, float angle, float length, int strokeColor, float strokeWeight) {
this.parent = parent;
this.angle = angle;
this.length = length;
this.strokeColor = strokeColor;
this.strokeWeight = strokeWeight;

this.x = centerX + radius * parent.cos(angle);
this.y = centerY + radius * parent.sin(angle);
this.endX = x + length * parent.cos(angle);
this.endY = y + length * parent.sin(angle);
}

public void display() {
parent.stroke(strokeColor);
parent.strokeWeight(strokeWeight);
parent.line(x, y, endX, endY);
}
}

45 changes: 45 additions & 0 deletions java/src/C22410766/Particle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package C22410766;

import processing.core.PApplet;
import ie.tudublin.Visual;


public class Particle {
float x, y, vx, vy, life; // Properties for particle position, velocity, and life
Visual parent; // Reference to the Visual class which should be a subclass of PApplet

// Constructor with correctly named parameters
public Particle(Visual parent, float centerX, float centerY, float radius, float angle, float velocityFactor) {
this.parent = parent;

// Calculate initial position on the circle edge
this.x = centerX + radius * PApplet.cos(angle);
this.y = centerY + radius * PApplet.sin(angle);

// Initial velocities, possibly away from the center or tangential
this.vx = PApplet.cos(angle) * velocityFactor; // This could be adjusted
this.vy = PApplet.sin(angle) * velocityFactor; // This could be adjusted
this.life = 255; // Starting life value
}

public void run() {
update();
display();
}

private void update() {
x += vx;
y += vy;
life -= 2; // Decrease life
}

private void display() {
parent.stroke(255, life);
parent.strokeWeight(2);
parent.point(x, y);
}

public boolean isDead() {
return life <= 0;
}
}
32 changes: 32 additions & 0 deletions java/src/C22410766/start.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package C22410766;

import ie.tudublin.Visual;

public class start {
Visual visual;

public start(Visual visual) {
this.visual = visual;


}
public void draw(){
visual.background(0);

float centerX = visual.width / 2;
float centerY = visual.height / 2;
float angle = 0;5

angle += 0.01;

// Set the rotation angle
visual.rotate(angle);

visual.textSize(50);
visual.text("OOP Visual assignment", centerX-200, centerY);
visual.textSize(30);
visual.text("by Aaron, Alex, Sergei", centerX-200, centerY+50);


}
}
Loading