Performance Issues for audio reactive modeling of the solution to the wave equation

Hello TD Community,

This is my first forum post here so let me know if I am doing something wrong.

I am working on a project of modeling realistic waves (the solution to the wave equation with different formats). I solve the equations using Mathematica (for its numeric analysis capabilities), export a text file which I format using Python in Jupyter Notebook. Once I have a formatted .txt file for height data and a separate .txt file with RGB data, I import them into TD and use them to instance spheres. The wave height and colors then follow the song by iterating through the timesteps based with a speedCHOP affected by the lows, mids, and highs of the audio.

I am running into performance issues, and I do not think I have an efficient technique for doing this. I am wondering if there is another technique to implement instead of instancing spheres for each x,y data point. How should I proceed with optimization?

Attached is a .toe for reference to my current setup, but the data files for it and the movie file of the result are too large to include (75MB) sorry.
Waves.27.toe (568.3 KB)

Instancing from DATs is often a helpful way to work, but actually very slow in terms of performance. The contents of DATs are always stored as strings, so converting that collection of data back to floating point values for the GPU is probably your bottle neck.

That being the case, you may consider looking at the point file in TOP:

This relatively new TOP reads .ply and .xyz files both of which can be wrappers for ascii encoded data. This should mean that you can keep the majority of your workflow as is, and just do a small file formatting re-arrangement in your python pre-processing step. I believe the point files can also be time based (you’ll need to double check how that’s encoded), so you should be able to treat this single file as an animation source that can you can step through with your same speed based interval system.

You can also now directly instance from TOPs, allowing you to skip the process of converting to another data type. If you right click on the point file in TOP on the op create menu you’ll see op snippets which has some examples of how this new TOP works.

Hope that helps! Your image looks very cool. :slight_smile:

http://paulbourke.net/dataformats/ply/
http://paulbourke.net/dataformats/xyz/

1 Like

Thanks this really helps! I shall begin work learning this new TOP. After implementation hopefully I should be able to improve the (x,y) resolution, because in Mathematica I have interpolated my grid solution giving me infinitesimal (x,y) step sizes.

1 Like

Welcome to the forum @Zenden!

1 Like