Date:2023-05-07
/Update:2024-04-30
Sound visualization / Sheet Music
This is a visual representation of sound using Processing, using the FFT (Fast Fourier Transform) values of Processing’s Sound library to draw sounds as if you were writing a musical score. You can replace the sample.wav part in the code with any sound you like and play it back with different values.
OS – macOS Montery Apple Silicon Mac
Generative art, sound visualization. The art of recording sounds in musical notation.
It was created on Processing. The source code is very simple and uses the FFT (Fast Fourier Transform) of the sound library to draw random dots.
Sample
Sourse code
Please write your own sound data in “sample.wav”.
Your sound data can be simply dragged and dropped into the Processing Editor, where a data folder is created and ready for use.
//sound
import processing.sound.*;
SoundFile soundfile;
FFT fft;
int bands = 32; //(8,16,32,64,128,256,512,1024)
float margin = 100;
float stepNum;
float stepPlus;
void setup(){
background(0);
size(1200,1200);
frameRate(8);
//sound
soundfile = new SoundFile(this, "sample.wav");
fft = new FFT(this, bands);
fft.input(soundfile);
//analyze
stepNum = (width-margin*2)/bands;
stepPlus = (width-margin*2)/(60*8); //second framecount
}
void draw(){
//background(0);
//noStroke();
//fill(0,30);
//rect(0,0,width,height);
stroke(255,70);
smooth();
noFill();
fft.analyze();
if (stepNum < width - margin*2){
for(int i=0; i < bands; ++i){
strokeWeight(fft.spectrum[i]*50+1);
for (float j = 0; j < 10; ++j) {
float ali = random(360);
float ran = (fft.spectrum[i]*width/5+1) * (1 - random(random(random(1))));
point(cos(ali)*ran+stepNum+margin, sin(ali)*ran+i*(height-margin*2)/float(bands)+margin);
}
}
}
stepNum += stepPlus;
}
Recommended
Artist : hundredmillionthousand
https://linktr.ee/hundredmillionthousand