xiph / vorbis

Reference implementation of the Ogg Vorbis audio format.
BSD 3-Clause "New" or "Revised" License
450 stars 183 forks source link

Can you tell the differences between libvorbis and libogg for someone who doesn't know? and a few questions #78

Closed SeanTolstoyevski closed 3 years ago

SeanTolstoyevski commented 3 years ago

hi,

I want to use libvorbis to manage and package audios in a game.

However, the documents I could find on the internet were for experienced c and cpp coders. I can write c and cpp, but I'm new to low level transactions like digital audio and codecs.

I would like to choose libvorbis as I have no problem with licensing.

Could you please simply answer my questions below?

  1. Why are there two different libraries? What is the difference between libvorbis and libogg?
  2. What library should I use to play files that I have just viewed while working with libvorbis? What is the advice for a new c developer?
  3. If I choose libvorbis, is there any way I can load audio from DRM files (memory, encrypted, network resources. So no direct disk)? Like the libsndfile's sf_open_virtual?

I think many people are curious about these questions.

rillian commented 3 years ago
  1. There are multiple libraries to clearly separate the technology layers and allow low-level access for programs which require that. libvorbis is the raw audio decompression implementation. libogg reads and writes the standard format for storing vorbis data on disk or streaming over a connection. libvorbisenc contains the extra code needed to compress files separately, so playback-only applications can avoid the extra code footprint.
  2. For a game where you just need to play files, you should use the higher-level libvorbisfile. You'll still need to link your module or executable to the vorbis and ogg dependencies, but you shouldn't call their APIs directly.
  3. There's an equivalent to sf_open_virtual in libvorbisfile. See ov_open_callbacks.

Hope that's helpful to get you further along. Thanks for your interest in vorbis.

You might also want to take a look at our newer opus audio codec. It has the same permissive license. Depending on your application it can be more expensive to decode, but offers better compression, especially for voiceover material. The equivalent high-level playback library is libopusfile.

SeanTolstoyevski commented 3 years ago

Thank you for your answer.

I know opus. it's a very good project.