Fantasía
Alejandro Campos · 2024
This project is generated from live code and contains animation with unique and infinite music. Activate the live view and press the space bar to begin playing. “What you will see on the screen is a picture of the various abstract images that might pass through your mind if you sat in a concert hall listening to this music. At first, you are conscious of the piano. Then the music begins to suggest other kinds of things to your imagination. They might be… oh, just masses of color. Or they may be cloud forms… or great landscapes, or vague shadows… or geometrical objects floating in space.” — Fantasia (Walt Disney Productions, 1940) A fantasia is a musical composition with a free form and often improvisatory style, seldom following the rules of any strict musical form. *Fantasía* (Alejandro Campos, 2024) is a generative experience born from a machine-generated musical score that informs the visual arrangement of constructed shapes, algorithmic textures, and emergent compositions. This series continues Campos’s ongoing attachment to playfulness, unencumbered acts of creativity, and the pursuit of capturing the joy of imagination. In a unique blend of generative processes, *Fantasía* uses a machine learning model connected to an algorithmic process, producing both classical compositions and playful visuals – everything happening in-browser and in real-time. The music’s AI model is trained on a large dataset of classical performances, creating a piano sheet that – as long as *Fantasía* remains open – continues an infinite improvisation that’s unique to each of the works. Each piece’s score is also used by the generative algorithm to produce a visual counterpart, like a map that traces the movements of notes on canvas: the colors capturing the different moods of each type of score, and the geometries expressing the musical structures of each composition. Seeing these artworks can evoke the experience of listening to the music once again, and with each deeper exploration of the algorithm’s range, comes familiarity with this new fantastical language. The eye moving between shapes, the drawings conveying their musical narrative – *Fantasía* hides nothing, as if speaking in universal gestures. This series uses brush.js (a library developed and open-sourced by Campos, now working without p5), TensorFlow.js (an open-source ML platform for JavaScript), Magenta.js for generating music with Magenta models, Tone.js (a Web Audio framework for creating interactive music in the browser), and several other open-source MIT license libraries. The music plays with Tone Piano, a multisampled piano implementation using Salamander Grand Piano Sounds. Created in collaboration with Adam Berninger of TENDER.
How it works
main.js builds oscillators/synths and renders 2D canvas visuals from AnalyserNode FFT data (getByteFrequencyData, frequencyBinCount) via arc/fillStyle, so the generated sound drives the imagery.
The core is audio-reactive, where generated sound drives the visuals. main.js synthesises sound with oscillators and synths (createOscillator and the like), extracts the frequency data of an AnalyserNode (getByteFrequencyData, frequencyBinCount), and pours those values into a 2D canvas's arc / fillStyle. That is, the frequency spectrum of the sounding audio is converted directly into the shapes' size, colour and distribution. The drawing is a particle-like composition placing many arcs and paths, with the forms pulsing according to the sound's swell. Because it sets sound as the input to the visualisation, changes in melody and rhythm are bound one-to-one with the screen's motion. The sound sequence and timbre settings change per token, so the audiovisual expression ranges from a quiet flicker to a violent scattering.
Palette
#002185#16474a#c26646#d7d7d7#080f15#70abb4#335465#d7464c#b7b36a#cec7b5#355c8b#d2a68f#dfba35#e8edea#f7f6f2#a33a29#366c8e#f4bd48#2c695a#49443b#a86a5d#f7cc9d#d2cfcf#0e2d58#5a8a93#87b26c#a4aa35#de8da0#7facc6#4a535b#fffceb#fcd300 +107 more #e0e3d9#d4d2cb#858079#b5afa7#e97358#5d5a57#f9c3b2#be5c45 Algorithms
- Audio-Reactive primary · classification: LLM
- Particle System · classification: LLM
Details
Sources
- IPFS
ipfs://QmQEAt4vZTmpTXi2CeoNjxJMv5aw8FqzTo1ZtV2TKzKnq6/?payload=eyJoYXNoIjoiMHhhODNmYjBiMzVjYmI2MWI1ZGVlMTgzMjg2NzY1YmNhYTFhNDMyMzQ1YTRlOGMzMTNiZWU4NTM1ZWI4NjdjZjU3IiwiZWRpdGlvbk51bWJlciI6MSwidG90YWxFZGl0aW9ucyI6NDY3LCJpbnB1dCI6eyIkdXNlcm5hbWUiOiJSeWFuIn19 - Source verse.works ↗
Related works (by shared algorithms)
Last updated 2026-07-16