arduino-audio-tools
arduino-audio-tools copied to clipboard
Csv auto range for Arduino Serial Plotter
Added an auto range feature to the CsvOutput
class so data could be visualized easier in the Arduino Serial Plotter, specially in the 2.x IDE version: audio data is better observed when the range doesn't continually change.
Also fixed some errors in the code (including a down-casting from T
to int
).
By the way, this feature is transparent: previous code would world exactly as it was doing before.
Best regards!
I don't like this idea: If you think that if you need a clipping functionality, it would be better to implement a ClippingStream (similar to VolumeStream). Or maybe using the VolumeStream actually give more correct result.
It's not -by any means- a clipping feature: it's just a visual aid for the Serial Plotter. Did you at least try it? Did you see the screen capture?
In Arduino IDE 2.x the Serial Plotter is practically unusable for me as the visualization jumps constantly with the vertical axis changing its range continuously, specially when debugging a problem with an ADC. I'm aware this is a Serial Plotter thing, but so it is the CsvOutput
class (it's basically intended for the Serial Plotter, right?).
Of course is up to you: it's your project.
Do you want a separate PR for the fixes in the first commit of this PR? (The hardcoded Serial writes and the downcasting error...)
Best regards
No, I just tried to review your code and the only functionality that I could find was some clipping. What did I miss ? Maybe it would help if you explain your logic... If you prefer to freeze the output you could just limit your output e.g. with copier.copyN(10);