Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
OGG music playback — Gideros Forum

OGG music playback

antixantix Member
edited November 2017 in General questions
How do I playback OGG music files? I don't seem to see anything in the documentation on how it works.

And with normal MP3 file playback there is an issue (in Android its self) where the tune does not loop once completed and this requires adding more code in an on complete listener to restart it. Does this issue affect OGG playback also?

Comments

  • hgy29hgy29 Maintainer
    For ogg just include ogg plugin in your custom player, and it shouldn’t be affected by the mp3 issue since they don’t use the same playback system. MP3 is played by android itself while ogg is decoded and played by gideros.
  • Also, it may be that mp3 files now loop properly - a bug was fixed that released the wrong memory in some cases. Can you try the MP3 again (with the 2017.11 release)?
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • so..
    local sound = Sound.new("music.ogg")
    local channel = sound:play()
    will work?

    I will upgrade to the latest version of Gideros today (I'm still on 2017.4.1) :bz

    It would be great if the mp3 thing was fixed too, I'll totally test that :)
  • hgy29hgy29 Maintainer
    Accepted Answer
    Yes, it will work. just be sure to enable ogg plugin, nothing more to do. the plugin will register himself to register as a handler for .ogg/.oga/.ogv sound files.

    Likes: antix, MoKaLux

    +1 -1 (+2 / -0 )Share on Facebook
  • @antix can you try the mp3 again with the new version?
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • We were out most of the day so will attempt to upgrade and test in the morning :)
  • antixantix Member
    edited November 2017
    Right. With 2017.11 installed MP3 repeats fine on Pixel-C but not on my old Nexus 4.

    OGG plays but will not repeat on either device using the following code..
    local sound = Sound.new("music.ogg")
    local channel = sound:play(0, true)
    Oh, I exported APK files to my devices to test.
  • hgy29hgy29 Maintainer
    Accepted Answer
    @antix yes you are right, seeking is not implemented in ogg so gideros don’t know how to make the sound restart from the beginning. I need to find a proper way to do this.
  • @hgy29 ahh darn. I suppose I should just stick to plain old MP3 for now then :)

    So is there any way to get seemless looping for any music in Gideros?
  • hgy29hgy29 Maintainer
    If someone could provide me with a test app that could reproduce the issue on my Iconia 7 tablet, I'd happily have a look at this long standing issue for mp3
  • @hgy29 it seems kind of hard to pin down. The issue for me only happens on my Nexus 4 so it is either an issue with the older version of Android that it runs or some hardware issue associated with that phone.

    For me personally I can just use the following code with any old mp3 file and it will play once and fail to repeat.
    local sound = Sound.new("music.mp3")
    local channel = sound:play(0, true)
  • For me it was intermittent - but the event catches it every time (to restart manually).

    Is the OS told to repeat or is it an event in gideros that also sends off the completed event if there is no repeat?

    If it's gideros that sorts out the repeat then somehow it's not resetting the position to 0.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • totebototebo Member
    edited November 2017
    I can replicate the issue on all my Android devices including my current Pixel XL phone. On iOS it normally loops ok, with a very slight gap on slow devices.

    I thought the problem happens because of the way Android handles mp3 files?
    My Gideros games: www.totebo.com
  • Probably. I haven't tested with ogg yet to see if it has a gap between ending and restarting yet. Having seemless looping music would be pretty good :)
Sign In or Register to comment.