Skip to content

Commit 8ec7172

Browse files
committed
hotfix
- removed console.logs - changed `getFrequencyFromNoteName`()` function position
1 parent 1bf656d commit 8ec7172

File tree

2 files changed

+13
-20
lines changed

2 files changed

+13
-20
lines changed

dist/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ declare class notePlayer {
2121
getFrenquencyFromSteps(steps: number): number;
2222
getStepsFromFrequency(frequency: number): number;
2323
getNoteNameFromSteps(steps: number): string;
24+
getFrequencyFromNoteName(noteFullName: string): number;
2425
getLowestStep(): number;
2526
getLowestFrequency(): number;
2627
getLowestMetrics(): {
2728
step: number;
2829
frequency: number;
2930
};
30-
getFrequencyFromNoteName(noteFullName: string): number;
3131
}
3232

3333
export { notePlayer as default };

src/index.ts

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)