Skip to content

Conversation

@SJ7F
Copy link
Contributor

@SJ7F SJ7F commented Nov 8, 2025

Summary

This adds support for exporting time series data from all recorded channels as a single .wav file, where each recorded channel is a separate channel in the resulting WAV file. It encodes samples using 32-bit floats so they are not limited to between (-1, 1).

Motivation & Context

This makes it easier to play back recorded data as audio, and also to import it into programs like audacity for further analysis.
The file sizes also considerably smaller than CSVs due to the binary encoding.

Changes

  • Added WAV export option to the Plot Tools Overlay
  • Added format parameter to ChartExportOptions to choose between csv and wav
  • Added function to encode all data in the WAV format
  • Adjusted logic to switch between csv and wav encoding functions
  • Fixed chartExport tests so they work with the new ChartExportOptions

Screenshots / Demos (if UI)

Updated export UI:
image

How to Test

  1. Record some data
  2. Click the Export button, and then select Export as multi-channel WAV
  3. Open the downloaded file in an audio editor like Audacity (you may need to reduce the gain to see the whole signal) and check that the graph is the same as in the serial plotter.

Checklist

  • I ran npm run lint and fixed any issues
  • I ran npm run typecheck (TypeScript) with no errors
  • I ran npm test and tests pass
  • I ran npm run test:coverage if code paths changed significantly
  • I added/updated tests where appropriate
  • I updated docs/README if needed
  • No breaking changes without clear migration notes

Additional Notes

The resulting WAV file is often very loud as values are often clipped during playback. This could be solved by normalizing the amplitude, however this is not ideal as it alters the data. I have added some warnings so people don't damage their speakers and/or ears.

@cgreening cgreening self-requested a review November 12, 2025 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant