@@ -80,7 +80,6 @@ export default class notePlayer {
8080 const steps = this . temperament * Math . log2 ( frequency / this . concert_pitch ) ;
8181 return Math . round ( steps ) ;
8282 }
83-
8483 getNoteNameFromSteps ( steps : number ) {
8584 const octave =
8685 Math . floor ( steps / this . temperament ) + this . CONCERT_PITCH_OCTAVE ;
@@ -90,31 +89,13 @@ export default class notePlayer {
9089 this . temperament ;
9190 return `${ this . noteNames [ noteIndex ] } ${ octave } ` ;
9291 }
93-
94- getLowestStep ( ) {
95- const step = - this . temperament * this . CONCERT_PITCH_OCTAVE ;
96- return step ;
97- }
98- getLowestFrequency ( ) {
99- const step = this . getLowestStep ( ) ;
100- const frequency = this . getFrenquencyFromSteps ( step ) ;
101- return frequency ;
102- }
103- getLowestMetrics ( ) {
104- return { step : this . getLowestStep ( ) , frequency : this . getLowestFrequency ( ) } ;
105- }
106-
10792 getFrequencyFromNoteName ( noteFullName : string ) {
108- console . log ( "Incoming noteFullName:" , noteFullName ) ;
109-
11093 const match = noteFullName . match ( this . noteNameRegex ) ;
111- console . log ( noteFullName , match ) ;
11294 if ( ! match ) {
11395 throw new Error ( "Invalid note format" ) ;
11496 }
11597
11698 const [ , noteLetter , sharp , octaveStr ] = match ;
117-
11899 const noteName = `${ noteLetter } ${ sharp } ` ;
119100 const octave = Number ( octaveStr ) ;
120101
@@ -129,4 +110,16 @@ export default class notePlayer {
129110 const frequency = this . getFrenquencyFromSteps ( steps ) ;
130111 return frequency ;
131112 }
113+ getLowestStep ( ) {
114+ const step = - this . temperament * this . CONCERT_PITCH_OCTAVE ;
115+ return step ;
116+ }
117+ getLowestFrequency ( ) {
118+ const step = this . getLowestStep ( ) ;
119+ const frequency = this . getFrenquencyFromSteps ( step ) ;
120+ return frequency ;
121+ }
122+ getLowestMetrics ( ) {
123+ return { step : this . getLowestStep ( ) , frequency : this . getLowestFrequency ( ) } ;
124+ }
132125}
0 commit comments