mayhem-firmware
mayhem-firmware copied to clipboard
WAV audio output quality
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?
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.
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.