diff --git a/src/routes/tools/chord-finder/+page.svelte b/src/routes/tools/chord-finder/+page.svelte index 5cc6801..6f27179 100644 --- a/src/routes/tools/chord-finder/+page.svelte +++ b/src/routes/tools/chord-finder/+page.svelte @@ -14,11 +14,13 @@
- { - updateFingerPosition({ fret, line }); - }} - > +
+ { + updateFingerPosition({ fret, line }); + }} + > +
diff --git a/src/routes/tools/chord-finder/Board.svelte b/src/routes/tools/chord-finder/Board.svelte index d149065..721a117 100644 --- a/src/routes/tools/chord-finder/Board.svelte +++ b/src/routes/tools/chord-finder/Board.svelte @@ -1,46 +1,69 @@ -{#if chords != undefined} - {#each chords.chords as chord} -
- +
+ {#if chords != undefined} + {@const primaryChord = chords.chords.at(0)} +
+ {#if primaryChord} +
+ +
+ {/if} +
+ {#each chords.chords.slice(1) as chord, idx} + {#if idx === 0} +
+ +
+ {:else} +
+ +
+ {/if} + {/each} +
- {/each} -{/if} -

+ {/if} +

+ + diff --git a/src/utils/music/chords.ts b/src/utils/music/chords.ts index d73aa30..da2b253 100644 --- a/src/utils/music/chords.ts +++ b/src/utils/music/chords.ts @@ -45,12 +45,10 @@ export function identifyChordsFromPitches(pitches: Pitch[]) { const numberedNotes = [ ...new Set(pitches.map((pitch) => ((numberingPitch(pitch) % 12) + 12) % 12)) ].toSorted(); - console.log(numberedNotes); for (const root of numberedNotes) { const intervals = new Set( numberedNotes.map((n) => (n >= root ? n - root : n - root + 12)).filter((n) => n !== 0) ); - console.log([...intervals]); identifiedChords.push(identifyChordFromIntervals(bassNumber, root, intervals)); } identifiedChords.sort( @@ -103,7 +101,6 @@ function identifyChordFromIntervals( // now we found 3rd! it's very critical to determine its quality if (third !== bassInterval) { - console.log(third, bassInterval); intervals.delete(bassInterval); intervals.delete(bassInterval + 12); }