MusicEngine is a dynamic music library for SuperCollider that facilitates the generation of note ranges for use in other projects. Given its ability to generate ranges from two to twelve degrees, MusicEngine is flexible enough to generate chord or scale note ranges.
MusicEngine uses a system of verbose range symbols, where all intervals, or degrees, are expressed after a root note (e.g., F#M3P5m7). This data is then used to generate note information. Additionally, an alias system maps conventional symbols to their verbose representation for convenience (e.g., FMaj7 -> FM3P5M7). When generating a range, the user may use either format.
Note ranges are arrays of MENote objects that encapsulate all data pertaining to each note (e.g., MIDI number, frequency, note name, degree, octave, etc.). Note ranges gather all notes belonging to any chord or scale across the entire MIDI range (0-127), spanning a total of 11 octaves.
MusicEngine is currently in its version 0.1.0-beta.
A note range may be generated by creating an instance of MENoteRange, passing a chord symbol as argument. Chord symbol must be of type String:
~range = MENoteRanges.new("Gm3P5M6M7");MENoteRange generates an array of MENote objects, that encapsulate all data for any given note.
We can retrieve data from each note by calling on its properties:
~range.notes[19].degree // m3
~range.notes[19].name // Bb4
~range.notes[19].sol // Sib4 (solfege naming convention)
~range.notes[19].accidental // b
~range.notes[19].midi // 70
~range.notes[19].freq // 466.16376151809
~range.notes[19].octave // 4We can return the name without the octave, when using the methods name and sol, by setting withOctave to false:
~range.notes[19].name(withOctave: false) // BbThe MENotes object has additional properties that can be set by the user:
~range.notes[19].duration = 1;
~range.notes[19].articulation = 0.99; // \legato
~range.notes[19].dynamic = 0.5;If we want to handle data directly, and not through a MENotes object, we can call on several MENoteRange instance methods to get arrays for most of the properties found in MENotes:
~range.degrees; // [P5, M6, M7, Rt, ...]
~range.names; // [D1, E1, F#1, G1, ...]
~range.sol; // [Re1, Mi1, Fa#1, Sol1, ...]
~range.midi; // [26, 28, 30, 31, ...]
~range.freq; // [36.708095989676, 41.203444614109, 46.249302838954, ...]Ranges may be filtered by specifying the first and last octaves, as well as from which degree the sequence should start:
~range.midi(fromOctave: 4, toOctave: 5, fromDegree: "Rt"); // [67, 70, 74, 76, 78, 79, 82]This will start the sequence in G4, and end in the last note found in octave 5.
When setting this parameter, we should be mindful to only pick degrees present in the chord. If we choose a M2, as an example:
~range.midi(fromOctave: 4, toOctave: 5, fromDegree: "M2");We will get the error:
ERROR: Range does not include interval M2. Pick from Rt, m3, P5, M6, M7.
CALL STACK:
Exception:reportError
(...)
A range symbol may be built using a verbose syntax, where all intervals are discriminated after a root, or by appending a conventional symbol to a root.
Note
For more information on verbose symbols and aliases, see the Range Symbols documentation page.
This project is shared freely with the community, and feedback, testing, or ideas for improvements are always welcome. If you appreciate this project and would like to help support my work, consider becoming a GitHub Sponsor or Buy me a coffee.
MusicEngine is licensed under the GNU General Public License v3 (GPLv3).