# Library for listening to mathematical functions?

**URL:** https://discourse.processing.org/t/library-for-listening-to-mathematical-functions/29693
**Category:** Libraries
**Created:** [April 28, 2021, 12:30am UTC](https://discourse.processing.org/t/library-for-listening-to-mathematical-functions/29693 "2021-04-28T00:30:42Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Karrajo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/karrajo/32/14745_2.png) [@Karrajo](https://discourse.processing.org/u/Karrajo)
#### Post date: [April 28, 2021, 12:30am UTC](https://discourse.processing.org/t/library-for-listening-to-mathematical-functions/29693/1 "2021-04-28T00:30:42Z")

</div>

Hi, I am looking for a library to listen to the sound of mathematical functions that I can write. Functions like this:

```auto
float x = 200*sin(t*PI*2)
float y = 200*sin(t*PI*3)

```

I already can see the drawings of the functions with my code, as in a oscilloscope, but I don`t know if there is a way to listen that. I think I need something like a tone generator, but I don’t know any library that have it.

Thank you for any information you can give me

---

<div class="post-metadata">

### Author: ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)
#### Post date: [April 28, 2021, 12:40am UTC](https://discourse.processing.org/t/library-for-listening-to-mathematical-functions/29693/2 "2021-04-28T00:40:16Z")

</div>

see examples of sound library

---

<div class="post-metadata">

### Author: ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)
#### Post date: [April 28, 2021, 4:38pm UTC](https://discourse.processing.org/t/library-for-listening-to-mathematical-functions/29693/3 "2021-04-28T16:38:52Z")

</div>

for example minim’s Advanced \> CreateAudioSample shows how to generate a float array and play it: [Minim | Compartmental](http://code.compartmental.net/tools/minim/)

however, visualizing waves and sonifying waves are quite different - in your example you make waves at 1 and 1.5 Hz (`TWO_PI` is once cycle). If you simply play it, it won’t sound anything (except perhaps pop noise) - you need at least 20 Hz (depending on the speakers) to make it audible 🙂

---

<div class="post-metadata">

### Author: ![Karrajo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/karrajo/32/14745_2.png) [@Karrajo](https://discourse.processing.org/u/Karrajo)
#### Post date: [April 28, 2021, 5:20pm UTC](https://discourse.processing.org/t/library-for-listening-to-mathematical-functions/29693/4 "2021-04-28T17:20:15Z")

</div>

Thank you very much, @micuat, I am watching the example you told me and others of Minim library, I think I could work with that. I was hoping to find something more “direct”, that is able to read the same function that I am drawing, but this is very interesting.

And thank you for the explanation about the Hz, I was thinking of scaling the functions to turn them into audible waves.

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [April 28, 2021, 5:33pm UTC](https://discourse.processing.org/t/library-for-listening-to-mathematical-functions/29693/5 "2021-04-28T17:33:04Z")

</div>

> [@Karrajo](#):
>
> I was thinking of scaling the functions to turn them into audible waves.

Hello,

Some resources at the [Processing](https://processing.org) website:

- [Sound / Processing.org](https://processing.org/tutorials/sound/)
- [Sound / Libraries / Processing.org](https://processing.org/reference/libraries/sound/index.html)

`:)`

Also explore the libraries available for Processing:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/76a8aba2b6f7d4e4edc03e3e4d450e167e536db2.png)

Beads does not seem to be updating at this time!

---

<div class="post-metadata">

### Author: ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)
#### Post date: [April 28, 2021, 7:04pm UTC](https://discourse.processing.org/t/library-for-listening-to-mathematical-functions/29693/6 "2021-04-28T19:04:07Z")

</div>

In fact visual and audio work quite differently. For audio, sampling rate is usually 44100, meaning you need to update 44100 times in one second (for visuals, usually 60). So you cannot simply use draw function to update every sample, and usually audio is stored in an array to play it.
