Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure to use Ogg Opus (and/or some lossless codec) for audio! #1

Open
JonathanHelianthicusDoe opened this issue Apr 9, 2020 · 5 comments

Comments

@JonathanHelianthicusDoe
Copy link

Make sure to use Opus (and/or some lossless codec) for audio!

I want to preface this by stating the obvious: if possible, you should avoid re-encoding audio in general if the codec that you are re-encoding to is lossy (even if it is higher quality than the one you are converting from, since obviously it won’t have that lost quality magically restored — for that, you have to encode from the source itself). Similar comments apply to other media like images/bitmaps, video, &c. Doing these kinds of re-encodings only makes sense if you don’t have access to the original and need to re-encode for compatibility’s sake, since you are unavoidably losing even more data than you may have lost in the first place.

Also, if you were planning on using Ogg Opus (and/or Ogg FLAC) anyways, then it’s probably not necessary to read any further.

This issue is w.r.t. this commit, which implies that any audio not already contained/containable in Ogg will have to be — hopefully — encoded from the source, or else re-encoded(!) (or rendered, in the case of MIDI, although my point still stands there) to something contained in Ogg (and readable by OpenAL). Historically, the usual suspect for a codec that can be contained in Ogg is Vorbis, which is significantly higher in quality than, say, MP3, and also was created by the Xiph.Org Foundation, so it has always been unencumbered by copyright/patent issues. Note that I do not want to discount the use of FLAC or other lossless audio codecs when appropriate (FLAC can be comfortably contained in Ogg); I just assume that you probably don’t want to use up the extra space. However, if you are going to use a lossy audio codec that is contained in Ogg (or indeed, any lossy audio codec in general), you should use Opus.

Opus has been around since 2012, and is currently (and for the forseeable future) the standard for lossy audio compression. For the benefit of those who may be unfamiliar with Opus (since Vorbis has been around for 12 more years, and seems to be more widely known):

  • Opus, like Vorbis, was designed by the Xiph.Org Foundation. It has thus always been completely unencumbered by patent and copyright issues (fun fact: the reference implementation is licensed identically to Open Toontown).
  • Opus outperforms Vorbis (and indeed, any other lossy audio codec) in terms of quality/size ratio by a significant margin. [1] [2]
  • Opus outperforms Vorbis (and indeed, most other audio codecs) in terms of latency, which is part of why it is popular for use in VoiP applications like e.g. Discord (and basically anything that uses WebRTC). This isn’t as relevant for Toontown, but is worth mentioning. [2]
  • Opus’s ability to have very low latency suitable for real-time applications is — no surprises here — due to its low complexity, and thus ability to be implemented very efficiently. This means less time on the CPU dedicated to just decoding audio.
  • Opus, like Vorbis, is almost always contained in Ogg. typically the end of the filename is .opus rather than .ogg, but of course that is a minor detail.
  • If you were worried that Opus is uncommon, know that almost all YouTube videos provide audio encoded in Opus (although usually at least one other codec as well, since MP4 unfortunately cannot contain Opus).
  • Opus is very flexible. See “supported features” here: https://opus-codec.org/
@ghost
Copy link

ghost commented Apr 9, 2020

He's already said in the past that he will support OGG and FLAC for sound formats, so no worries, my man. I've been playtesting the game, using resources i manuaully converted, and it works great.

@JonathanHelianthicusDoe
Copy link
Author

JonathanHelianthicusDoe commented Apr 9, 2020

I have no doubt that the support is there (or could be put there) for Opus and FLAC. I put this issue in this repo because it pertains to the resources, not the code.

@ghost
Copy link

ghost commented Apr 9, 2020

Seeing as I have all resources in the best quality OGG one can afford, I could upload them here, but they contain music i made for this little thing: http://www.mmocentralforums.com/forums/showthread.php?t=377628

So, idk.

@JonathanHelianthicusDoe
Copy link
Author

I assumed the first time that you said "OGG" that it was a mistake and you meant to say Opus, since Ogg is not a codec — it can contain many possible codecs which differ widely (some are even lossless, e.g. FLAC).

For the music that we have MIDI of, I’m not worried about it. They could be rendered using any soundbank you like, and then encoded as Ogg Opus. I’m more concerned with actual audio (that is, not MIDI) that needs to be encoded (or re-encoded!). Obviously, with MIDI it makes sense to keep the MIDI versions alongside the rendered ones even if you don’t plan on rendering them on-the-fly in-game.

@jwcotejr
Copy link
Contributor

Good call - it is likely that we will transition from Vorbis to Opus in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants