Hi, I need to reduce the sample size of wav audio files from 44.1 kHz to 8 kHz. I have to do all the work manually using an array of bytes ... for academic purposes.
I am currently using 2 classes, Sink and Source, to create byte arrays as well. Everything is going well until I get to the part where I need to reduce the amount of data using linear interpolation.
Since I am downsampling from 44100 to 8000 Hz, how can I interpolate an array of bytes containing something like 128,000,000 bytes? Right now, I am outputting 5, 6 or 7 bytes depending on i% 2 == 0, i% 2 == 1 and i% 80 == 0 and popping the average of these 5, 6 or 7 bytes into a new file,
The result is a smaller sound file than the original, but it cannot be played on the Windows media player (it says there is an error while reading the file), and there is a lot of noise, although I hear the correct track behind the noise.
So, to summarize, I need help regarding the linear interpolation part. Thanks in advance.
java audio wav
Jean-francois hamelin
source share