ExportAudioExample problem

Developers
2008-09-04
2013-04-29
  • Random_Access
    Random_Access
    2008-09-04

    This program is working fine with the given Laser.wav file.
    Whenever i try to use some other wave file, it does not work. I checked that,
    fread(dataBuff, sizeof(unsigned char), sizeof(dataBuff), pWavFile) returns a lower value than that of laser.wav which is 1.8 kb size , while my wave file is 800kb in size.

     
    • Could be a bug in handling larger .wav files. The buffer used for reading .wav is 4K. Laser.wav is smaller than that. Your file is larger than that. To verify if this is the issue try reducing the buffer size and see if Laser.wav still works.

       
      • Random_Access
        Random_Access
        2008-09-11

        Hi akharkev,
        I think you are right.
        I tried the laser.wav file with different buffer sizes. The default size is 4096.
        this file works with all buffer starting 64.
        Below 64, the AAF file generated does not work. The size of laser.wav is 2 KB.

        What buffer size should I write, if my file is 800 KB ?
        Tried it with 32767, but did not work

         
        • John Emmas
          John Emmas
          2008-09-11

          Unless your WAV audio has a word length of 8-bits, you can't fit a whole number of samples into a buffer size of 32767. try a number that divides by 48 as it should fit a whole number of samples at any of the common word lengths.

          Also, make sure you accommodate any overspill properly. For axample, if your buffer size was 48000 but you needed to transfer 100000 bytes, you can't pass 48000 as the buffer size every time. It'll be right for the first 2 transfers - but on the final transfer, there would only be 4000 samples left so you need to make sure you pass 4000 and you aren't still passing 48000.

          I'm only guessing here but these are common mistakes.