I am making a music player on p5 with pose detection. If a person is in front of the cam, the music will be played as “normal”. If no one is in front of the cam, the music will be played as “distance away”.

image.png

There is a green frame tracking the person’s left eye in cam.

There are two versions of the same song playing on p5 simultaneously. music1 and music2.

Music1 is the normal version; music2 comes with a “telephone filter,” so it sounds like a distance away.

If a person is detected in cam, music 1 will have volume while music 2 will be muted.

If there is no detection of a person in cam, music 1 will be muted while music 2 will have volume.

Pose detection code comes from Coding Train.

Pose detection if statement:

image.png

If poses.length > 0, meaning a pose is detected, then mute music 2.

Else mute music 1.