How to Play Audio Files (Sound Effects and Music) in Python Using Pygame (Mp3 and Others)

Поделиться
HTML-код
  • Опубликовано: 11 янв 2025

Комментарии • 19

  • @FabioMusanni
    @FabioMusanni  Год назад

    💻 *Source Code + mp3 Files:* www.buymeacoffee.com/fabiomusanni/e/183129
    ☕ *Buy me a coffee:* www.buymeacoffee.com/fabiomusanni
    😍 *One-off donation:* www.paypal.me/FabioMusanni/
    ⬇️ *LEARN ON THE BEST LEARNING PLATFORMS* 😉💪 ⬇️
    *SKILLSHARE*
    _(Python, Web Dev, UI/UX Design, Music, Art, Animation and a lot more)_
    🔗 skillshare.eqcm.net/5gxzD2 (Affiliate)
    *DATACAMP*
    _(Python, ChatGPT, SQL, Power BI, and a lot more)_
    🔗 datacamp.pxf.io/vN1bDj (Affiliate)
    *COURSERA PYTHON*
    _(For beginners, Data Science, Data Analysis, AI, Cybersecurity and a lot more):_
    🔗 imp.i384100.net/k0Nk60 (Affiliate)
    *COURSERA WEB DEVELOPMENT*
    _(Full Stack, Front-End, Back-End, Web Design and a lot more):_
    🔗 imp.i384100.net/EKWxBW (Affiliate)
    Thank you for the support!❤
    🎥All my videos about Python: ruclips.net/p/PLs8qUrmRvaR0IT4IwJl-LSweAdACW-yLK

  • @maiktester5085
    @maiktester5085 11 месяцев назад +1

    Great Video, thanks for the help

    • @FabioMusanni
      @FabioMusanni  11 месяцев назад +1

      Thank you! Glad the video helped! 💪😊

  • @gemmalacdao
    @gemmalacdao 8 месяцев назад +2

    how to add background music in your game?😢

  • @STARBASS-Thema
    @STARBASS-Thema 6 месяцев назад

    Thanks, for this video. Now Pygame runs very well.

    • @FabioMusanni
      @FabioMusanni  6 месяцев назад +1

      Glad to hear that! 😍💪

  • @Manishincode
    @Manishincode 7 месяцев назад

    Best video on yt..

  • @ars44pro
    @ars44pro 7 месяцев назад

    the best video-instruction!!!!!!!!!!

    • @FabioMusanni
      @FabioMusanni  7 месяцев назад

      Glad you liked it, thank you for the comment! 💪😍

  • @RenRuin
    @RenRuin Год назад

    Thanks for this video. Really helped me figure out what I was doing wrong.

    • @FabioMusanni
      @FabioMusanni  Год назад

      Thank you for the comment! 😍 I'm glad the video helped you shed some light on the topic 🤗💪

  • @andrewthomas3467
    @andrewthomas3467 9 месяцев назад

    is there a way to have a sound keep repeatedly playing without having to manually enter an input?

    • @FabioMusanni
      @FabioMusanni  9 месяцев назад

      When you call "play", there should be an option called "loops", if you set that to -1 the sound will keep looping. I think I mentioned that somewhere in the video.

  • @bitterbaI
    @bitterbaI 8 месяцев назад

    my game over music keeps repeating even tho i added the loop = 0. im so stuck

    • @mysterypotionx
      @mysterypotionx 8 месяцев назад

      Maybe you are looping the play command

    • @gunre0n
      @gunre0n 7 месяцев назад

      don't write anything in the brackets instead of the 'loops = 0' :d

  • @minecrafttiger6198
    @minecrafttiger6198 Год назад +1

    Whenever music is in my while true loop it never plays

    • @FabioMusanni
      @FabioMusanni  Год назад

      Hello 😊
      If the code is the same, it's impossible it doesn't work, check carefully the indentation and the code itself.

    • @comingsoon578
      @comingsoon578 10 месяцев назад

      @@FabioMusanni I don't know why your code didn't worked for me, but it solved by doing this:
      mixer.init()
      sound = mixer.Sound('your_sound.mp3')
      sound.play()
      sleep(5)