1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

creating a graph in c++

Discussion in 'Programming & Webmastering' started by ste2425, Jan 28, 2013.

  1. ste2425


    May 27, 2008
    3,577 (1.04/day)
    Thanks Received:
    Huddersfield, uk
    hi all

    Basically im implementing FFTW 3.3.3 on a block of audio samples that is updated at a predefined interval and ive got it running what i think is quite well. im inputting a real number samples through the Steinberg VST SDK and FFTW is outputting a complex number, what i want to do now is plot the output and have the plot refresh with the new output as i feed it with the new input so i can fine tune it and see visually if its detecting the various test frequencies i feed it so i can decide on the best trade of between performance and resolution. However i have no idea how to do what ive come to see as such a trivial thing as plot one number against the other. It doesn't need to be visually amazing or huge amounts of functionality just plot one number against the other, when im sure my FFT is working the plot wont be used, its just for testing.

    I understand the complex number is an array of the real (out[0]) and imaginary (out[1]) numbers however im not too sure how i get the frequency and amplitude from that data to actually plot. Ive read i have to convert it to a real number but then that would leave me with a single array of data like the input :/

    Hope all this makes sense thanks in advance for any help :toast:
  2. GSquadron


    Dec 2, 2009
    3,257 (1.13/day)
    Thanks Received:
    I think you would first need an update loop, using a boolean true value which will make you update your graph or at least display it on the screen.
    Than, I would say to experiment and give out a formula on how that real number you are trying really outputs. In reality that array you are talking about is in fact a real number:
    out[0] == 40
    out[1] == 45
    out[2] == 55
    out[n] == real number

    Try to combine values by adding first 5 to each one, than add 10 or increment with at least 1.
    This way can make you find a formula which will make you create whatever graph you want, no matter how complex it is.
    ste2425 says thanks.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)