i am trying to create music major scale converter. Dose anyone have info how do to it
so far i have
rootNote is scale base note like cMajor or gMajor note is note that i want to convert into major scale 0-126 if i insert rootNote 60 and note 60 the right return would be 0, if i insert rootNote 60 and note 61 the right return would be 2, if i insert rootNote 60 and note 62 the right return would be 4, if i insert rootNote 60 and note 63 the right return would be 5,
if i insert rootNote 61 and note 60 the right return would be 0, if i insert rootNote 61 and note 61 the right return would be 1, if i insert rootNote 61 and note 62 the right return would be 3, if i insert rootNote 61 and note 63 the right return would be 5,
ok i have this other one and it seems to work i want to map my sequence out put in major scale but is there some kind of formula what can i use?
.
public int getINMajorScale(int note, int rootNote)
{
List<int> majorScale = new List<int>();
//int bNote = (int)_bNote.CurrentValue;
int bNoteMpl = bNote / 12;
bNote = 12 + (bNote - (12 * bNoteMpl)) - 7;
majorScale.Add(bNote + (12 * bNoteMpl));
int tBnote = bNote;
int res = 0;
for (int i = bNote; i < bNote + 6; i++)
{
//algorytm
res = tBnote + 7;
int mod = 0;
if (res >= 12)
{
mod = res / 12;
res = res - 12 * mod;
}
tBnote = res;
majorScale.Add(res + (bNoteMpl * 12));
}
majorScale.Sort();
int modNuller = 0;
if (nmr >= 7)
{
modNuller = nmr / 7;
nmr = nmr - 7 * modNuller;
}
return (majorScale[nmr] + (modNuller *12));
}
but it's obviously faulty.