Page 1 of 1
How to fix improper octave switching?
Posted: 01 Apr 2013 09:16
by sersch
Building on studio setup.jzml, I am using a pad array and a switch to create a keyboard with an octave switcher (see attached file).
The pad array gives me a nice three octave keyboard (3 rows of 1 octave, lowest pitch in lower left, highest pitch in upper right).
However, the octave switch transposes in 3 octave steps, not in 1 octave steps.
How can I transpose in 1 octave steps?
It seems I fail to understand the basic interaction of the octave switching vector and the pad number vector for transposition. Please, who can put me on the right track here? Thanks in advance!
Re: How to fix improper octave switching?
Posted: 02 Apr 2013 19:58
by sersch
Still hoping that somebody can hint me to what I am doing wrong, here's what I have:
My 3 octave pad array (3 rows with 12 pads) has a local object variable "invert" that I use to invert the pitch order in the pad array (per default lowest pitch is at upper left and lowest pitch is at lower right, but I want the lowest pitch to be at lower left and hightest pitch at upper right):
invert={x[24], x[25], x[26], x[27], x[28], x[29], x[30], x[31], x[32], x[33], x[34], x[35], x[12], x[13], x[14], x[15], x[16], x[17], x[18], x[19], x[20], x[21], x[22], x[23], x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11]}
I use a switch array (3 switches) called "octave" for octave control, as the switch array is vertically oriented, I use the local object variable "y" to have the lowest octave value at the bottom and the highest at the top:
y={x[2], x[1], x[0]}
In the pad array, I use the existing "vel" variable to generate notes:
vel={invert*octave.y[0], invert*octave.y[1], invert*octave.y[2]}
This works fine, the only problem is that the octave switcher transposes the whole thing in 3 octave steps, not in 1 octave steps. What do I need to do to achieve 1 octave steps, and even more importantly: why does it work this way?
I have to admit that I copied the octave mechanism from the factory "studio setup.jzml", interface "_4_keyboard", container "MasterKeyboard". There, one pad array ("white") and five single pads ("black" to "black5") are combined to form a traditional one octave keyboard (represented by the local object variable "scale"), which is then transposed by a switch array ("octave"), with the "vel" variable generating the notes:
scale={x[0], Black.x, x[1], Black2.x, x[2], x[3], Black3.x, x[4], Black4.x, x[5], Black5.x, x[6]}
vel={scale*octave.x[0], scale*octave.x[1], scale*octave.x[2], scale*octave.x[3], scale*octave.x[4], scale*octave.x[5]}
Here, the octave transposition steps are just 1 octave wide. I really would like to understand why it works this way in this case, and why a comparable formula gives 3 octave steps in my example above. How are the 2 vectors "multiplied" so that actual notes are generated? And what do I have to do to get 1 octave steps in my example?
Any help is highly appreciated, thanks much in advance!
Re: How to fix improper octave switching?
Posted: 02 Apr 2013 21:07
by Softcore
Hello there! I looked at your template and there was one thing I could not understand. You have 3 switches on the left to transpose octaves...What I dont get is how you want them to be transposed - as in, center, one up, one down? This way, you wont be covering the whole 127 range of keys...
Re: How to fix improper octave switching?
Posted: 02 Apr 2013 21:26
by sersch
Hi, the three octave switches are sort of a workaround. As they transpose my 3 octave pad array in 3 octave increments, 3 switches give me a total range of 9 octaves (108 notes), whereas 4 switches would cover 12 octaves (144 notes), which would be outside of the MIDI note range.
What I'd like to have is this:
- Middle row of my pad array starts at C3
- Five vertically orientedoctave switches
- Middle octave switch = no transposition
- first octave switch above middle = +1 octave transposition
- second octave switch above middle = +2 octave transposition
- first octave switch below middle = -1 octave transposition
- second octave switch below middle = -2 octave transposition
Thanks much!
Re: How to fix improper octave switching?
Posted: 03 Apr 2013 00:37
by Softcore
Ok! Took the liberty to sneak in a velocity slider...
Re: How to fix improper octave switching?
Posted: 03 Apr 2013 00:42
by Softcore
Added labels in octave buttons!
Re: How to fix improper octave switching?
Posted: 03 Apr 2013 00:45
by Softcore
Arghhhhh...had forgotten to unmap one of the x s....
final version
Re: How to fix improper octave switching?
Posted: 03 Apr 2013 06:29
by Softcore
Blonde moment last night - I think this should work too, and its much more simplified....
Re: How to fix improper octave switching?
Posted: 03 Apr 2013 07:22
by sersch
Thank you so very much!
Believe it or not – this morning when awakening I understood how the octave transposition mechanism in factory "studio setup.jzml", interface "_4_keyboard", container "MasterKeyboard" worked. So I got up and first expanded the "octave" switch to 5 position (no labels yet):
y={x[4], x[3], x[2], x[1], x[0]}
I left the "invert" variable of the pad array untouched and put this into the "vel" variable to generate notes:
vel=replace(stretch(0, 84), invert, firstof(octave.y)*12)
Via "stretch", it creates a vector spanning the desired 7 octave range and filled with 0 values.
Then it takes the pressed octave switch via "firstof" and uses this to calculate the position, from which on the pad vector "invert" will be pasted into the newly created 7 octave vector.
Judging from my MIDI monitor app, this seems to do the trick. I will need to verify it using the iConnect and my hardware synth.
Here's the result as a library file: