williamngan / pts

A library for visualization and creative-coding
https://ptsjs.org
Apache License 2.0
5.2k stars 181 forks source link

Sound / music ? #28

Open danigb opened 6 years ago

danigb commented 6 years ago

Hi,

This looks awesome. Congrats!

Are you planning to integrate audio/sound generation in any way? I'm intrigued by the idea of mapping the points into sound or music. Any suggestion?

Thanks!

williamngan commented 6 years ago

Yes! Combining visuals + sounds using the same approach of Point/Space/Form would be amazing.

At the very least we should support mapping amplitude and frequency. Potentially also offer algorithms based on music theory.

Any other suggestions or use cases you have in mind?

danigb commented 6 years ago

Yes, amplitude and frequency are mandatory. I'm the creator of tonal music theory library, and some kind of connection between both projects would be really nice. I'll think about it.

Meanwhile, do you have a plan to develop an audio module for "pts" or you're delegating that to the community?

williamngan commented 6 years ago

Hi @danigb , you tonal library is amazing. What would it take for it to work with Pts? Would be great to explore some options together.

My initial thought is that Pts can provide an "Op" class (say, Signal), that's generic enough to process audio signals and hopefully tie them to Pt and Group class. Probably the goal is not to do everything in Pts, but to make it easy to work seamlessly with other cool sound libraries like tonal. (This way we can also keep the Pts file size smaller)

Do you have suggestions or ideas in mind?

danigb commented 6 years ago

Hi @williamngan,

I would love to work with you on this, but I am afraid (as the delay in my answers reveals) that I am too busy to put time and energy into this development (the situation may change in a couple of months).

Anyway, a Signal class that provides some kind of continuous data that can be mapped to things like amplitude or frequency would be wonderful (frequency can be used not only to control pitch, but also other kind of sound modulations).

I think this continuous signal can be converted to discrete values (like note pitch) using external libraries like tonal to produce more "musical" or "melodic" effects. But I think is ok to have this kind of transformations outside pts itself.

With this in mind, I think that if you build this kind of Signal class I would be able to produce (with help) some examples of usage with Web Audio or some libraries like Tone.js and/or Gibberish

Thanks for your work!

williamngan commented 6 years ago

Sounds like a good plan, @danigb . I'll try to get started on it soon, and would love your feedbacks on it. Let's keep this thread open for discussions.

Totally understood that you might be busy (same here actually, Pts is my midnight project 😅).