mayhem-firmware icon indicating copy to clipboard operation
mayhem-firmware copied to clipboard

WAV audio output quality

Open NotherNgineer opened this issue 1 year ago • 2 comments

Audio quality needs improvement when listening to a WAV file using the WAV viewer or Soundboard app.

Maybe try playing pure sine waves to better understand the distortion.

Possibilities may include:

  • Clipping
  • Sign conversion
  • Buffer fill timing (CPU is copying audio data into a free-running unsynchronized DMA ring buffer that dumps the data to the audio chip's DAC)
  • CPU interrupts messing with the above (i.e. maybe too many screen "progress" updates)
  • Noise being picked up from other components on the PCB (unshielded audio circuit)

Related questions:

  • Is transmitted audio quality just as bad?

NotherNgineer avatar Feb 10 '24 14:02 NotherNgineer

Narrowing this down,

  • I don't think it's Clipping since the audio quality is just as bad if I reduce the audio amplitudes.
  • I don't think it's sign conversion since no conversion is necessary in signed 16-bit mode, which sounds just as bad.
  • Disabling the progress bar doesn't help.

NotherNgineer avatar Feb 16 '24 15:02 NotherNgineer

Just FYI: PR #2014 improves the audio quality of PURE SINE WAVE beeps, but doesn't help with WAV files. The challenge with this issue is that we need to fill the buffer at the same rate as it's being emptied.

NotherNgineer avatar Mar 19 '24 20:03 NotherNgineer