Skip to content

Instantly share code, notes, and snippets.

@thall1961

thall1961/notes.js

Created Dec 7, 2018
Embed
What would you like to do?
convert array values
var chordArrays = [
{
'chord type': 'minor',
inversion: 'root',
chords: [
{
'scale degree': 'II',
notes: [1, 3, 5]
},
{
'scale degree': 'III',
notes: [2, 4, 6]
},
{
'scale degree': 'VI',
notes: [5, 0, 2]
}
]
},
{
'chord type': 'minor',
inversion: 'first',
chords: [
{
'scale degree': 'II',
notes: [3, 5, 1]
},
{
'scale degree': 'III',
notes: [4, 6, 2]
},
{
'scale degree': 'VI',
notes: [0, 2, 5]
}
]
}
];
var scale = ['c', 'd', 'e', 'f', 'g', 'a', 'b'];
chordArrays.forEach(o => {
o.chords.forEach(n => {
n.notes = n.notes.map(i => (i = scale[i]));
});
});
console.log(chordArrays);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.