Skip to content

Commit 4bbe4ef

Browse files
authored
Merge pull request #700 from Nitesh639/MidiConverter
added getPitch() function
2 parents 6e30d73 + 3a26014 commit 4bbe4ef

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)