Giter Club home page Giter Club logo

Comments (6)

Woyten avatar Woyten commented on August 19, 2024

Hi @tychedelia! Thanks for reporting the issue.

I think the problem you mentioned is connected to #8. Currently, scale items that are not within [0cents..period] are rejected because it would require a more sophisticated inverse search function Tuning::find_by_pitch. This function is important for finding the nearest scale step close to a spatial coordinate (e.g. the mouse pointer position).

In order to do an inverse search the Scl type needs to keep track by how many periods the scale items overshoots the period and consider this information in the inverse search.

This is not a super hard problem. It's just that I haven't prioritized it yet. If you think this feature is super important I could start working on it after the migration to Bevy is done. Unless you are interested in helping out. 🙂

from tune.

tychedelia avatar tychedelia commented on August 19, 2024

This is not a super hard problem. It's just that I haven't prioritized it yet. If you think this feature is super important I could start working on it after the migration to Bevy is done. Unless you are interested in helping out. 🙂

Thanks for the quick reply! I've managed to work around this for now, but am interested in contributing if I run into some free time soon. I'm mostly using this library in a simple way to write a VST, so your description of a more complex use (mouse pointer) is helpful for me understanding the problem space. I'll comment here if I have time to pick this up.

from tune.

Woyten avatar Woyten commented on August 19, 2024

@tychedelia Hi. Happy to hear that you are writing some VST software using my library! Is it available on Github?

By the way, I had a look at the problem and couldn't resist writing some code. The result is: The feature is almost fully implemented. I also added support for non-periodic scales like the one you provided in the example. Thanks for the inspiration!

The feature is available on the test branch. Feel free to test if it works for your use cases. I will do some more testing and push it on master very soon. Do you need the improved feature on crates.io?

from tune.

Woyten avatar Woyten commented on August 19, 2024

Now on master branch: d08a1a1

from tune.

tychedelia avatar tychedelia commented on August 19, 2024

Wow! Incredible. I'll definitely give this a test really soon. This is all built locally so no need for a crate release but very excited to give this a shot. :) Thanks again.

from tune.

Woyten avatar Woyten commented on August 19, 2024

I can exactly reproduce the scale from your Scale Workshop link in tune-cli.

Input:

tune dump ref-note 36@70hz steps 3/2 1556.378085308558c 1901.9550008653873c 2298.1333228961844c \
  2746.283397529118c 3106.025951444457518c 3498.1333228961844c  3803.9100017307755c 3948.812593083507c \
4326.511923937046c 4691.5631668168035c 1/1

Output:

  ----------Source Scale----------- ‖ ----Pitch----- ‖ --------Target Scale--------
   21 | IDX  -15 | 11/9    +1¢  +3o ‖     685.000 Hz ‖   77 |      F  5 |  -33.679¢
   22 | IDX  -14 |  3/2   +25¢  +3o ‖     852.000 Hz ‖   80 |  G#/Ab  5 |  +44.020¢
   23 | IDX  -13 | 11/6   +42¢  +3o ‖    1052.000 Hz ‖   84 |      C  6 |   +9.071¢
   24 | IDX  -12 |  1/1    +0¢  +0o ‖      70.000 Hz ‖   37 |  C#/Db  2 |  +17.508¢
   25 | IDX  -11 |  3/2    +0¢  +0o ‖     105.000 Hz ‖   44 |  G#/Ab  2 |  +19.463¢
   26 | IDX  -10 | 11/9    +9¢  +1o ‖     172.000 Hz ‖   53 |      F  3 |  -26.114¢
   27 | IDX   -9 |  3/2    +0¢  +1o ‖     210.000 Hz ‖   56 |  G#/Ab  3 |  +19.463¢
   28 | IDX   -8 | 11/6   +49¢  +1o ‖     264.000 Hz ‖   60 |      C  4 |  +15.641¢
   29 | IDX   -7 | 11/9    -1¢  +2o ‖     342.000 Hz ‖   65 |      F  4 |  -36.209¢
   30 | IDX   -6 |  3/2    +4¢  +2o ‖     420.989 Hz ‖   68 |  G#/Ab  4 |  +23.534¢
   31 | IDX   -5 | 11/6   +49¢  +2o ‖     528.000 Hz ‖   72 |      C  5 |  +15.641¢
   32 | IDX   -4 |  9/8    +0¢  +3o ‖     630.000 Hz ‖   75 |  D#/Eb  5 |  +21.418¢
   33 | IDX   -3 | 11/9    +1¢  +3o ‖     685.000 Hz ‖   77 |      F  5 |  -33.679¢
   34 | IDX   -2 |  3/2   +25¢  +3o ‖     852.000 Hz ‖   80 |  G#/Ab  5 |  +44.020¢
   35 | IDX   -1 | 11/6   +42¢  +3o ‖    1052.000 Hz ‖   84 |      C  6 |   +9.071¢
>  36 | IDX    0 |  1/1    +0¢  +0o ‖      70.000 Hz ‖   37 |  C#/Db  2 |  +17.508¢
   37 | IDX    1 |  3/2    +0¢  +0o ‖     105.000 Hz ‖   44 |  G#/Ab  2 |  +19.463¢
   38 | IDX    2 | 11/9    +9¢  +1o ‖     172.000 Hz ‖   53 |      F  3 |  -26.114¢
   39 | IDX    3 |  3/2    +0¢  +1o ‖     210.000 Hz ‖   56 |  G#/Ab  3 |  +19.463¢
   40 | IDX    4 | 11/6   +49¢  +1o ‖     264.000 Hz ‖   60 |      C  4 |  +15.641¢
   41 | IDX    5 | 11/9    -1¢  +2o ‖     342.000 Hz ‖   65 |      F  4 |  -36.209¢
   42 | IDX    6 |  3/2    +4¢  +2o ‖     420.989 Hz ‖   68 |  G#/Ab  4 |  +23.534¢
   43 | IDX    7 | 11/6   +49¢  +2o ‖     528.000 Hz ‖   72 |      C  5 |  +15.641¢
   44 | IDX    8 |  9/8    +0¢  +3o ‖     630.000 Hz ‖   75 |  D#/Eb  5 |  +21.418¢
   45 | IDX    9 | 11/9    +1¢  +3o ‖     685.000 Hz ‖   77 |      F  5 |  -33.679¢
   46 | IDX   10 |  3/2   +25¢  +3o ‖     852.000 Hz ‖   80 |  G#/Ab  5 |  +44.020¢
   47 | IDX   11 | 11/6   +42¢  +3o ‖    1052.000 Hz ‖   84 |      C  6 |   +9.071¢
   48 | IDX   12 |  1/1    +0¢  +0o ‖      70.000 Hz ‖   37 |  C#/Db  2 |  +17.508¢
   49 | IDX   13 |  3/2    +0¢  +0o ‖     105.000 Hz ‖   44 |  G#/Ab  2 |  +19.463¢
   50 | IDX   14 | 11/9    +9¢  +1o ‖     172.000 Hz ‖   53 |      F  3 |  -26.114¢
   51 | IDX   15 |  3/2    +0¢  +1o ‖     210.000 Hz ‖   56 |  G#/Ab  3 |  +19.463¢
   52 | IDX   16 | 11/6   +49¢  +1o ‖     264.000 Hz ‖   60 |      C  4 |  +15.641¢
   53 | IDX   17 | 11/9    -1¢  +2o ‖     342.000 Hz ‖   65 |      F  4 |  -36.209¢
   54 | IDX   18 |  3/2    +4¢  +2o ‖     420.989 Hz ‖   68 |  G#/Ab  4 |  +23.534¢
   55 | IDX   19 | 11/6   +49¢  +2o ‖     528.000 Hz ‖   72 |      C  5 |  +15.641¢
   56 | IDX   20 |  9/8    +0¢  +3o ‖     630.000 Hz ‖   75 |  D#/Eb  5 |  +21.418¢
   57 | IDX   21 | 11/9    +1¢  +3o ‖     685.000 Hz ‖   77 |      F  5 |  -33.679¢
   58 | IDX   22 |  3/2   +25¢  +3o ‖     852.000 Hz ‖   80 |  G#/Ab  5 |  +44.020¢
   59 | IDX   23 | 11/6   +42¢  +3o ‖    1052.000 Hz ‖   84 |      C  6 |   +9.071¢
   60 | IDX   24 |  1/1    +0¢  +0o ‖      70.000 Hz ‖   37 |  C#/Db  2 |  +17.508¢
   61 | IDX   25 |  3/2    +0¢  +0o ‖     105.000 Hz ‖   44 |  G#/Ab  2 |  +19.463¢
   62 | IDX   26 | 11/9    +9¢  +1o ‖     172.000 Hz ‖   53 |      F  3 |  -26.114¢
   63 | IDX   27 |  3/2    +0¢  +1o ‖     210.000 Hz ‖   56 |  G#/Ab  3 |  +19.463¢
   64 | IDX   28 | 11/6   +49¢  +1o ‖     264.000 Hz ‖   60 |      C  4 |  +15.641¢
   65 | IDX   29 | 11/9    -1¢  +2o ‖     342.000 Hz ‖   65 |      F  4 |  -36.209¢
   66 | IDX   30 |  3/2    +4¢  +2o ‖     420.989 Hz ‖   68 |  G#/Ab  4 |  +23.534¢
   67 | IDX   31 | 11/6   +49¢  +2o ‖     528.000 Hz ‖   72 |      C  5 |  +15.641¢
   68 | IDX   32 |  9/8    +0¢  +3o ‖     630.000 Hz ‖   75 |  D#/Eb  5 |  +21.418¢
   69 | IDX   33 | 11/9    +1¢  +3o ‖     685.000 Hz ‖   77 |      F  5 |  -33.679¢
   70 | IDX   34 |  3/2   +25¢  +3o ‖     852.000 Hz ‖   80 |  G#/Ab  5 |  +44.020¢
   71 | IDX   35 | 11/6   +42¢  +3o ‖    1052.000 Hz ‖   84 |      C  6 |   +9.071¢
   72 | IDX   36 |  1/1    +0¢  +0o ‖      70.000 Hz ‖   37 |  C#/Db  2 |  +17.508¢
   73 | IDX   37 |  3/2    +0¢  +0o ‖     105.000 Hz ‖   44 |  G#/Ab  2 |  +19.463¢
   74 | IDX   38 | 11/9    +9¢  +1o ‖     172.000 Hz ‖   53 |      F  3 |  -26.114¢
   75 | IDX   39 |  3/2    +0¢  +1o ‖     210.000 Hz ‖   56 |  G#/Ab  3 |  +19.463¢
   76 | IDX   40 | 11/6   +49¢  +1o ‖     264.000 Hz ‖   60 |      C  4 |  +15.641¢
   77 | IDX   41 | 11/9    -1¢  +2o ‖     342.000 Hz ‖   65 |      F  4 |  -36.209¢
   78 | IDX   42 |  3/2    +4¢  +2o ‖     420.989 Hz ‖   68 |  G#/Ab  4 |  +23.534¢
   79 | IDX   43 | 11/6   +49¢  +2o ‖     528.000 Hz ‖   72 |      C  5 |  +15.641¢
   80 | IDX   44 |  9/8    +0¢  +3o ‖     630.000 Hz ‖   75 |  D#/Eb  5 |  +21.418¢
   81 | IDX   45 | 11/9    +1¢  +3o ‖     685.000 Hz ‖   77 |      F  5 |  -33.679¢
   82 | IDX   46 |  3/2   +25¢  +3o ‖     852.000 Hz ‖   80 |  G#/Ab  5 |  +44.020¢
   83 | IDX   47 | 11/6   +42¢  +3o ‖    1052.000 Hz ‖   84 |      C  6 |   +9.071¢
   84 | IDX   48 |  1/1    +0¢  +0o ‖      70.000 Hz ‖   37 |  C#/Db  2 |  +17.508¢
   85 | IDX   49 |  3/2    +0¢  +0o ‖     105.000 Hz ‖   44 |  G#/Ab  2 |  +19.463¢
   86 | IDX   50 | 11/9    +9¢  +1o ‖     172.000 Hz ‖   53 |      F  3 |  -26.114¢
   87 | IDX   51 |  3/2    +0¢  +1o ‖     210.000 Hz ‖   56 |  G#/Ab  3 |  +19.463¢
   88 | IDX   52 | 11/6   +49¢  +1o ‖     264.000 Hz ‖   60 |      C  4 |  +15.641¢
   89 | IDX   53 | 11/9    -1¢  +2o ‖     342.000 Hz ‖   65 |      F  4 |  -36.209¢
   90 | IDX   54 |  3/2    +4¢  +2o ‖     420.989 Hz ‖   68 |  G#/Ab  4 |  +23.534¢
   91 | IDX   55 | 11/6   +49¢  +2o ‖     528.000 Hz ‖   72 |      C  5 |  +15.641¢
   92 | IDX   56 |  9/8    +0¢  +3o ‖     630.000 Hz ‖   75 |  D#/Eb  5 |  +21.418¢
   93 | IDX   57 | 11/9    +1¢  +3o ‖     685.000 Hz ‖   77 |      F  5 |  -33.679¢
   94 | IDX   58 |  3/2   +25¢  +3o ‖     852.000 Hz ‖   80 |  G#/Ab  5 |  +44.020¢
   95 | IDX   59 | 11/6   +42¢  +3o ‖    1052.000 Hz ‖   84 |      C  6 |   +9.071¢
   96 | IDX   60 |  1/1    +0¢  +0o ‖      70.000 Hz ‖   37 |  C#/Db  2 |  +17.508¢
   97 | IDX   61 |  3/2    +0¢  +0o ‖     105.000 Hz ‖   44 |  G#/Ab  2 |  +19.463¢
   98 | IDX   62 | 11/9    +9¢  +1o ‖     172.000 Hz ‖   53 |      F  3 |  -26.114¢
   99 | IDX   63 |  3/2    +0¢  +1o ‖     210.000 Hz ‖   56 |  G#/Ab  3 |  +19.463¢
  100 | IDX   64 | 11/6   +49¢  +1o ‖     264.000 Hz ‖   60 |      C  4 |  +15.641¢
  101 | IDX   65 | 11/9    -1¢  +2o ‖     342.000 Hz ‖   65 |      F  4 |  -36.209¢
  102 | IDX   66 |  3/2    +4¢  +2o ‖     420.989 Hz ‖   68 |  G#/Ab  4 |  +23.534¢
  103 | IDX   67 | 11/6   +49¢  +2o ‖     528.000 Hz ‖   72 |      C  5 |  +15.641¢
  104 | IDX   68 |  9/8    +0¢  +3o ‖     630.000 Hz ‖   75 |  D#/Eb  5 |  +21.418¢
  105 | IDX   69 | 11/9    +1¢  +3o ‖     685.000 Hz ‖   77 |      F  5 |  -33.679¢
  106 | IDX   70 |  3/2   +25¢  +3o ‖     852.000 Hz ‖   80 |  G#/Ab  5 |  +44.020¢
  107 | IDX   71 | 11/6   +42¢  +3o ‖    1052.000 Hz ‖   84 |      C  6 |   +9.071¢
  108 | IDX   72 |  1/1    +0¢  +0o ‖      70.000 Hz ‖   37 |  C#/Db  2 |  +17.508¢

I have already published tune-0.32.1 to crates.io and will probably publish tune-cli-0.25.1 within the next hour.

I will leave this ticket open until microwave's temperament finder and UI can correctly handle the now acceptable non-periodic and negative-periodic scales.

from tune.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.