Musical Scales as midi note numbers.

In: Actionscript|Audio|Classes and Functions|Experiments|Flash|Flash Midi Server|Source Code

26 Apr 2011

For a couple of audio projects, I needed some nice musical scales, in midi note format (0-127). I couldn’t find a good list online, so had to knock together a quick script to trace some out. Here’s some that I’m using in a current project, and also the AS source to find any other ones you may want.

Using this PDF as a guide - http://8.brm.sk/Scales_Chords.pdf – enter the scale name, and the notes which are active in that scale. For example, the first scale in the image below, the Adonai Malakh (Israel), we would set the code as -

?View Code ACTIONSCRIPT
//Enter scale name - 
var scaleName:String="AdonaiMalakh(Israel)";
//Enter the notes in each octave to use - see - http://8.brm.sk/Scales_Chords.pdf
var acceptedArray:Array = [0,1,2,3,5,7,9,10];

Which would give us the output -

?View Code ACTIONSCRIPT
var AdonaiMalakh(Israel):Array =[48,49,50,51,53,55,57,58,60,61,62,63,65,67,69,70,72,73,74,75,77,79,81,82,84,85,86,87,89,91,93,94];

?View Code ACTIONSCRIPT
//Enter scale name - 
var scaleName:String="Zirafkend";
//Enter the notes in each octave to use - see - http://8.brm.sk/Scales_Chords.pdf
var acceptedArray:Array = [0,2,3,5,7,8,9,11];
 
var octaveStep:int=0;
var finalArray:Array = [];
 
//You can limit the scales to any length - it will retrieve the middle section of the scale.
var limitArray:int = 32;
 
for(var i:int=0;i<12;i++){
	for(var j:int=0;j<acceptedarray .length;j++){
		finalArray.push(acceptedArray[j]+octaveStep)
	}
	octaveStep+=12;
}
 
function limitTo(A:Array):Array{
	if(A.length==limitArray){
		return A;
	}
	else{
		var aLength:int =A.length;
		var diff:int = A.length-limitArray;
		var diff2:int = Math.round(diff/2);
		var ARR2:Array = A.slice(diff2,diff2+limitArray);
		return ARR2;
	}
}
 
trace("var "+scaleName+":Array =["+limitTo(finalArray)+"];");
//This should trace - 
//var Zirafkend:Array =[48,50,51,53,55,56,57,59,60,62,63,65,67,68,69,71,72,74,75,77,79,80,81,83,84,86,87,89,91,92,93,95];

And here’s some scales. These are chopped to the middle 32 notes in each sequence.

?View Code ACTIONSCRIPT
var BiYu:Array =[24,27,31,34,36,39,43,46,48,51,55,58,60,63,67,70,72,75,79,82,84,87,91,94,96,99,103,106,108,111,115,118];
var Blues:Array =[41,42,43,46,48,51,53,54,55,58,60,63,65,66,67,70,72,75,77,78,79,82,84,87,89,90,91,94,96,99,101,102];
var BluesDiminished:Array =[48,49,51,52,54,55,56,58,60,61,63,64,66,67,68,70,72,73,75,76,78,79,80,82,84,85,87,88,90,91,92,94];
var Dorian:Array =[25,27,30,32,34,37,39,42,44,46,49,51,54,56,58,61,63,66,68,70,73,75,78,80,82,85,87,90,92,94,97,99];
var FullMinor:Array =[51,53,55,56,57,58,59,60,62,63,65,67,68,69,70,71,72,74,75,77,79,80,81,82,83,84,86,87,89,91,92,93];
var HarmonicMajor:Array =[44,47,48,50,52,53,55,56,59,60,62,64,65,67,68,71,72,74,76,77,79,80,83,84,86,88,89,91,92,95,96,98];
var Hawaiian:Array =[39,43,45,47,48,50,51,55,57,59,60,62,63,67,69,71,72,74,75,79,81,83,84,86,87,91,93,95,96,98,99,103];
var IonianSharp5:Array =[45,47,48,50,52,53,56,57,59,60,62,64,65,68,69,71,72,74,76,77,80,81,83,84,86,88,89,92,93,95,96,98];
var JazzMinor:Array =[45,47,48,50,51,53,55,57,59,60,62,63,65,67,69,71,72,74,75,77,79,81,83,84,86,87,89,91,93,95,96,98];
var Lydian:Array =[45,47,48,50,52,54,55,57,59,60,62,64,66,67,69,71,72,74,76,78,79,81,83,84,86,88,90,91,93,95,96,98];
var Major:Array =[43,45,48,50,51,52,54,55,57,60,62,63,64,66,67,69,72,74,75,76,78,79,81,84,86,87,88,90,91,93,96,98];
var Mixolydian:Array =[45,46,48,50,52,53,55,57,58,60,62,64,65,67,69,70,72,74,76,77,79,81,82,84,86,88,89,91,93,94,96,98];
var Oriental:Array =[45,46,48,49,52,53,54,57,58,60,61,64,65,66,69,70,72,73,76,77,78,81,82,84,85,88,89,90,93,94,96,97];
var SuperLocrian:Array =[44,46,48,49,51,52,54,56,58,60,61,63,64,66,68,70,72,73,75,76,78,80,82,84,85,87,88,90,92,94,96,97];
var VerdiEnigmaticAscending:Array =[46,47,48,49,52,54,56,58,59,60,61,64,66,68,70,71,72,73,76,78,80,82,83,84,85,88,90,92,94,95,96,97];
var Zirafkend:Array =[48,50,51,53,55,56,57,59,60,62,63,65,67,68,69,71,72,74,75,77,79,80,81,83,84,86,87,89,91,92,93,95];

I’ve also put the code up on Wonderfl – so you can use it straight from your browser.

Be Sociable, Share!

3 Responses to Musical Scales as midi note numbers.

Avatar

daniel

May 28th, 2011 at 2:18 am

thank you!!

Avatar

jorge

May 28th, 2012 at 5:18 pm

this is incredible! I am working on something different, but related, and stumbled upon your work, super great to see how you are going about it. My thing will construct scales chosen by preset based on a fundamental input by the user, who will be me. There will be other parameters such as note length and density that can be set up as well. Then when another scale is selected a modulation will begin by note replacement, again with musical parameters I can input regarding how fast notes are replaced and the like. Maybe common tones will be selected and used as pedal tones, but I haven’t thought through how to do that yet.

Anyway, its great to see your work and I think that pdf will be a fantastic resource, thanks!

Avatar

Lawrie

May 28th, 2012 at 5:28 pm

Glad you found it useful Jorge. Good luck with your project. I’ll keep an eye on your blog to see what you make :)

Comment Form

About this blog

This is the blog of Lawrie Cape, an interactive developer from Leeds, England.

Photostream

  • Joe: But the problem of your flash midi server is: Don't receive other than your sendNote and sendCC or [...]
  • kristin collins: I'm addicted to Blockade!!! Great Game thanks! [...]
  • Vincent: It's been a long time since this got posted, but I just stumbled upon it and couldn't help but notic [...]
  • Lawrie: Para eliminar elementos en blanco, tendrá que utilizar la función superior (para asegurarse de que [...]
  • Jemerson: como faço para remover campos vazios dinamicamente exeplo: ['a',' b','c' ,' ','e',' '] resul [...]