The
getPan() function is an inbuilt function of p5.sound library that display the
pan() function effect. This function print the stereo pan position of the audio. This function can also be applicable without the pan() function.
Syntax:
getPan()
Note: All the sound-related functions only work when the sound library is included in the head section of the
index.html file.
Parameters: This function does not accept any parameter.
Return Values: This function return the stereo pan position of the playing audio. integer in minus form means left side more powerful sound and integer in plus form means right side more powerful.
Below examples illustrates the
p5.getPan() function in JavaScript:
Example 1: Without pan() function will calling getPan() function.
Output:
0 // balanced sound pan
Example : With pan() function will calling getPan() function.