2
\$\begingroup\$

The Google toy of the day, https://musiclab.chromeexperiments.com/Spectrogram, features a continuously scrolling 3D render of a shape with cross sections that seem to equal the spectrograph of sound at a single instant.

enter image description here

Assuming the frequency information is available as input, how does that information become a mesh that updates continuously?

\$\endgroup\$
0

1 Answer 1

1
\$\begingroup\$

At first glance, I'd implement this kind of effect much the same way I'd implement 3D terrain. Build a tessellated plane of the desired resolution with the height (z) values all zero. As the frequency histogram information becomes available, each timeslice of the histogram is mapped onto the rightmost column of the grid such that that the intensity becomes the z value of the grid vertex. As subsequent histogram samples become available, they push the existing samples to the left.

If all you're doing is producing this effect you can probably get away with a high enough tessellation factor on your grid that the motion of samples "across" the grid is smooth. You'd probably want to make sure you choose an appropriate data structure for the container of samples, something like a fixed-size ring buffer, which will let you linearly read the full set of samples starting at any arbitrary point but which would also not require you to shuffle all the samples in memory when inserting a new one (just change the read/write pointers within the buffer).

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .