Week #9 Assignment: The Dancing Nightsky by Abdelrahman Mallasi

Concept

This project creates an interactive audio-visual experience that represents a Dancing Night Sky. This concept was done by simulating a night sky where each star (dot) moves in response to music, creating a visual dance which mirrors the song’s rhythm and melody. The chosen song for this project was “This Is What Space Feels Like” by JVKE, which aptly talks about space, aligning with the theme of a dancing night sky.

To achieve this, the visual properties of the dots – representing stars – were programmed to change in response to the music. The movement, force, and size of each dot varied according to the intensity and frequency of the music, due to the implementation of Fast Fourier Transform (FFT) analysis. This project showcases the properties of flocking behavior through the use of separation and alignment algorithms.

Highlight of Code

let spectrum = fft.analyze();
let bass = fft.getEnergy("bass");
let treble = fft.getEnergy("treble");

// Mapping the music to visual properties
for (let boid of flock.boids) {
    boid.maxspeed = map(treble, 0, 255, 2, 8);
    boid.maxforce = map(bass, 0, 255, 0.05, 5);
    boid.r = map(bass, 0, 255, 3, 6);
}
  • The analyze() method computes the frequency spectrum of the song, resulting in an array where each value represents the amplitude of a specific frequency band
  • The getEnergy() method returns the amplitude of  the bass and treble frequencies of the song
  • Then, the amplitude values for bass and treble frequencies are mapped to certain properties of the boids, where the treble affects the speed and the bass affects the force and the size.

Embedded sketch

Link to Sketch

Reflections & Future Ideas

  • I intentionally wanted to pick a song with musical pauses to effectively demonstrate how the music affects the stars. However, I believe there could be another song that could better demonstrate the effect.
  • I had to compress the song to make the sketch load faster. However, the compression lowers the quality of the sound, and leads to less pronounced effects on the boids. The original uncompressed song file is still uploaded in the sketch. If you’re patient and would like to see the sketch at its finest, simply replace “Compressed Song.mp3” to “Original Song.mp3” for the loadSound() function.
  • In future iterations of the project, the aim is to enhance the visual representation of the stars to make them appear more star-like rather than simple dots. Additionally, an exciting feature to be explored is the creation of trails behind each star, simulating shooting stars and adding a more visually appealing effect.

Leave a Reply

Your email address will not be published. Required fields are marked *