Skip to content

Commit f9604c9

Browse files
authored
Merge pull request #694 from Nitesh639/setPitch
documentation of setPitch method
2 parents a3ee4b3 + 132fac5 commit f9604c9

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/soundfile.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,19 @@ class SoundFile {
885885
return this.playbackRate;
886886
}
887887

888-
// TO DO: document this
888+
/**
889+
* Pitch of a sound file can be changed by providing a MIDI note number.
890+
* It will change the pitch and also the speed.
891+
* If the input note is 60 (middle C), then frequency and speed is normal.
892+
* If we increase the note input, then frequency and speed increases,
893+
* and if we decrease the note input, then frequency and speed decreases.
894+
*
895+
* @method setPitch
896+
* @for p5.SoundFile
897+
* @param {Number} pitchRate If the MIDI note is increased, then both the
898+
* frequency of the sound and its playback speed
899+
* will increase as a result.
900+
*/
889901
setPitch(num) {
890902
var newPlaybackRate = midiToFreq(num) / midiToFreq(60);
891903
this.rate(newPlaybackRate);

0 commit comments

Comments
 (0)