How do I push UART data into the sound library's FFT function?

I am trying to send data from an accelerometer to the Processing through UART. I was able to accomplish that portion of my project. My final goal is to use the sensor data to create an FFT visual interface to visualize the vibration frequency. I have seen the “sound” library which has a FFT function. But I am not sure how to use it with the UART data. Is there a way to pass the uart data to the FFT function of the sound library so that other than talking samples from an audio file, the FFT function will take the real time data from the UART and create a real time FFT graphical interface with proper labeling on the x and y axis?

I can create an array of 512 or 4096 samples from the data received over UART. I was thinking of using that array to draw the FFT. So, in a way, the program will collect a packet of data points (512 or 4096 data points) from the UART. After collecting the data, it will run the FFT function using that data, display the FFT result through processing, and update the display or next frame with the next set of data coming from the UART and it will continuously perform that operation.

Any suggestions on how I can do it?

Thank you.