How to draw a shape based on time

Hi everyone. I was looking at this video on how to build a radial graph based on sound

Is there any (easy) way to map the circle (1 full turn) to the duration of the audio file.

In the video I see that the audio is longer than the created ellipsis and it start to rotate.
I wanted to have the entire waveform of the audio to fit on the circle

Thanks in advance

1 Like

you just divide 2pi by the amount of samples i believe

edit: resolution will become a factor as the amount of samples increases. but you could always just use every nth sample. idk it’s early i need coffee.

yeah, work with 360 degree like in the video or when you want to have more points like 720 or so

and then milliseconds of song duration / 720 = length of one sample.

Now you somehow need to analyze one sample. so for example take the average volume in that sample and store in an array (0…720).