File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -885,7 +885,19 @@ class SoundFile {
885
885
return this . playbackRate ;
886
886
}
887
887
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
+ */
889
901
setPitch ( num ) {
890
902
var newPlaybackRate = midiToFreq ( num ) / midiToFreq ( 60 ) ;
891
903
this . rate ( newPlaybackRate ) ;
You can’t perform that action at this time.
0 commit comments