hamoid / video_export_processing

Processing library that interfaces with ffmpeg to export video files
http://funprogramming.org/VideoExport-for-Processing/
GNU General Public License v2.0
114 stars 18 forks source link

Example withAudioViz: Parsed values have wrong decimal point #43

Closed ptoews closed 6 years ago

ptoews commented 6 years ago

I copied your example for creating a visualization for a sound file but it didn't work. I figured out that's because of the use of the Processing function nf() in the lines below, that uses (in my case) the comma as a decimal point for formatting.

StringBuilder msg = new StringBuilder(nf(chunkStartIndex/sampleRate, 0, 3));
    for (int i=0; i<fftSlices; ++i) {
      msg.append(SEP + nf(fftL.getAvg(i), 0, 4));
      msg.append(SEP + nf(fftR.getAvg(i), 0, 4));
    }

These values are then saved to the text file that gets parsed again with Processing's float(), which converts them to NaN since it doesn't recognize the comma as the decimal point.