# How to draw a shape based on time

**URL:** <https://discourse.processing.org/t/how-to-draw-a-shape-based-on-time/33023>\
**Category:** Libraries\
**Created:** [October 23, 2021, 6:59pm UTC](https://discourse.processing.org/t/how-to-draw-a-shape-based-on-time/33023 "2021-10-23T18:59:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Razoil](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/razoil/32/14798_2.png) [@Razoil](https://discourse.processing.org/u/Razoil)\
**Post date:** [October 23, 2021, 6:59pm UTC](https://discourse.processing.org/t/how-to-draw-a-shape-based-on-time/33023/1 "2021-10-23T18:59:05Z")

</div>

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

[![](https://img.youtube.com/vi/h_aTgOl9J5I/maxresdefault.jpg "17.10: Sound Visualization: Radial Graph - p5.js Sound Tutorial") ](https://www.youtube.com/watch?v=h_aTgOl9J5I)

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

---

<div class="post-metadata">

**Author:** ![hotfooted](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hotfooted/32/3670_2.png) [@hotfooted](https://discourse.processing.org/u/hotfooted)\
**Post date:** [October 23, 2021, 11:12pm UTC](https://discourse.processing.org/t/how-to-draw-a-shape-based-on-time/33023/2 "2021-10-23T23:12:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [October 23, 2021, 11:21pm UTC](https://discourse.processing.org/t/how-to-draw-a-shape-based-on-time/33023/3 "2021-10-23T23:21:07Z")

</div>

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).
