Add methods for suppressing all Sound library info/warning messages to Sound() class · Issue #65 · processing/processing-sound (original) (raw)
I was trying to read the amplitude of a .wav file at a given sample, n, so I used theprocessing.sound.AudioSample#read(n)
function which gave me what I wanted, so I was happy, but then I noticed that the terminal was completely swamped with messages about how this was a stereo wave file and it was only giving the amplitude for the left channel. Messages which were completely inconsequential for me as I didn't care which channel the amplitude came from. This was annoying because I was monitoring certain params with the terminal output and it was impossible to find the figures amongst the spam. I thought it was using some kind of logging system which I could turn off but I looked into the source code and found that it was just using System.out.println(). I read into this more and realised that this is not good coding practice.
The example I gave is actually common throughout the codebase and many of the System.out.println() usages link back to this method:
processing.core.PApplet#println(java.lang.String)
I suggest that we use a more sophisticated logging package in place of this method to avoid the problems like the one I described