Hi, I am looking for a library to listen to the sound of mathematical functions that I can write. Functions like this:
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.
for example minim’s Advanced > CreateAudioSample shows how to generate a float array and play it: Minim | Compartmental
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
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.
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.