Skip to content

Commit 3a26014

Browse files
committed
added getPitch() function
1 parent 6e30d73 commit 3a26014

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/soundfile.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,10 @@ class SoundFile {
902902
var newPlaybackRate = midiToFreq(num) / midiToFreq(60);
903903
this.rate(newPlaybackRate);
904904
}
905+
getPitch() {
906+
var freqValue = this.rate() * midiToFreq(60);
907+
return freqToMidi(freqValue);
908+
}
905909

906910
/**
907911
* Returns the current playback rate of a sound file.

0 commit comments

Comments
 (0)