@@ -222,6 +222,7 @@ export const getChordPositions = (chord: string) => {
222222 }
223223
224224 if ( f . interval === "5" ) {
225+ if ( isAug7 ) return { ...f , interval : "#5" , fret : 8 } ;
225226 if ( isAug ) return { ...f , interval : "#5" , fret : 8 } ;
226227 if ( isDim ) return { ...f , interval : "♭5" , fret : 6 } ;
227228 return f ;
@@ -232,7 +233,6 @@ export const getChordPositions = (chord: string) => {
232233
233234 // 7th
234235 if ( isAug7 ) {
235- baseFrets . push ( { interval : "#5" , fret : 8 } ) ;
236236 baseFrets . push ( { interval : "♭7" , fret : 10 } ) ;
237237 } else if ( isMaj7 ) {
238238 baseFrets . push ( { interval : "7" , fret : 11 } ) ;
@@ -288,10 +288,13 @@ export const getInterval = (chord: string, targetPitch: string) => {
288288 const targetName = targetPitch . replace ( / \d + $ / , "" ) ;
289289 const root = getRootNote ( chord ) ;
290290 const pitches = pitchMap [ root ] ;
291+ // ルート音がpitchMapにない場合はフォールバック
292+ if ( ! pitches ) return "" ;
291293 const index = pitches . findIndex ( ( pitch ) => {
292294 const names = pitch . split ( "/" ) . map ( ( p ) => p . replace ( / \d + $ / , "" ) ) ;
293295 return names . includes ( targetName ) ;
294296 } ) ;
297+ if ( index === - 1 ) return "" ;
295298 const intervalMap : { [ key : number ] : string } = {
296299 0 : "1" ,
297300 1 : "♭2" ,
@@ -306,6 +309,5 @@ export const getInterval = (chord: string, targetPitch: string) => {
306309 10 : "♭7" ,
307310 11 : "7" ,
308311 } ;
309- const interval = intervalMap [ index ] || "" ;
310- return interval ;
312+ return intervalMap [ index ] ?? "" ;
311313} ;
0 commit comments