I'm trying to make a simple application that has to record sound from a microphone and then save it to an .wav-file (16bit, mono, 8000Hz)
Recording works fine. I use the waveIn..... routines from microsoft.
This gives me a buffer with all the audio-data. When I play this with the waveOut.... routines, I hear everything. No problems there.
I know how to make the correct header for a wave-file (for the format described above), so there is no problem there. My problem is the data-chunck. When I copy my buffer from the waveIn... routines to the data-chunck, it won't work. When I transform the buffer into little-endian format, it won't work. To keep things short, it just won't work. All I get is a lot of noise. Even when I save the buffer to a file and try to play it again, it just produces a lot of noise.
Is there anyone who can explain to me what I should do, or what I'm doing wrong? Or are there examples that use the waveIn... routines and then save the data to a .wav-file?