Thread: Audio encoding (where to start)

  1. #1
    Allways learning cs_student's Avatar
    Join Date
    Aug 2008

    Audio encoding (where to start)

    I'm planning on learning audio encoding. How to read it, parse it, play it, etc. I am planning on learning video encoding later down the road, but I thought that audio encoding would be better to start with.

    I was wondering if anyone knew of a good place to start with c++.

    Thank you for your time and effort,


  2. #2
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Banks of the River Styx
    There are tons of different encodings for both audio and video. Some examples:
    Audio: PCM, vorbis, flac, wma, aac, mp3, etc.
    video: mjpg, all the flavors of mpeg, wmv, etc.
    Additionally, where audio & video meet (and where there is video, there is almost always audio...) there's usually another thing to worry about, a container format:
    Container: ogg, riff, mp4, (window media w/e), etc.

    However, when it all boils down to it, if you want to know how to read a certain file or format, you just need to research. Find the appropriate documentation, chances are good that it's out there on the web, somewhere. Read it, figure out how the format works, build the appropriate software. (Note: the skills needed for binary file I/O and proper (de)serialization of data are a prerequisite here. And all the basics of programming are a prerequisite to that.)

    However, all that is only really needed if you for some reason want to understand the format for yourself. If you're just interested in reading/writing it, it's not needed. Other people have likely done the hard work for you. There are tons of libraries out there for encoding/decoding a/v formats. More open formats like vorbis & flac practically come with the code - see their respective sites. Other formats have had open source solutions - libmpg123, lame, libsoundfile, etc. ffmpeg and its derivative apps reads half the video stuff known to man. Libraries like these are under liberal licenses - use the tools available to you. I've written software to play mp3/ogg files, but I do not know these formats - I used the respective libraries for the file -> sound wave part.

    (Also, some formats (well, the algorithms involved) are patented, notably mp3. There might be others. :-/ Just be aware.)
    Last edited by Cactus_Hugger; 08-01-2008 at 10:11 PM.
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  3. #3
    Allways learning cs_student's Avatar
    Join Date
    Aug 2008
    I'm not planning on re-distributing anything, so copyrights won't be of any problem. I am also interested in understanding how it works, so I'll be making the libraries my self. I will keep in mind the libraries you mentioned, however, in case I need a point of reference.

    Thanks for your reply,


  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    I would start by understanding the basics: How audio is represented [in it's most primitive form, e.g. PCM] in a system. Once you understand that, try to follow how compressed audio works - there are simple forms [differential and mu-law (aka u-law) for example], and there are complex forms (the mobile/cell-phone GSM audio portion for example).

    For video formats, understanding how images are stored. Also understanding general compression and lossy compression [some of which you'd get from the audio side] will be helpful.

    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Hardware Engineer
    Join Date
    Sep 2001
    From the LAME website:
    LAME is an educational tool to be used for learning about MP3 encoding.
    The Ogg Vorbis code is also open source.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Audio Programming
    By dwalters in forum Tech Board
    Replies: 0
    Last Post: 02-07-2008, 04:20 PM
  2. C++ gui for windows where to start
    By prixone in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2006, 11:48 PM
  3. Audio Drivers
    By Tonto in forum Tech Board
    Replies: 8
    Last Post: 08-30-2006, 09:07 PM
  4. GNOME Desktop won't start (Mandriva)
    By psychopath in forum Tech Board
    Replies: 10
    Last Post: 07-19-2006, 01:21 PM
  5. WHEN to start game programming
    By mrcheesypants in forum Game Programming
    Replies: 18
    Last Post: 02-02-2006, 04:09 PM