Rockbox

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, 20:17 GMT
Last edited by Michael Sevakis (MikeS) - Thursday, 23 July 2009, 11:33 GMT
Task Type Patches
Category Recording
Status Closed
Assigned To No-one
Operating System Sansa e200
Severity Low
Priority Normal
Reported Version Version 3.3
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
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.
This task depends upon

Closed by  Michael Sevakis (MikeS)
Thursday, 23 July 2009, 11:33 GMT
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, 08:10 GMT
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...