Ruby Scripts

Frederic Cormier edited this page May 14, 2017 · 5 revisions
Clone this wiki locally

Ruby scripts

NoteCollectionParser.rb

The NoteCollectionParser.rb script is run automatically as a pre-action at build time.
It's responsible for generating the chords and scales definition JSON files as well as updating the WMNoteCollectionKeys.h with the correct keys for scales and chords.

Add your own Scales and Chords:

You 'll need to edit the WMRubyData.rb file.
Just add a line containing a string for the key and an array for the note collection in either of the 2 hashes, like in the following block.

"Whole Tone" =>          [0,2,4,6,8,10,12],   
"Major Pentatonic" =>    [0,2,4,7,9,12],
"Minor Pentatonic" =>    [0,3,5,7,10,12],
"Major Bebop" =>         [0,2,4,5,7,8,9,11,12],

"My Added Scale" =>	 	[0,1,2,4,5,6,8]

During the next build, the NoteCollectionParser.rb will update the scales.json file and create a corresponding key named WMScaleModeMyAddedScale in the WMNoteCollectionKeys.h for you to access your new scale.

WMRubyData.rb

The WMRubyData.rb contains 2 hashes of scales and chord definitions.
Feel free to add your own chords and scales here.

NotesArrayScript.rb

The NotesArrayScript.rb is a big Ruby hash of notes definitions containing frequency, midi note number, and cpspch values for each note from C-1 to G9. This script has been run once and generated Objective-C code you can see in the WMPool 's prepareNotes method.
It's unlikely you will need to run this script, unless notes change their frequencies.