Tonejs / Tone.js

A Web Audio framework for making interactive music in the browser.
https://tonejs.github.io
MIT License
13.52k stars 983 forks source link

Documentation for attribute types and max/mins/ranges #836

Closed cordial closed 3 years ago

cordial commented 3 years ago

The feature you'd like Documentation to be added to describe the attributes max and mins and their type (specifically for me for the polysynth/monosynth and effects). I can work out some of them, but some I am stuck on e.g. portmento in the Polysynth. Any alternatives you've considered I've tried looking for these details everywhere, and I can't find them. I appreciate this might be out of the scope of the project i.e. go and learn how these work better. If you can point me in that direction too, that would be very much appreciated. However, I think it would be very useful to know if there are any max/mins in various attributes from a code perspective and / or what the limits are at an actual audio (and again in my case) synth level.

tambien commented 3 years ago

Can you be more specific with which places you are stuck on and need more guidance? Types are described for nearly all attributes and ranges are often implied through the type. I try not to prescribe specific ranges in most case to keep the library as flexible as possible.

Synth.portamento is in "Seconds". There is no pre-defined range, but if a value less than 0 is given, it will throw an error explaining that the value range is between [0, Infinity).

Since PolySynth allocates a new voice for each synth, i don't think you will ever hear the portamento. The glide between notes only happens on the same synth voice, so it would require a monophonic synth.

Some values do have ranges which are noted in the docs. BitCrusher.bits for example needs to be between 0-16, which is mentioned below the description. If you assign something outside that range, it will also throw an error.