To automate just intonation
Fellow nerds,
Here is a script for tuning your files to five-limit just intonation. Probably a few of us wish that there was something like this built into the GUI, but the developers have been busy working on lots of awesome features like speeding up the app, unmetered music, higher quality samples, and sfz support. And they had the foresight to use XML, not some proprietary binary blob.
Caveats:
* Files must be uncompressed (mscx).
* I probably won't test and rework in Musescore 3 till it's available for production.
* This script only works for compositions with a root of A (e.g. A minor, A dorian, A harmonic minor). Let me know if you need a different root.
* Only run this on a copy that does not already have tuning information.
#!/bin/bash
sed -i 's|<tpc>29</tpc>|<tpc>29</tpc>\n\t\t\t<tuning>0</tuning>|g' $1
sed -i 's|<tpc>17</tpc>|<tpc>17</tpc>\n\t\t\t<tuning>0</tuning>|g' $1
sed -i 's|<tpc>5</tpc>|<tpc>5</tpc>\n\t\t\t<tuning>0</tuning>|g' $1
sed -i 's|<tpc>24</tpc>|<tpc>24</tpc>\n\t\t\t<tuning>11.73</tuning>|g' $1
sed -i 's|<tpc>12</tpc>|<tpc>12</tpc>\n\t\t\t<tuning>11.73</tuning>|g' $1
sed -i 's|<tpc>0</tpc>|<tpc>0</tpc>\n\t\t\t<tuning>11.73</tuning>|g' $1
sed -i 's|<tpc>31</tpc>|<tpc>31</tpc>\n\t\t\t<tuning>3.91</tuning>|g' $1
sed -i 's|<tpc>19</tpc>|<tpc>19</tpc>\n\t\t\t<tuning>3.91</tuning>|g' $1
sed -i 's|<tpc>7</tpc>|<tpc>7</tpc>\n\t\t\t<tuning>3.91</tuning>|g' $1
sed -i 's|<tpc>26</tpc>|<tpc>26</tpc>\n\t\t\t<tuning>15.64</tuning>|g' $1
sed -i 's|<tpc>14</tpc>|<tpc>14</tpc>\n\t\t\t<tuning>15.64</tuning>|g' $1
sed -i 's|<tpc>2</tpc>|<tpc>2</tpc>\n\t\t\t<tuning>15.64</tuning>|g' $1
sed -i 's|<tpc>33</tpc>|<tpc>33</tpc>\n\t\t\t<tuning>-13.69</tuning>|g' $1
sed -i 's|<tpc>21</tpc>|<tpc>21</tpc>\n\t\t\t<tuning>-13.69</tuning>|g' $1
sed -i 's|<tpc>9</tpc>|<tpc>9</tpc>\n\t\t\t<tuning>-13.69</tuning>|g' $1
sed -i 's|<tpc>28</tpc>|<tpc>28</tpc>\n\t\t\t<tuning>-1.96</tuning>|g' $1
sed -i 's|<tpc>16</tpc>|<tpc>16</tpc>\n\t\t\t<tuning>-1.96</tuning>|g' $1
sed -i 's|<tpc>4</tpc>|<tpc>4</tpc>\n\t\t\t<tuning>-1.96</tuning>|g' $1
sed -i 's|<tpc>23</tpc>|<tpc>23</tpc>\n\t\t\t<tuning>-17.49</tuning>|g' $1
sed -i 's|<tpc>11</tpc>|<tpc>11</tpc>\n\t\t\t<tuning>-17.49</tuning>|g' $1
sed -i 's|<tpc>-1</tpc>|<tpc>-1</tpc>\n\t\t\t<tuning>-17.49</tuning>|g' $1
sed -i 's|<tpc>30</tpc>|<tpc>30</tpc>\n\t\t\t<tuning>1.96</tuning>|g' $1
sed -i 's|<tpc>18</tpc>|<tpc>18</tpc>\n\t\t\t<tuning>1.96</tuning>|g' $1
sed -i 's|<tpc>6</tpc>|<tpc>6</tpc>\n\t\t\t<tuning>1.96</tuning>|g' $1
sed -i 's|<tpc>25</tpc>|<tpc>25</tpc>\n\t\t\t<tuning>13.69</tuning>|g' $1
sed -i 's|<tpc>13</tpc>|<tpc>13</tpc>\n\t\t\t<tuning>13.69</tuning>|g' $1
sed -i 's|<tpc>1</tpc>|<tpc>1</tpc>\n\t\t\t<tuning>13.69</tuning>|g' $1
sed -i 's|<tpc>32</tpc>|<tpc>32</tpc>\n\t\t\t<tuning>-15.64</tuning>|g' $1
sed -i 's|<tpc>20</tpc>|<tpc>20</tpc>\n\t\t\t<tuning>-15.64</tuning>|g' $1
sed -i 's|<tpc>8</tpc>|<tpc>8</tpc>\n\t\t\t<tuning>-15.64</tuning>|g' $1
sed -i 's|<tpc>27</tpc>|<tpc>27</tpc>\n\t\t\t<tuning>-3.91</tuning>|g' $1
sed -i 's|<tpc>15</tpc>|<tpc>15</tpc>\n\t\t\t<tuning>-3.91</tuning>|g' $1
sed -i 's|<tpc>3</tpc>|<tpc>3</tpc>\n\t\t\t<tuning>-3.91</tuning>|g' $1
sed -i 's|<tpc>22</tpc>|<tpc>22</tpc>\n\t\t\t<tuning>-11.73</tuning>|g' $1
sed -i 's|<tpc>10</tpc>|<tpc>10</tpc>\n\t\t\t<tuning>-11.73</tuning>|g' $1
Comments
Did you know there is a plugin that has a variety of tunings including just? See https://musescore.org/en/project/tunings-and-temperaments
In reply to Did you know there is a… by mike320
Thank you, Mike! It's wonderful that there's a solution for everybody. I used to use this plugin. It only tunes compositions with a root of C. To use the plugin with other roots, you need to transpose the whole composition to C and then back up or down. After doing that on dozens of scores, that was starting to feel like a lot of friction. With twelve shell scripts like the one above, I can tune a score in one step.
Then there's the transition to Musescore 3. I expect I'll be able to update my scripts with one or two shell commands after five minutes of looking at the new MSCX markup, whereas I looked at the guide to updating plugins and my eyes glazed over: https://musescore.org/en/handbook/plugins-30
I'm a musician, not a programmer. I like taking the path of least resistance and I'm grateful that you're all using a hackable plaintext format. But I appreciate your thought.
In reply to Thank you, Mike! It's… by andrew907
Thanks for posting. Is the just intonation of the Tunings and Temperaments plugin five-limit just intonation?
In reply to Thanks for posting. is just… by Sambaji
Here is the operative line:
property var just: [ 000.0, 702.0, 204.0, 884.0, 386.0, 1088.0, 590.0, 070.0, 772.0, 316.0, 1018.0, 498.0 ];
On a quick glance, this looks like five-limit rounded to the nearest cent.
In reply to Here is the operative line:… by andrew907
Bill Hails has updated his Tuning plugin so that the root note is now changeable.
https://github.com/billhails/MuseScore-plugins/tree/develop/src/Tuning
In reply to Bill Hails has updated his… by Sambaji
I didn't know that, nice! Thanks, that's good to know, I could see myself using it sometime
In reply to I didn't know that, nice!… by andrew907
People should use whatever method works best for them. I have about a hundred scores to retune today. With bash scripts, it took me ten minutes to set up the computer and then I can go do other work while it cranks away for hours. I'm having a hard time imagining how I had the patience to apply the plug-in to each file one at a time. :)
In reply to People should use whatever… by andrew907
Okay, if anyone's prowling the forums years after the fact as I do looking for a just intonation solution, I found this week by far the easiest just intonation solution (at least for me) is timidity: http://manpages.ubuntu.com/manpages/bionic/man1/timidity.1.html
Export a MIDI and run it through timidity with a -Zpure0m option (or change the number to whatever key you're using). Way easier than trying to wrangle tuning with scripts as it looks like I was doing a couple years ago.