Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
notesForChord(root, shape, blockStart, blockStop) {
let maxPitch = this.minPitchInRange(blockStart, blockStop)
let chordRoot = this.rootBelow(root, maxPitch)
let chordNotes = Chord.notes(chordRoot, shape)
if (parseNote(chordNotes[2]) > maxPitch) {
chordRoot = addInterval(chordRoot, -OCTAVE_SIZE)
chordNotes = Chord.notes(chordRoot, shape)
}
let rate = this.options.rate || 1
let bpm = this.song.metadata.beatsPerMeasure || 2
let out = []
this.inDivisions(blockStart, blockStop, 1 + rate, (start, stop, k) => {
if (k % bpm == 0) {
// root on beat
out.push(
new SongNote(chordNotes[0], start, stop - start)
)
} else {
// 5 on everything else
out.push(
it("gets notes for dominant 7 chord", function() {
expect(Chord.notes("C5", "7")).toEqual([
"C5", "E5", "G5", "A#5"
])
expect(Chord.notes("C5", "7", 1)).toEqual([
"E5", "G5", "A#5", "C6"
])
})
it("gets notes for dominant 7 chord", function() {
expect(Chord.notes("C5", "7")).toEqual([
"C5", "E5", "G5", "A#5"
])
expect(Chord.notes("C5", "7", 1)).toEqual([
"E5", "G5", "A#5", "C6"
])
})
it("gets notes for major chord", function() {
expect(Chord.notes("C5", "M")).toEqual([
"C5", "E5", "G5"
])
expect(Chord.notes("C5", "M", 1)).toEqual([
"E5", "G5", "C6"
])
expect(Chord.notes("C5", "M", -1)).toEqual([
"G4", "C5", "E5"
])
expect(Chord.notes("C5", "M", -2)).toEqual([
"E4", "G4", "C5"
])
expect(Chord.notes("C5", "M", -3)).toEqual([
"C4", "E4", "G4"
])
})
it("gets notes for minor chord", function() {
expect(Chord.notes("C5", "m")).toEqual([
"C5", "D#5", "G5"
])
expect(Chord.notes("C5", "m", 1)).toEqual([
"D#5", "G5", "C6"
])
})
it("gets notes for major 7 chord", function() {
expect(Chord.notes("C5", "M7")).toEqual([
"C5", "E5", "G5", "B5"
])
expect(Chord.notes("C5", "M7", 1)).toEqual([
"E5", "G5", "B5", "C6"
])
expect(Chord.notes("C5", "M7", -1)).toEqual([
"B4", "C5", "E5", "G5"
])
expect(Chord.notes("C5", "M7", -2)).toEqual([
"G4", "B4", "C5", "E5"
])
expect(Chord.notes("C5", "M7", -3)).toEqual([
it("gets notes for minor 7 flat 5 chord", function() {
expect(Chord.notes("C5", "m7b5")).toEqual([
"C5", "D#5", "F#5", "A#5"
])
})
it("gets notes for major chord", function() {
expect(Chord.notes("C5", "M")).toEqual([
"C5", "E5", "G5"
])
expect(Chord.notes("C5", "M", 1)).toEqual([
"E5", "G5", "C6"
])
expect(Chord.notes("C5", "M", -1)).toEqual([
"G4", "C5", "E5"
])
expect(Chord.notes("C5", "M", -2)).toEqual([
"E4", "G4", "C5"
])
expect(Chord.notes("C5", "M", -3)).toEqual([
"C4", "E4", "G4"
])
})
it("gets notes for major 7 chord", function() {
expect(Chord.notes("C5", "M7")).toEqual([
"C5", "E5", "G5", "B5"
])
expect(Chord.notes("C5", "M7", 1)).toEqual([
"E5", "G5", "B5", "C6"
])
expect(Chord.notes("C5", "M7", -1)).toEqual([
"B4", "C5", "E5", "G5"
])
expect(Chord.notes("C5", "M7", -2)).toEqual([
"G4", "B4", "C5", "E5"
])
expect(Chord.notes("C5", "M7", -3)).toEqual([
"E4", "G4", "B4", "C5"
])
})
notesForChord(root, shape, blockStart, blockStop) {
let maxPitch = this.minPitchInRange(blockStart, blockStop)
let chordRoot = this.rootBelow(root, maxPitch)
let chordNotes = Chord.notes(chordRoot, shape)
let out = []
this.inDivisions(blockStart, blockStop, 3, (start, stop, k) => {
let d = (stop - start) / 2
let one = chordNotes[0]
let two = chordNotes[2]
if (parseNote(two) >= maxPitch) {
one = noteName(parseNote(chordNotes[2]) - 12)
two = chordNotes[0]
}
switch (k) {
case 0:
out.push(