Sound creation using WAV. files

Hi there Uniteers.
For a student project, we are attempting to utilize a new audio creation system instead of unity’s FMOD. Though we are having trouble with certain .wav files.

  • For this we are using an Audioclip to “store” our sound file imported into unity, in which we later extract the raw PCM data from.
  • After the sound creation is done, we uses “OnAudioRead” to feed the output-buffer with our manipulated PCM data, which is then played back using FMOD.

Lets just presume, that the audio creation system is not the cause of error here:

All .wav files can be played through minimum once (1. iteration), but certain .wav files, when played a second time (2.iteration), the signal becomes full noise. When the loop continues (3. iteration) the signal turns back to normal, but on the 4. iteration it turns back to noise, and it continues so forth.

9863-graph.png

I know the graph is ugly as … but I couldn’t find other ways to illustrate 300.000 samples. The y-axis is amplitude, and x-axis is samples.

As I mentioned, this problem only occurs to certain .wav files.

Sound 1: 8 bit, 44100 hz, Mono: No Noise
Sound 2: 44100 hz, Stereo: Noise
Sound 3: 44100 hz, Stereo: Noise
Sound 4: 44100 hz, Mono: Noise
Sound 5: 11000 hz, Stereo: Noise
Sound 6: 44100 hz, Stereo: No Noise

As you can see, there is no consistency between Noise and No-Noise.

The question is, what could possibly cause this noise? Is there something we are missing about the Audioclip we extract the PCM data from or the playback of FMOD? Or is there something about .wav format/codec (something) we doesn’t know?

All suggestions and ideas are welcome!

Okay, I actually managed to figure out the issue myself.
Apparently, .wav files can also be compressed with different codecs, such as ADPCM. Sadly I can’t give you a detailed technical description on ADPCM, but the problem was that our .wav file wasn’t PCM but ADPCM. The main difference is that ADPCM have some sort of different structure, compared to standard PCM. (As far as I know)
I found the solution, by looking through some of these replies to a thread:
http://forums.winamp.com/showthread.php?t=148626

(If you play around with audio yourself, and you are having trouble, feel free to contact me)