Java - downsampling wav audio file -


Hello, I have to downsamp the sample rate of the wav audio file from 44.1 kHz to 8kHz. I have to do all the work manually with the byte array ... it is for educational purposes.

I am currently using 2 squares, sync and source, to pop and push the arrays of the bytes. As long as I do not need to downsound the data section using a linear interpolation, everything goes well.

Since I'm downsmapping from 44100 to 8000 Hz, how do I get 128 000 000 bytes of a byte array? Right now I depend on 5, 6 or 7 bytes, I% 2 == 0, i% 2 == 1 and i% 80 == and pushing the average of these 5, 6 or 7 bytes in the new file .

The result is basically a small audio file compared to the original audio but it can be played on Windows Media Player (say there is an error in reading the file) and there is a lot of noise, though I hear The right track behind the noise.

So, to summarize things, I need help related to the linear interpolation part. thank you in advanced.

I think you should not use the average of those samples because it's an average filter, of course Not just downsempling, use every 5th / 6th / 7th sample and write it in a new file.

This may be on some aliasing artifacts but will be identifiable as a whole.

Another, more complex solution but perhaps with a better result, quality-wise, firstly, your samples should be converted to frequency distribution using an FFT or DFT, and then with the appropriate sample rate Must have to change back. It's been a while when I did this but it is definitely possible. Although you may have to have a little bit to work properly.

In addition, when you do not take the whole array of FT but in the segment you have a problem of boundaries of 0. A few years ago when I played with those things, I did not have a practical solution on this (because it also produces artifacts), but possibly one if you read the right books: -)

In order to complain about the WMP file: You did modify the header as you type, right?


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -