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

creating a graph in c++

Joined
May 27, 2008
Messages
3,628 (0.62/day)
System Name Ultra 64
Processor NEC VR4300 (MIPS R4300i)
Motherboard proprietary design
Cooling Fanless aircooled
Memory 4.5MB 250 MHz RDRAM
Video Card(s) 62.5 MHz Reality Coprocessor
Storage 32 - 512 Mbit ROM Cartridge
Display(s) 720x576
Case Clear Blue Funtastic
Audio Device(s) 16-bit CD quality
Power Supply proprietary design
Mouse N64 mouse for use with N64DD
Keyboard N64 keyboard for use with N64DD
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:
 
Joined
Dec 2, 2009
Messages
3,351 (0.64/day)
System Name Dark Stealth
Processor Ryzen 5 5600x
Motherboard Gigabyte B450M Gaming rev 1.0
Cooling Snowman, arctic p12 x2 fans
Memory 16x2 DDR4 Corsair Dominator Pro
Video Card(s) 3080 10gb
Storage 2TB NVME PCIE 4.0 Crucial P3 Plus, 1TB Crucial MX500 SSD, 4TB WD RED HDD
Display(s) HP Omen 34c (34" monitor 3440x1440 165Hz VA panel)
Case Zalman S2
Power Supply Corsair 750TX
Mouse Logitech pro superlight, mx mouse s3, Razer Basiliskx with battery
Keyboard Custom mechanical keyboard tm680
Software Windows 11
Benchmark Scores 70-80 fps 3440x1440 on cyberpunk 2077 max settings
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.
 
Top