frequency spectrum vs time

Dear All, I'm trying to get a 3D plot of the energy of the spectrum vs time and frequency. Is there someone that can help me?

Thanks

Answers

  • What code have you got so far? What does your data look like?

  • I have an mp3 audio file and I want to get the same picture as below. In reality I'm not interested in doing a plot but just in having this data format and do some manipulation on it. The code I have so far is this:

    var fft;
    var mySound;
    var width;
    
    function preload() {
        mySound = loadSound('applause.mp3');
    }
    
    function setup() {
        createCanvas(600, 350);
        mySound.play();
        fft = new p5.FFT();
    
    }
    
    function draw() {
    
        background(200);
        var spectrum = fft.analyze();
    
        beginShape();
        for (var i = 0; i< spectrum.length; i++) {
            ellipse(i, map(mySound.currentTime(), 0, mySound.duration(), 50, 250), spectrum[i]*0.3, spectrum[i]*0.3 );
        }
        endShape();
    }
    

    Screenshot 2015-04-08 09.46.38

Sign In or Register to comment.