reading wave file data

Discussion in 'C++' started by Jakub Dudek, Sep 2, 2003.

  1. Jakub Dudek

    Jakub Dudek Guest

    I am trying to read wave date (the 16 bits audio words) from a wave file
    using c++. I have tried using the mmsystems library. I got to the point
    where I read the wave data chunk into a character array using mmioread.
    This array does not make much sense to me however, I don't really understand
    the format. Anyone has an idea as to how to extract the 16 bit words from
    the character array returned by mmioread?

    Alos, any other suggestion as to how to extract wave data (and put it
    for example in an array of ints) from a wav file is appreciated

    Thanks for your time
    Jakub Dudek, Sep 2, 2003
    1. Advertisements

  2. Jakub Dudek

    Greg Schmidt Guest

    Standard C++ does not include an mmsystems library. You would be better
    off posting questions related to it in a newsgroup more closely related
    to the compiler or operating system which provides this library.
    When I needed to do this, years ago, I just found myself a copy of the
    ..wav spec and wrote my own simple I/O based parser (using only standard
    C++ no less). It's basically a matter of understanding the header so
    that you know how many bits there are per sample, and whether it is mono
    or stereo, and then you just read into your array. My job was a little
    easier because I could guarantee that the waves were all in a particular
    subset of the spec, but it wouldn't have been much harder to handle the
    entire spectrum. It's really a pretty simple format.
    Greg Schmidt, Sep 3, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.