Playing Music in Background

My students like to do complex projects - I’ve had trouble with the sound before (anyone else?) and had a hard time debugging. My student would really like help with this one, and it’s driving me crazy too.

Link to the project or level: Final Lesson 22 Project

What I expect to happen: She wants the music to play in the background the whole time we’re playing the game.

What actually happens: It just doesn’t play at all.

What I’ve tried: She made sure the music was under 5 minutes long, it’s MP3 format, she put both inside and outside the draw loop, she tried reuploading it again and again, she added a simple sound outside of the draw loop and that played properly (inside the draw loop it played repeatedly).

Begging for help! Thx in advance.

Just realized there was a “record” function. I messaged her to try this out. I tested it out with a short clip and it works. We’ll see if her version works next class.

I’m still wondering why hers isn’t working though?

Hi @emily.kosmack,

I tried it out myself too – I was able to get her code to work with the sample sounds from the playSound documentation but not the one she uploaded. Does that same sound work if she plays it from the source?

I did notice she does not have her second parameter set (whether or not it should loop) but playing with this didn’t seem to influence whether it worked. My guess is the original sound file might be corrupted or otherwise incompatible but I’m not sure. Can you put a link to the sound she’s using in here so we can play around with it?

Thanks,
–Michael K.

One other thought – is this a song from iTunes, Google Play, or something like that? Some of those stores have DRM on the files that prevents it from playing through other players.

Thanks so much for the reply. I think she recorded it with QuickTime from YouTube? I don’t know anything about DRM really - would that affect it? I was thinking that might have something to do with it.

Also, what do you think about using Copyrighted music/images in their code? I let them (Fair Use) and have them cite the song in their code.

My understanding is that DRM would prevent it from playing through an unauthorized player (sort of like how the Print Screen button is disabled when Netflix is open on your computer). Not sure whether QuickTime would fall under that umbrella; it was just a thought if she were uploading directly from iTunes.

As far as copyrighted music & images, I usually tend to err on the side of caution. I’m not a legal expert and so I don’t want to say “go for it!”; however, I applaud that you’re having them cite the original authors/creators in the code. Some of what’s covered in Unit 2 Lesson 7 would apply here as well.

–Michael K.