How do I make each sound file play separately on different screens? p5

I have 8 seperate sound files for 8 different screens (Want to play the first one for screen 1, the second one for screen 2 etc), however it's playing them all at once in every screen?

Currently I have this in a function called chooseSong(); (for all 8 sound files):

if(screen === 1){
} else {song1.stop();

if(screen === 2){
} else {song2.stop();

What am I doing wrong lol, I'm just a beginner with p5 so I have no clue :)

Sign In or Register to comment.