Transpose?

59 views
Skip to first unread message

Konstantinos Kostovasilis

unread,
Sep 1, 2014, 1:45:41 PM9/1/14
to midi-shap...@googlegroups.com
Hi there

Great plugin I must say.

So, my question, basically I'm trying to create scales that will be used with pad controllers. Meaning that say in a C major the 1st pad will be C and the second pad will be D and not C# as it normally is.
I created a C major and an A minor which really took 4 hours to route each pad and I'm trying to use the semitone function but it doesn't work or I doing something wrong.
I read the manual but it didn't get me anywhere.

What I want to do is to take those mappings and transpose them within the program so I can get all the major and all the minor scales and then continue with others.
Maybe that is not the right way to do what I want.

How would I globally transpose a C major scale to get C#, D, Eb and so forth? if it's possible.

Either way I could do it manually and change it's mapping but will take a lot of time.

Again, brilliant plugin with nice design.

Regards
Konstantinos


Konstantinos Kostovasilis

unread,
Sep 1, 2014, 1:52:44 PM9/1/14
to midi-shap...@googlegroups.com
Forgot to say that I saved those scales as presets and they really look nice a tidy in two folders (Major, Minor), can't way to create more.
A_Minor.mssp
C_Major.mssp

Konstantinos Kostovasilis

unread,
Sep 1, 2014, 1:59:09 PM9/1/14
to midi-shap...@googlegroups.com
I'm trying to emulate this "in key" mode of Ableton Push but for all the pad controllers and all the daws.

\In key mode

Rob

unread,
Sep 1, 2014, 9:39:52 PM9/1/14
to midi-shap...@googlegroups.com
MSS isn't very good at dealing with scales or dynamically transposing but something like this is doable. Instead of creating a mapping for every input you could create a mapping for every possible output. Then the formula would determine whether to trigger that note given the input note.

For example there would be a mapping that accepts all notes as input and outputs Note 45 (A2). The formula would look at the input note and see if it should trigger A2. If it shouldn't then nothing would be output to note 45. So essentially you need a formula that will calculate the output note given the input note. The general form for this formula would look like

firstNote + octaveOffset + noteOffset + transpose

firstNote is a note number for the input note that should trigger the exact same output note. For example if you want C2 to trigger C2, C#2 to trigger D2, D2 to trigger E2 etc. then you would set the firstNote to C2 (36).

The octaveOffset will be the number of semitones the output note should be above the firstNote rounded to the nearest octave. For example if the first note is C2, the input note is D#2 and you want to output D2 then the octaveOffset would be 0. If you want to output E3 then the octaveOffset would be 12. You can calculate the octave offset with this formula

floor ((noteNumber - firstNote) / 7) * 12

Where notenum is the input note.

The noteOffset will represent the number of semitones into an octave the output note should be. Calculating this gets a bit more complicated so I'm going to skim over it for now but if you are interested I can explain it. The formula for it ended up looking like this

Round((notenum - firstNote) % 7 * (scale/10 + 1.7), 0)

Like I said MSS is not very good at this sort of thing so the solution ended up being pretty complicated. I'll attach a program that should accomplish what your trying to do though. There are a few variables you can modify to specify the behaviour:

Scale: set this to 0 if you want a minor scale or 1 if you want a major scale.
firstNote: I explained this one above
transpose: transposes the output up or down some number of semitones.

Anyway try out the program I attached and hopefully that will solve your problem. My explanation probably didn't make a lot of sense so let me know if you want me to clarify anything ;)
ChromaticToScale.mssp

Konstantinos Kostovasilis

unread,
Sep 2, 2014, 7:14:57 AM9/2/14
to midi-shap...@googlegroups.com

Hi Rob

Thanks for your quick reply,

I'll have a look later tonight when I'm back home and I'll try your program.
It is better to take the time and understand what you did than create the scales manually.

Thanks for taking the time to do that. Will post any questions I might have.

Konstantinos Kostovasilis

unread,
Sep 2, 2014, 3:03:12 PM9/2/14
to midi-shap...@googlegroups.com
Hi again Rob and thank you again for your time.

So... I understood everything except from the part with the (scale/10+1.7) from the noteoffset but I get that it calculates the semitones, I just don't get how the 0/10 or 1/10 depending the scale number works. Also the 1.7 does by any chance come from 12/7?
Also didn't understand why you multiply the notenum with 127. I believe I don't get exactly how the equation should be written.

Your code is great and works as I want but since I don't fully understand it I can't create other scales.

So what I did was to take all the note numbers from  36 to 96 and put them in excel in a column I also put in another column the note numbers that I wanted as my output.
From this I created a graph and got the polynomial function

((-0.00007*(x^2))+(1.724*x)-37.735)

which is basically an equation that gives the major scale.
I also checked this function in python and gives the correct numbers. I also used the Round function and again it gives the correct number.
I did the same thing with the minor scale and got the same results.

But....I couldn't make it work in the plugin.

For example, using this code

Round(((-0.00007) * (Pow((notenum),2))) + (1.724 * (notenum)) - 37.735,0)

should give me the note number (of a major scale) I want at the output.

If I put this equation for every input should give me what I want but it doesn't and I just don't know why.

Maybe it is not possible this way because you can't have an output that is dependent on Y.

I also don't get why the following code doesn't work. It uses the equation of the major scale to check.

I double checked for typo errors like brackets but maybe something else is wrong.

Thanks again Rob.

MajorScale2.mssp

Konstantinos Kostovasilis

unread,
Sep 2, 2014, 3:19:32 PM9/2/14
to midi-shap...@googlegroups.com
If it is possible to make the code I wrote to work it will be very easy to derive to the equation of all the scales using excel.
I will have to put the intervals in excel and that's it, I will get the equations back.

Rob

unread,
Sep 2, 2014, 4:52:28 PM9/2/14
to midi-shap...@googlegroups.com
Round((notenum*127 - firstNote) % 7 * (scale/10 + 1.7), 0)

Ok so this part of the equation (notenum*127 - firstNote) % 7 with get you a number from 0-6. If your working with a C major scale 0 will correspond to a C, 1 to a D, 2 to an E, etc.. But we need to get the number of semitones above C instead of just the number of notes.

So the next part of the equation will get you the number of semi tones above the root note of the scale. I noticed that if you multiple the number from 0-6 by 1.7 and round to the nearest integer you'll get the number of semtones above the root note for a minor scale.

e.g.
Round(0 * 1.7) = 0
Round(1 * 1.7) = 2
Round(2 * 1.7) = 3
Round(3 * 1.7) = 5
Round(4 * 1.7) = 7
Round(5 * 1.7) = 8
Round(6 * 1.7) = 10

and if you multiple it by 1.8 instead you get the number of semi tones for a major scale.

So (scale/10 + 1.7) is just a hacky way of getting 1.7 when scale is 0 and 1.8 when scale is 1.

1.7 and 1.8 are just numbers that happened to work so there's no real significance to them.


You method of coming up with the equation in excel is a lot less of a hack but they both should work.

When I first wrote the equation I actually forgot to multiple notenum by 127. But notenum is a number that ranges from 0 to 1 that represents the input note number. So to get a number from 0 to 127 we just need to multiple by 127. I guess the variable name notenum is a bit misleading though. Anyway I think that is the only reason your second solution isn't working so something like this should work

if(Round(((-0.00007) * (Pow((notenum*127),2))) + (1.724 * (notenum*127)) - 37.735,0) + transpose = 95, vel, ignore)

Konstantinos Kostovasilis

unread,
Sep 2, 2014, 4:56:00 PM9/2/14
to midi-shap...@googlegroups.com
So....I figured it out.

I had to multiply notenum by 127, don't get why. Maybe I missed it in the documentation. It works now.

Attached is my presets for Major and Minor scales. Please comment....

Would it be possible to put more than one IF statements? something like ELSEIF although I can't think how this would work.

Rob I will try to do as many scales I know and as many is possible to do that way and I'll send them to you.
Major.mssp
Minor.mssp

Konstantinos Kostovasilis

unread,
Sep 2, 2014, 4:57:44 PM9/2/14
to midi-shap...@googlegroups.com
I was typing the previous message while you sent me a message.

Konstantinos Kostovasilis

unread,
Sep 2, 2014, 5:00:42 PM9/2/14
to midi-shap...@googlegroups.com
Thank you again for all your help and your amazing plugin.

Rob

unread,
Sep 2, 2014, 5:06:26 PM9/2/14
to midi-shap...@googlegroups.com
I just updated the docs here https://code.google.com/p/midi-shape-shifter/wiki/Equations?ts=1409691779&updated=Equations to be a bit more explicit about notenum.

You could essentially do an ELSEIF by putting another of in the else parameter. e.g.

if(condition1, result1, if(condition2, result2, result3))

Glad you got it working and thanks for posting your programs here!
Reply all
Reply to author
Forward
0 new messages