Sixteen Hours
That's approximately how long it took for me to figure out how to code so that my repl would play audio along with my image (sort of.) But the journey there is worth noting, along with the anxiety and laser focus and eureka moment which came on Monday morning at 4am.
Let me start with my reaction to receiving the assignment via Moodle that I was to expand my "current Python code to include actual sound files." [Gulp!]. I had already gone down that rabbit hole the week before and failed miserably. My professor gave me this suggestion:
This was the avenue I had tried last week...unsuccessfully.
If you are feeling like it, you could also try to have the playing of the sounds triggered to certain events in your program. For example, one sound file plays when a turtle is at a particular x,y position.
🤣
OK...I'm not one to back down to a challenge! Determined to, at the very least, have music play while my Musical Moment image was unfurling, I began to Google in earnest.
I began with Playsound...again. But what is Playsound?
Playsound is a platform that I needed to install but first needed install a pip. Ugh! What's a pip?
Oh! So Python already has a pip? Damned if I could find it and when I tried to code to install Playsound on my Main.py...
This sent me down the path of looking up "what is a ParseError?" "what is a bad token?" "what is a module?", etc.
There's an 1950s rom com called Born Yesterday starring Judy Holliday and Broderick Crawford about a woman whose boorish husband decides she's not smart enough and gives William Holden the task of 'smarting her up'. He gives her a small dictionary to circle in red and look up every word in the newspaper that she doesn't understand. The joke is, of course, that by the time she's done with the paper, almost every word is circled and she has no overarching comprehension of anything she's read. That's how I was feeling by the time I got to...
Undaunted, I googled further and discovered that I was not the only one who had difficulties in playing audio on Python/Turtles. I found many comments from frustrated coders. Codegrepper.com offered several options to click into and I jumped in!
I chose how to play music in Python and got these options...
- make music with python
- how to add music python
- music player python code
- how to put music in python
- python making music
- can i use python sound to play music
- python web music player
- code music in python
- making music with python
- music with python
- python music
- create music using python
- python playing sound not working
- music python
Recognition. At least the .wav audio file that I had successfully put into the Files was recognized by the program...though it wouldn't play the music. And it also wouldn't run my image which it HAD, prior to my adding the audio player. (Audible sigh.)
January,
ReplyDeleteAs usual, you were incredibly persistent, resilient, and resourceful in making this work. And I love the Born Yesterday allusion.
Could you share a link to your Replit? I would love to see your code.
Hi Dr. A, Here ya go...https://replit.com/@akselradJ/GonnaGetMusic. Much to discuss during class :) . J
DeleteThis comment has been removed by the author.
ReplyDelete