Skip to content

Commit

Permalink
musicxml harmony full chord notes
Browse files Browse the repository at this point in the history
  • Loading branch information
fabricelacharme committed Jan 3, 2025
1 parent c66526a commit 98eb9e1
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 31 deletions.
60 changes: 34 additions & 26 deletions KMusicXml/MusicXml/Domain/Chord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,82 +40,86 @@ internal Chord()
public List<int> GetNotes(int notenumber)
{

List<int> l = new List<int>();
List<int> l = new List<int>();
if (notenumber >= 72)
notenumber -= 12;

l.Add(notenumber);

List<int> ln = new List<int>();

switch (Kind)
{
case "augmented":
ln = new List<int>() { 0, 4, 8};
ln = new List<int>() { 4, 8};
break;
case "augmented-seventh":
ln = new List<int> { 0, 4, 8, 11, 14};
ln = new List<int> { 4, 8, 11, 14};
break;
case "diminished":
ln = new List<int>() { 0, 3, 6};
ln = new List<int>() { 3, 6};
break;
case "diminished-seventh":
ln = new List<int> { 0, 3, 6, 9, 10};
ln = new List<int> { 3, 6, 9, 10};
break;
case "dominant":
ln = new List<int> { 0, 4, 7, 10};
ln = new List<int> { 4, 7, 10};
break;
case "dominant-11th":
ln = new List<int> { 0, 4, 7, 10, 2, 6};
ln = new List<int> { 4, 7, 10, 2, 6};
break;
case "dominant-13th":
ln = new List<int> { 0, 4, 7, 10, 2, 6, 9};
ln = new List<int> { 4, 7, 10, 2 };
break;
case "dominant-ninth":
ln = new List<int> { 0, 4, 7, 10, 2};
ln = new List<int> { 4, 7, 10, 2 };
break;
case "French":
break;
case "German":
break;
case "half-diminished":
ln = new List<int> { 0, 3, 6, 10};
ln = new List<int> { 3, 6, 10};
break;
case "Italian":
break;
case "major":
ln = new List<int>() { 0, 4, 7};
ln = new List<int>() { 4, 7 };
break;
case "major-11th":
ln = new List<int> { 0, 4, 7, 11, 2, 6};
ln = new List<int> { 4, 7, 11, 2 };
break;
case "major-13th":
ln = new List<int> { 0, 4, 7, 11, 2, 6, 9};
ln = new List<int> { 4, 7, 11, 2 };
break;
case "major-minor":
break;
case "major-ninth":
ln = new List<int> { 0, 4, 7, 11, 2};
ln = new List<int> { 4, 7, 11, 2 };
break;
case "major-seventh":
ln = new List<int> { 0, 4, 7, 11};
ln = new List<int> { 4, 7, 11};
break;
case "major-sixth":
ln = new List<int> { 0, 4, 7, 9};
ln = new List<int> { 4, 7, 9};
break;
case "minor":
ln = new List<int>() { 0, 3, 7 };
ln = new List<int>() { 3, 7 };
break;
case "minor-11th":
ln = new List<int> { 0, 3, 7, 10, 2, 6};
ln = new List<int> { 3, 7, 10, 2, 6};
break;
case "minor-13th":
ln = new List<int> { 0, 3, 7, 10, 2, 6, 9};
ln = new List<int> { 3, 7, 10, 2, 6, 9};
break;
case "minor-ninth":
ln = new List<int> { 0, 3, 7, 10, 2};
ln = new List<int> { 3, 7, 10, 2};
break;
case "minor-seventh":
ln = new List<int> { 0, 3, 7, 10};
ln = new List<int> { 3, 7, 10};
break;
case "minor-sixth":
ln = new List<int> { 0, 3, 7, 9};
ln = new List<int> { 3, 7, 9};
break;
case "Neapolitan":
break;
Expand All @@ -126,23 +130,27 @@ public List<int> GetNotes(int notenumber)
case "pedal":
break;
case "power":
ln = new List<int> { 0, 7 };
ln = new List<int> { 7 };
break;
case "suspended-fourth":
ln = new List<int> { 0, 5, 7 };
ln = new List<int> { 5, 7 };
break;
case "suspended-second":
ln = new List<int> {0, 2, 7};
ln = new List<int> { 2, 7};
break;
case "Tristan":
break;
default:
break;
}

int n;
for (int i = 0; i < ln.Count; i++)
{
l.Add(ln[i] + notenumber);
n = ln[i] + notenumber;
if (n >= 72)
n -= 12;
l.Add(n);
}

return l;
Expand Down
10 changes: 5 additions & 5 deletions KMusicXml/ReaderXml/MusicXmlReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ public Sequence Load(MusicXml.Domain.Score SC)
if (lnotes.Count == 0)
Console.WriteLine("");
*/

/*
CreateMidiNote1(note, notenumber, starttime);
if (lnotes.Count > 1)
CreateMidiNote1(note, lnotes[1] - 12, starttime);
Expand All @@ -475,12 +475,12 @@ public Sequence Load(MusicXml.Domain.Score SC)
CreateMidiNote1(note, lnotes[3] - 12, starttime);
if (lnotes.Count > 4)
CreateMidiNote1(note, lnotes[4] - 12, starttime);
/*
for (i = 0; i < lnotes.Count; i++)
*/
for (int idx = 0; idx < lnotes.Count; idx++)
{
CreateMidiNote1(note, lnotes[i], starttime);
CreateMidiNote1(note, lnotes[idx], starttime);
}
*/


// Create Bass
note = new Note();
Expand Down

0 comments on commit 98eb9e1

Please sign in to comment.