I'm working on audio processing app for android and created a class for reversing WAV
files. Everything works great on Java SE on my PC.
However, the code is very slow on android "due to continuous reading of small amount of data and writing it, about 2 bytes usually".
The process is taking almost forever to deliver that I actually believe uploading the files to a server to handle may be a very much more effective way. I've tried using channels, file maps and buffered I/O. All ended in very poor performance.
The logic I'm using now:
- read first 44 bytes and write them to a new file "reverse file".
- calculate the block size to be moved "number of bytes per sample * number of channels"
- read that amount of data from the end of the first file and write it to the reverse file "also I tried writing to a buffer and when it is full write to reverse file" .
Any ideas how to improve the performance? Should I give up on my current approach?