Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add retunable primes #62

Open
clumma opened this issue Jul 29, 2022 · 8 comments
Open

Add retunable primes #62

clumma opened this issue Jul 29, 2022 · 8 comments

Comments

@clumma
Copy link

clumma commented Jul 29, 2022

A ratio like 5/4 can be understood to directly specify a pitch. But it can also be understood as specifying the just intonation identity of a note that may be tempered. Monzos are also used for the latter purpose, but they can be cumbersome to write.

I propose a command with the form {t Ac Bc Cc...} where the capital letters are tunings, in cents, of successive prime numbers.

For example, the command {t 1200c 1895c 2779c} tunes the 5-limit as in 19edo. All higher primes would be tuned normally.

The benefit is that an entire composition can be retuned with one command (if its pitches are given as ratios). Existing ways of retuning an entire piece, say by changing {12edo}{0 2 4 5 7 9 11} to {19edo}{0 3 6 8 11 14 17}, are not guaranteed to preserve the just intonation identities of notes and chords.

This should be straightforward to implement. Rational numbers would be converted to something like cents before playback. They would be factored, multiplied by the tuning, and the resulting terms would be summed. It may be advisable to escape rationals over a certain length and tune them normally, in case a user inputs ratios of large primes which could take a long time to factor.

@battaglia01
Copy link

Seconding this.

@dxinteractive
Copy link
Owner

Hi! Sorry I didn't catch this earlier. This is an interesting idea. Can I get you to provide me with an example tune written with the syntax you'd like, and the same tune written using features that xenpaper currently supports? Just so I can fully grok why what we already have might not be adequate. Also what are your goals in using xenpaper when you find yourself in a situation where this seems like a desirable thing to have?

Also I'd better be open - this project hasn't been in active development for quite some time other than an occasional bug fix so I can't really guarantee that I'll get to this soon or even in months time if I'm being honest. PRs are welcome though.

@euwbah
Copy link

euwbah commented Aug 8, 2022

Thirded. Would love to work on this, would need help navigating the codebase/building though.

proposed steps:

  1. syntax tokens grammar,
  2. update Context to contain primes tuning state
  3. update where scale frequencies are calculated & labels (they seem to be calculated in various places, will need help finding them)
  • will need to import some prime factoring library

As for syntax, I'm guessing something like:

{t 1200c 1900c 2800c}
1/1 9/8 5/4

would be equivalent to: {12edo} 0 2 4?

@battaglia01
Copy link

@dxinteractive the idea is just to be able to take a piece of music written in JI and temper it easily by changing the size of the primes. You change that one line and can easily render different tempered versions of the same tune.

@euwbah right. Maybe simpler would be to implement it as a simple search and replace, possibly using a regex or something, that just takes the JI ratios and maps them to cents values, as a preprocessing step. Then just send the result into xenpaper.

It would also be really nice to somehow be able to do this with tempered intervals. For instance if would be nice to specify something in porcupine and then vary the size of the octave and generator and so on. That would be a bit trickier though as it would require some kind of different notation to begin with. You would need a pair of 2D coordinates for an arbitrary interval in a rank 2 temperament.

@euwbah
Copy link

euwbah commented Aug 8, 2022

@battaglia01 ah, regex might work, but I think there should be a way to just implement it internally - that way, animations and the pitch labels in the ruler view would still work as expected.

rank-n temperaments appear to be harder to implement since the current code doesn't parse anything remotely similar to vectors, so you would need to make a whole new syntax, maybe with angle brackets or something.

@euwbah
Copy link

euwbah commented Aug 9, 2022

The syntax is slightly different than proposed (using setter notation since its a configuration parameter), but this should work nonetheless.

@clumma
Copy link
Author

clumma commented Aug 9, 2022

Changes look good. Is the new version being hosted for testing on github pages? What's the url?

@euwbah
Copy link

euwbah commented Aug 9, 2022

Thanks @clumma, it's not hosted unfortunately, I had issues setting it up because ghpages serves the page not at the root directory, so the paths and imports got messed up. Though, you can clone the project and build & run it with the build instructions I provided in the PR. If the pr takes a while to get accepted I don't mind fixing the paths temporarily. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants