How to loop music - Godot 3 tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 พ.ย. 2024
  • Sorry, but making this video was faster than writing a comment :P
    --------------- Ways to Support ---------------
    💝 Donate My Game: rafafiedo.itch...
    ☕️ Coffee: ko-fi.com/rafa...
    --------------- Useful links ---------------
    ✏ My Godot projects: github.com/rfi...
    --------------- Contact and social media ---------------
    💬 Discord: / discord
    🐝 Twitter: / rafafiedo
    ♫ Music channel: / rafafiedomusic
    ✉ Mail: fiedorowicz.rafal@gmail.com
    --------------- Timestamps ---------------
    0:02 start of tutorial on how to loop music
    0:13 Main part
    0:26 blabla
    Don't forget to leave a comment to let me know if you enjoyed this video, it's important for me! :)
    Hope you'll like it!
    #godot #tutorial

ความคิดเห็น • 43

  • @MagnusKlassik
    @MagnusKlassik 3 ปีที่แล้ว +10

    Thank you, exactly what I was looking for.

    • @RafaFiedo
      @RafaFiedo  3 ปีที่แล้ว

      Glad I could help!

  • @suchaluch5615
    @suchaluch5615 3 ปีที่แล้ว +1

    Superb!
    Quick explanation - respect!
    Thanks a lot!

    • @RafaFiedo
      @RafaFiedo  3 ปีที่แล้ว +1

      You're welcome!
      Didn't expect that short video will get so many views :P

  • @rickiousproductions
    @rickiousproductions ปีที่แล้ว +2

    Perfect thank you, just what this code monkey in training needed hahahaha

  • @beidero
    @beidero 4 ปีที่แล้ว +4

    I made something for my own project that may be interesting for other people related to this, I made a random sound player and a random music loop player. The idea of the random music loop player is that once one sound file finishes playing it will pick another random sound file in the list. This is great if you got a few clips that are interchangable for looping (in my project I got 4x30 second clips that can be looped in any order).
    These were made in C# (should be easy to translate to GD) though as that is what I program in, you can also find a SoundEffect.cs there which is something I made to make it easier to deal with sound effects, I don't have to care what type of player script I has as it detects the type of player I have and handles .Play() accordingly. It also allows me to have all my sound playing go through a single script so I can do some logic in there like limit how often stuff is played, etc...
    code can be found here,
    github.com/Beider/Beider

  • @anaquezia5532
    @anaquezia5532 8 หลายเดือนก่อน +1

    Thanks!

  • @_devcat3919
    @_devcat3919 3 ปีที่แล้ว +2

    Thanks man!

    • @RafaFiedo
      @RafaFiedo  3 ปีที่แล้ว

      Happy to help DevCat! :D

  • @rcgamesoficial2.011
    @rcgamesoficial2.011 ปีที่แล้ว +1

    Este é o melhor tutorial que eu já vi! Obrigado! Thanks!!!

    • @RafaFiedo
      @RafaFiedo  ปีที่แล้ว

      Haha, thanks :)

  • @DreXASK
    @DreXASK 3 ปีที่แล้ว +1

    Thank you.

    • @RafaFiedo
      @RafaFiedo  3 ปีที่แล้ว

      No problem :D

  • @Nanaquistillalive
    @Nanaquistillalive 4 ปีที่แล้ว +2

    I want to loop an audio file from a point... so when the audio is played the first time it starts from the beginning, and then, when it ends, the loop starts at another point of the track.
    I came with a solution witch is not precise.
    I used the signal "finished"
    and then in the function "on audio stream player finished" I coded: audiostreamplayer.start(0.714) which is the return value of the numbers of bars I have to offeset the song expressed in seconds.
    the problem is that this conversion is not precise... moreover, time conversions in godot round up to the 3rd decimal place... do you know any better way to solve this issue?

    • @RafaFiedo
      @RafaFiedo  4 ปีที่แล้ว +1

      Not sure what about seconds and precision, It was always enough for me, but you do not need to use signals for this. Maybe the conversion is not precision because you are using the signal and it connected to the engine render itself. Not sure.
      On the right side of the screen, you should have "Inspector" and values like "loop begin" "loop end" for .wav files and loop offset for .ogg files.

  • @entertainmentproduction279
    @entertainmentproduction279 3 ปีที่แล้ว +1

    nice, court et efficace. kiss

  • @JoJo-cy4tb
    @JoJo-cy4tb 3 ปีที่แล้ว +1

    excellent

    • @RafaFiedo
      @RafaFiedo  3 ปีที่แล้ว

      Thank you! Cheers!

    • @JoJo-cy4tb
      @JoJo-cy4tb 3 ปีที่แล้ว

      @@RafaFiedo if you have the time, im having trouble with my sprite animations. it looks like theyre fighting each other. how do i activate a single sprite animation while muting the others? thanks!

    • @RafaFiedo
      @RafaFiedo  3 ปีที่แล้ว

      Hi again JoJo :)
      are you using AnimatedSprite or Animation Player for this?

  • @stefanoexe
    @stefanoexe 3 ปีที่แล้ว +1

    i love u

  • @mrlonely420
    @mrlonely420 4 ปีที่แล้ว +2

    Can you make a tutorial for knockback 2d platformer ive been fking trying for weeks now, i cant get it to work

    • @RafaFiedo
      @RafaFiedo  4 ปีที่แล้ว +1

      something like... you attack monster with melee weapon and he is ... knockback? :D I see what I can do ;)

    • @KlausWulfenbach
      @KlausWulfenbach 4 ปีที่แล้ว

      That depends on how the physics work. Are you using kinematic bodies for the player and the enemy or are you using rigid bodies? Or are you using something else like Area2Ds? Way more context is needed, and you probably need to ask at the official Godot forums instead of the TH-cam comment section.
      godotforums.org/

    • @mrlonely420
      @mrlonely420 4 ปีที่แล้ว +1

      @@RafaFiedo thanks man, i appreciate it (=

  • @TheBinklemNetwork
    @TheBinklemNetwork 5 หลายเดือนก่อน +1

    Great!
    ... now how do i stop it?

    • @RafaFiedo
      @RafaFiedo  5 หลายเดือนก่อน +1

      you can use just .stop() command in the code ;)

    • @TheBinklemNetwork
      @TheBinklemNetwork 5 หลายเดือนก่อน

      ​​@@RafaFiedooh! I was trying .quit()
      Silly me, cheets
      Edit: cheers

    • @RafaFiedo
      @RafaFiedo  5 หลายเดือนก่อน

      @@TheBinklemNetwork ;)
      you can also find other usefull method like play from specific position

    • @TheBinklemNetwork
      @TheBinklemNetwork 5 หลายเดือนก่อน

      ​@@RafaFiedodo you know that meme where the person keeps getting more based with each response? Because you're doing this

    • @RafaFiedo
      @RafaFiedo  5 หลายเดือนก่อน

      @@TheBinklemNetwork oh, doesn't recognize this meme :(
      how to find it?
      (you can also share it on our discord :P)

  • @jmcn16
    @jmcn16 3 ปีที่แล้ว

    I used this method, in the preview works fine, when running the game it crashes(maybe something wrong with this version?)... I'm gonna go try some signals.

    • @RafaFiedo
      @RafaFiedo  3 ปีที่แล้ว

      What error do you have in the console? :)

    • @jmcn16
      @jmcn16 3 ปีที่แล้ว

      @@RafaFiedo there are no errors, it simply crashes and closes godot

    • @RafaFiedo
      @RafaFiedo  3 ปีที่แล้ว

      @@jmcn16 oh... that is something strange. If you are using newest version of godot I am not sure if I can help ;/
      Could you try it on new empty project?

  • @TechnoMichaSDL
    @TechnoMichaSDL ปีที่แล้ว

    The Godot Sound Engine sucks. Better is with Loop points with samples. The Offset or float Time format method is inaccurate.

  • @C6B9
    @C6B9 3 ปีที่แล้ว +1

    actually Thanks 😂😂😂

    • @RafaFiedo
      @RafaFiedo  3 ปีที่แล้ว

      No problem! 😂