Subtitle-Synchronizer / jlibrosa

Librosa equivalent Java library to process audio file adn extract features from it.
MIT License
89 stars 26 forks source link

Problem with mono conversion in load functions #4

Open m-canabal opened 3 years ago

m-canabal commented 3 years ago

Hi, First of all, thanks you for the effort porting Librosa to Java. I think that could be very useful.

I have tested the library in windows 10 and i found that when converting to mono audio, the library fails because of the method used to round the result of the mean between audio channels.

Error in: meanBuffer[q] = Float.parseFloat(df.format(frameVal / mChannels)); Due to decimal format: DecimalFormat df = new DecimalFormat("#.#####");

Changing the format solves the issue DecimalFormat df = new DecimalFormat("#,#####");

It seems that the format is related to platform or platform config(assuming you don't have such an error). I don't know why to use this type of rounding that don't take advantage of float and double precision. Why not just casting to float?