Day 026 - Project 26 : MyPod Music Player

If you have any questions, comments or issues with this project please post them here!

Used @Replit’s cool audio feature to build an iPod and listen to some tunes :musical_note:!!!

https://replit.com/@JackAdem/Day-026-Project-26-MyPod-Music-Player?v=1

Day 26 of #Replit100DaysOfCode #100DaysOfCode.

1 Like

from replit import audio doesn’t work for me in this project and in other projects; it only worked the first time I ran the program. I’m doing nothing wrong, does anyone know what’s wrong with the module?

Replit audio is known to be buggy. Personally, I just skipped this day.

1 Like

Hello. It’s me again and in need of help. This challenge is a lot more confusing and difficult than I thought. I have no idea if I’m following the instructions and hints correctly or not.

Here are David’s instructions: https://replit.com/@wittphoonsiri/day26100-days-of-code

:point_right: Day 26 Challenge

Play a song from this repl and build a menu to go with it. Make it look like an iPod!

  • Use a while true loop to create a title for a music player.
  • Allow the user to select to play a song and use subroutine called ‘play’ when they select the song.
  • Give the user the option to exit the program.
  • The title should pop up and pause along with the menu options.
  • If the user chooses anything else, start again by clearing the screen

Hint:

  • Import your libraries first.
  • With the sample code above, think about what code can be added to pause and play the audio.
  • What command do you need to use to return (hint, hint) to the main menu (subroutine)?
  • Create a while True loop that clears the code and pauses the code. What libraries would you need for these things to happen?
  • You may also need if statements within your loop.

Anyway here’s the code. Am I doing this right? What I am missing here?

from replit import audio
import os, time

def play():
  source = audio.play_file('audio.wav')
  source.paused = False # unpause the playback
  while True:
      MusicTitle = input("what's the title of the music player?:")
      print(MusicTitle)
      if MusicTitle == "MyIPod":
        print("Hello. Let's go to the menu.")
      else:
        print("Invalid")
        break
      return MusicTitle

MusicTitle = play()

    # Start taking user input and doing something with it

while True:
  print("clear the screen")
  time.sleep(2)
  os.system("clear")
  print("show the menu")
  Menu = input("Press 1 to Play. Press 2 to Exit. Press anything else to see the menu again:") 
  print(Menu)
  if Menu == "1": 
    print("okay")
    play()
  elif Menu == "2":
    print("Ok, exit")
    exit()
  else:
    print("ok back to menu.")
    continue
  # clear the screen 
  # Show the menu
  # take user's input
  # check whether you should call the play() subroutine depending on user's input```

Day 026 provides code for the play() subroutine. Within this is a reference to an audio.play_file(‘audio.wav’).

Where is audio.wav stored? I assume this audio file is attached to the lesson in some way similar to main.py. I’m not clear where I can visualize and interact with it. Or for example, if I were to extend the lesson it would be nice to load additional custom audio files to further play with the code.

It’s possible there’s a button to click in replit or a setting. Based on lessons up until this point I’m unclear where to access this.

In terms of constructive improvement it would be nice for an additional tab on this lesson informing the student that there are additional custom resources for that lesson and remind them how to visibly view and interact with files.

Hi @d77graham , welcome to the forums!
The audio.wav file should be upooaded into Replit and put into the same directory (in this case, the base directory [1]). Make sure the name and file type is the same!
Hope this helps!


  1. Not in any folder ↩︎

Hey @NateDhaliwal, this file is already provided in the day 26 Repl for you. (Just might not know it’s there since the file tree is hidden)

1 Like