Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#10458 - Fix incorrect AIFF and WAV encoding while recording in mono

Attached to Project: Rockbox
Opened by Christopher Williams (christop) - Monday, 20 July 2009, 22:17 GMT+2
Last edited by Michael Sevakis (MikeS) - Thursday, 23 July 2009, 13:33 GMT+2
Task Type Patches
Category Recording
Status Closed
Assigned To No-one
Player Type Sansa e200
Severity Low
Priority Normal
Reported Version Version 3.3
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Private No

Details

The encoders for both AIFF and WAV produce the incorrect encoding when the channel mode is set to mono on my Sansa e200 (and probably all other little-endian players) in Rockbox Version 3.3 as well as the latest revision as of this writing (r21985). The problem occurs when recording either from the mic or from FM radio, and with any mono mode (L, R, L+R).

For AIFF, the encoder outputs the incorrect endian-ness of samples, producing files that sound very much like static. For WAV, the encoder swaps samples in pairs, which essentially adds in sawtooth-like waveforms to a smooth input wave. For example, if you have the input sample values 0 1 2 3 4 5, the WAV encoder would output 1 0 3 2 5 4 instead.

I attached a patch which I believe fixes both of these issues for machines of all byte orders. I tested it on the e200 (little endian), but I don't have any big-endian players to test it on.
   aif_wav_enc.diff (0.9 KiB)
 apps/codecs/wav_enc.c  |    2 +-
 apps/codecs/aiff_enc.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

This task depends upon

Closed by  Michael Sevakis (MikeS)
Thursday, 23 July 2009, 13:33 GMT+2
Reason for closing:  Accepted
Additional comments about closing:  Checked out and verified on ARM and CF.
Comment by Michael Sevakis (MikeS) - Wednesday, 22 July 2009, 10:10 GMT+2
Interesting.

WAV: (S2 << 16) | (uint16_t)S1
LE: 1L1H2L2H noop 1L1H2L2H
BE: 2H2L1H1L swap 1L1H2L2H

AIFF: (S1 << 16) | (uint16_t)S2
LE: 2L2H1L1H swap 1H1L2H2L
BE: 1H1L2H2L noop 1H1L2H2L

It checks out and I endorse this patch. :-)

Loading...