mozaic_tips_and_tricks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
mozaic_tips_and_tricks [2020/01/12 21:16] – [Store two positive Values into a single Variable] Fixed typo _kimozaic_tips_and_tricks [2020/02/25 10:01] – Added tip for calculating standard chords. wim
Line 4: Line 4:
  
  
-  * [[mozaic_tips_and_tricks#Two dimensional Arrays]] +  * [[#Two dimensional Arrays]] 
-  * [[mozaic_tips_and_tricks#Multi dimensional Arrays]] +  * [[#Multi dimensional Arrays]] 
-  * [[mozaic_tips_and_tricks#Store two positive Values into a single Variable]] +  * [[#Store two positive Values into a single Variable]] 
-  * [[mozaic_tips_and_tricks#Store three unsigned Bytes into a single Variable]] +  * [[#Store three unsigned Bytes into a single Variable]] 
-  * [[mozaic_tips_and_tricks#Some Best Practice Tips]] +  * [[#Some Best Practice Tips]] 
-  * [[mozaic_tips_and_tricks#Multi-Line Pad Labels]] +  * [[#Multi-Line Pad Labels]] 
-  * [[mozaic_tips_and_tricks#Use the SHIFT Button to toggle to HELP View]] +  * [[#Use the SHIFT Button to toggle to HELP View]] 
-  * [[mozaic_tips_and_tricks#Use a Knob to toggle 16 Pads View to HELP View]]+  * [[#Use a Knob to toggle 16 Pads View to HELP View]] 
 +  * [[#Calculate Standard Chords from a Root Note]]
  
 ===== Two dimensional Arrays ===== ===== Two dimensional Arrays =====
Line 70: Line 71:
  
 <code> <code>
-  maxB = 1000  // Maximum value for plus one +  maxA = 1000  // Maximum value for plus one 
-  valA = 723   // allowed range 0 .. ~16000 +  valA = 723   // allowed range 0 .. 999 
-  varB = 124   // allowed range 0 .. 999+  varB = 124   // allowed range 0 .. ~16000
      
-  combinedValue = valA * maxB + valB+  combinedValue = valA + valB * maxA 
 </code>  </code> 
  
 To later extract the values from their packed format use To later extract the values from their packed format use
 <code> <code>
-  valA = RoundDown combinedValue / maxB +  valA = combinedValue % maxA 
-  valB = combinedValue % maxB+  valB = Div combinedValue, maxA
 </code> </code>
 \\  \\ 
Line 213: Line 214:
 </code> </code>
 {{tag>Mozaic midi_scripting}} {{tag>Mozaic midi_scripting}}
 +
 +===== Calculate Standard Chords from a Root Note ====
 +
 +This is a compact way to build standard chords from just a root note. It turns out that for standard western scales such as Major, Minor, Dorian, Phrygian, etc, normal chord notes can be found by starting at the root and counting up in steps of three semitones then quantizing up to the next scale tone. Repeat this for the number of notes you want in the chord (triad (3), seventh (4), ninth (5), eleventh (6), 13th (7).
 +
 +Here’s a code snippet that efficiently creates a chord of “notes” degree from an incoming MIDI Note. Code to do something with that array would obviously have to be added.
 +
 +<code>
 +@OnMIDINote
 +  //set “notes” to the number of notes wanted in the chord before this event triggers!
 +  chordNotes[0] = ScaleQuantize MIDINote
 +  for i = 1 to (notes - 1)
 +    chordNotes[i] = ScaleQuantize chordNotes[i-1] + 3
 +  endfor
 +@End
 +</code>
  • mozaic_tips_and_tricks.txt
  • Last modified: 2024/04/23 19:07
  • by _ki