An interactive music visualizer in which the positions of a set of points in 3D space are evolved using the differential equations of a chaotic attractor, with the instantaneous audio amplitude determining the integration time step.
aizawa.mp4
- Real-time audio responsiveness
- Adaptive color changes based on the audio's amplitude
- Interactive XY plane rotation and zooming controls
- Thomas Attractor
- Halvorsen Attractor
- Sprott Attractor
- Aizawa Attractor
- Lorenz Attractor
-
Clone the repository
git clone https://github.com/natharyan/chaotic-attractors
brew install sfml-
Get the location of the Graphics.hpp and Audio.hpp
brew info sfml
Output: /opt/homebrew/Cellar/sfml/2.6.1
-
Check if Graphics.hpp and Audio.hpp are correctly installed
ls /opt/homebrew/Cellar/sfml/2.6.1/include/SFML
-
If you have a different installation path for SFML then replace the following in the MakeFile
SFML_PATH = /opt/homebrew/Cellar/sfml/2.6.1
- Follow this video: https://www.youtube.com/watch?v=Ptw1KKI9_Sg
-
Navigate to the repository on your terminal
cd /path/to/chaotic-attractors
Build the project using the simple Makefile:
make # builds (uses SFML_PATH default or override)If your SFML installation is in a custom location, set SFML_PATH:
SFML_PATH=/path/to/sfml makeRun the built executable:
./bin/app- Click and drag your mouse to change the rotation of the visualizer along the x and y axis
- Press
Tto toggle the tails in the visualizer - Use your arrow keys to change x and y offset of the screen
- Use your mouse scroll to change the scale of the visualizer screen
- Press
spaceto pause the visualizer - Use
Rto reset the visualizer configuration without restarting it - Use
Mto toggle the stats menu - Press
Qto quit
- Open the
cppfile of an attractor insrc/includes/attractors - Reduce the maxAmplitude for increasing color response
- Modify the speedfactor formula for changing the particle speed response
float ThomasAttractor::speedfactor(float dt, float amplitude) const { return dt + 0.0001f * amplitude; }
- Modify the
startColorandendColorvariables in thecppfile of an attractor insrc/includes/attractorsstartColor = sf::Color(70, 130, 180); endColor = sf::Color(239, 204, 144);
- Copy paste the header and
cppfiles of one of the already implemented attractor into new files - In the header file, modify the attractor class name
AizawAttractor - In the header file, replace the constructor with the new class name
RosslerAttractor(float dt) - In the header file, replace the private variables with the parameters of the new attractor
- In the
cppfile, change the class and constructor nameRosslerAttractor::RosslerAttractor(float dt) : Attractor() - In the
cppfile, experiment around with different values of variables - Add a new mp3 file to
./audio/and change replace thedefaultaudiovalue in thecppfile with the relative path of the new file with respect to yourpwddefaultaudio = "audio/Gymnopedie.mp3" - In the
cppfile, change thestepfunction to use your new attractor system - In the
cppfile, experiment with thespeedfactorformula
Also check out this fun video on chaotic attractors: https://www.youtube.com/watch?v=uzJXeluCKMs&t=251s