back to list

Scala: Rational Approximation within cent Limits?

🔗nils.blindenstein@...

6/15/2016 2:14:25 AM

Hi everyone,
I've been working with Scala for a couple of years now and know my way pretty well around the sub-set of features that I need on a regular basis.

What I'm beginning to need more often recently are the approximation features. Unfortunately, there's one thing I can't figure out how to do. I'm pretty sure I'm using the right feature for what I want (›Rational Approximation‹ ...or maybe not?), but not with the right setting.

The job that I want Scala to do is best described as:

»Find me the simplest rational form of the scale's pitches (specified as ratio or in cents) within the limits of +/- x cents difference from the original pitch.«

A (made-up, but somewhat realistic) example:

* Let the original pitch be 110.5 cents.
* We want to substitute it by a rational interval, as simple as possible.
* Simple, for our purposes, merely means: small numbers.
* That pitch may not differ from the original by more than +/- 10 cents.

So:
120/113 (~104c), for example, is -6.5c from the original;
15/14 (~119.5c) is +9c away, but simpler (which we prioritize), so return the latter.

So the scale that before was

1/1
110.5
2/1

should now be

1/1
15/14
2/1

Optionally, I want to be able to specify a prime limit: »Only return intervals that fit within the specified prime limit«. If I specified, for example a 5-limit, both intervals above would be discarded and the search would have to continue until a 5-limit interval within the +/- 10 cent corridor is found.

If someone could provide advice on how to do this -- or just point me in the direction of where to find it (in case it's already there but I haven't noticed it -- I'd really appreciate it!

Thanks in advance!
Bests
Nils

🔗glenn.leider@...

6/16/2016 6:12:21 AM

Closer to your 110.5 is the just diatonic ratio of 16:15, which is 111.7 cents, only 1.2 cents away.

🔗Steve P. <groups@...>

6/18/2016 3:43:56 AM

There is a further consideration (at least for me):
for related intervals, or areas of intervals, it might be desirable to have related denominators, to show relationship.
I do this by hand.

Steve P.

> On 15 Jun 2016, at 10:14, nils.blindenstein@... [TUNING] <TUNING@yahoogroups.com> wrote:
>
> Hi everyone,
> I've been working with Scala for a couple of years now and know my way pretty well around the sub-set of features that I need on a regular basis.
>
> What I'm beginning to need more often recently are the approximation features. Unfortunately, there's one thing I can't figure out how to do. I'm pretty sure I'm using the right feature for what I want (›Rational Approximation‹ ...or maybe not?), but not with the right setting.
>
> The job that I want Scala to do is best described as:
>
> »Find me the simplest rational form of the scale's pitches (specified as ratio or in cents) within the limits of +/- x cents difference from the original pitch.«
>
> A (made-up, but somewhat realistic) example:
>
> * Let the original pitch be 110.5 cents.
> * We want to substitute it by a rational interval, as simple as possible.
> * Simple, for our purposes, merely means: small numbers.
> * That pitch may not differ from the original by more than +/- 10 cents.
>
> So:
> 120/113 (~104c), for example, is -6.5c from the original;
> 15/14 (~119.5c) is +9c away, but simpler (which we prioritize), so return the latter.
>
> So the scale that before was
>
> 1/1
> 110.5
> 2/1
>
> should now be
>
> 1/1
> 15/14
> 2/1
>
> Optionally, I want to be able to specify a prime limit: »Only return intervals that fit within the specified prime limit«. If I specified, for example a 5-limit, both intervals above would be discarded and the search would have to continue until a 5-limit interval within the +/- 10 cent corridor is found.
>
> If someone could provide advice on how to do this -- or just point me in the direction of where to find it (in case it's already there but I haven't noticed it -- I'd really appreciate it!
>
> Thanks in advance!
> Bests
> Nils
>
>
>
>