SeanArchibald / scale-workshop

Design microtonal scales and play them in your web browser. Export your scales for use with VST instruments. Convert Scala files to various tuning formats.
https://sevish.com/scaleworkshop/
147 stars 23 forks source link

Decimal precision #156

Closed vsicurella closed 2 years ago

vsicurella commented 2 years ago

This features reimplementation of many math functions in helpers.js using Decimal.js to improve precision and avoid NaN results.

It also rounds the Equal Temperament scales to 6 decimals, as done in other areas of the app, and converts ratios with integers above (2^31)-1 to cents for the Scala exporter.

Some efficiency was lost because there's more passing of strings to avoid the JS float limits, but I don't think it's very noticeable.

This branch was started from commit b86853c and rebased on #142 so that should probably get merged first.