diff --git a/src/lib/chordAudio.js b/src/lib/chordAudio.js index 2f87a75..452faf0 100644 --- a/src/lib/chordAudio.js +++ b/src/lib/chordAudio.js @@ -264,7 +264,7 @@ export function guitarShapeToNotes(shape, opts = {}) { * Simple fallback when all you have is a bare pitch-class set (e.g. a detected * chord's tones, no voicing). Stacks the pcs ASCENDING from the first pc, which * is treated as the bass: each subsequent pc lands in the nearest position - * above the previous note — so [7, 11, 5] plays G3-B3-F4, a real shell, not a + * above the previous note — so [7, 11, 5] plays G4-B4-F5, a real shell, not a * scrambled cluster. `octave` places the bass (4 = the octave starting at * C4 = middle C; default 4; piano.js note = (octave − 3) * 12 + pc). * diff --git a/src/lib/voicings.js b/src/lib/voicings.js index 0e07e03..1644bb9 100644 --- a/src/lib/voicings.js +++ b/src/lib/voicings.js @@ -504,8 +504,11 @@ export function getGuitarVoicings(chordName) { continue } - // barre shape: compute rootFret on rootStr - const strIdx = shape.rootStr - 1 // 0=s6 … 5=s1 + // barre shape: compute rootFret on rootStr. + // OPEN is ordered [s6 … s1] and rootStr is 1-indexed with 6 = low E, + // so string N lives at index 6 - N (same convention as ChordDiagram.jsx + // and chordAudio.guitarShapeToNotes). + const strIdx = 6 - shape.rootStr // 0=s6 … 5=s1 const openPc = OPEN[strIdx] let rootFret = (rootPc - openPc + 12) % 12