Unable to load certain WAV files

About Monkey 2 Forums Monkey 2 Programming Help Unable to load certain WAV files

This topic contains 6 replies, has 5 voices, and was last updated by  Mark Sibly 1 year, 12 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #7946

    Hezkore
    Participant

    I’m working on a sort of music player for a certain type of music file format.
    That means I have to load the WAV files that comes with those music files.
    But I’m having some issues, only about 15% of the WAV files I try to load actually gets loaded.
    And I’m sure it has to do with the compression or something like that, but I really need a way to load them…

    Here’s a test WAV file I’m having issues with: http://www.wikifortio.com/707390/test.wav
    And here’s some code to test it with:

    #7947

    AdamStrange
    Participant

    I can tell you it’s a standard stereo 16bit uncompressed wav file. so… in theory it should load.

    Confirmed. wav not loaded!

    one thing I’ve found is to NEVER use #Import”assets/”. always import each asset individually otherwise there is a tendency of multiple duplications on compile.

     

    OK. Checking the wav file itself reveals the header is reporting 0 channels and 0 bits. Monkey dumps this sample as the needed header information is not compatible. So you have a technical error with your wav file.

     

    The next best thing to do would be to write your own wav loader that deals correctly with this situation as there is other info about the wav file and its contents which would correctly return the channel and bit information

    #7948

    Hezkore
    Participant

    Thanks for figuring that out.
    All applications load the WAV files just fine so it seems like Monkey 2 should load them too.
    I think maybe Mark needs to look at this instead of me writing a WAV loader.

    #7962

    nobuyuki
    Participant

    a game engine isn’t an audio editor, so I’d argue it’s still your responsibility to fix wave files with bad headers if you want them to play in your project.  Without a proper header, the entire file needs to be read and the length and format guessed.

    #7963

    Simon Armstrong
    Participant

    I’m not sure I agree. The example is a perfectly valid WAV with an additional JUNK block preceeding the fmt block at start which does NOT make it technically incorrect.

    The fact monkey2 uses it’s own wav parser that expects the fmt block to always be first like the blitzmax loader is the problem here.

    #7971

    nobuyuki
    Participant

    ah, fair enough.  I was under the assumption that the fmt block was incomplete or had bad data.

    #7989

    Mark Sibly
    Keymaster

    Fix pushed to develop branch.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.