FFT Landscape generator

edited March 2017 in Library Questions

Hi there, I followed the Terrain Generator by Perlin Noise tutorial from youtube, and I tried to switch the perlin noise with an FFT of the mic audio input. X axis is fine, in the horizon I can clearly see my FFT effect, in the y axis I can't get the progressive generation, so to create a landscape from the sequences of FFT moments/frames. to get the Effect That the observer walks toward the horizon self-generated by FFT. Below is where I am:

Could someone help me? Thanks a lot


  • Format your code. Edit post, select code and hit ctrl+o. Make sure there is an empty line above and below your code.


  • I did, any suggestion? Thanks!

  • that's expected - any fft analysis has much higher values in the lower freq bands than elsewhere. you're just drawing the bands with the biggest values off the screen. that bit you do see is in the distance where the perspective brings them into view.

    i always find it helps to use peasycam. it's takes 3 or 4 lines of code but allows you to drag the camera around the space so you can see what's happening

    // before setup
    import peasy.*;
    PeasyCam cam;
    // in setup
    cam = new PeasyCam(this, 2000);

    as for "// i can't set the y too" this is traditionally time. keep a buffer full of previous values of the fft calculations and draw the older versions in the background.

  • (you'll need to install the peasycam library if you don't already have it but it's very useful)

  • Hi, thanks for yours fast reply, peasycam is very useful, but I find a lot of difficult to work with arrays, I want to put inside x values of terrain variable from the spectrum fft result, and in y the time offset to move it, but it don't like my choice, could someone know how to deal with it? Thanks

  • Answer ✓

    you need a 2d array to store old bands values. in fact you could just make spectrum a 2d array.

Sign In or Register to comment.