• Status Closed
  • Percent Complete
  • Task Type Bugs
  • Category Codecs
  • Assigned To No-one
  • Operating System Gigabeat F/X
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by GodEater - 2007-03-08
Last edited by preglow - 2007-11-10

FS#6760 - Stereo Speex files produce only silence in Rockbox

When ripping direct from CD and converting immediately to speex, the resulting files appear to playback in Rockbox fine (i.e. the progress bar moves, and the time remaining changes) however you can’t actually hear any audio. Converting the wav file from the CD rip to mono, and then re-encoding resolves the issue.

Closed by  preglow
2007-11-10 15:28
Reason for closing:  Fixed

Yeah actually this is something silly. Turns out to produce stereo in Speex you need to do two passes over the file. So the decoding loop should look something like

speex_decode_int(st, &bits, output);
if (channels == 2)
  speex_decode_stereo_int(output, frame_size, &stereo);
ci->pcmbuf_insert(output, NULL, frame_size * channels)

or something like that anyway. I’ll take a look again when I get a chance.

Yeah okay, that’s not it. The code is already like that.

When i tried to debug speex (when implementing the codec) i got this problem, which was caused by faulty (not good enough accuracy) sqrt and exp functions.

To debug it i would try to use real (floating point) sqrt&exp functions in the emulator, and if that not works look at
void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState *stereo)
and int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data) in stereo.c

Currently sqrt and exp returns 0 (placeholder functions). I haven’t found good enough integer replacements to give noise-free sound. If you want to play sereo files in mono replace
e_left = sqrt(e_left/(e_tot+.01));
e_right = sqrt(e_right/(e_tot+.01));
in speex_decode_stereo_int (stereo.c:~166)

I don’t think we use that code at all - we use speex_decode_stereo_int(), not speex_decode_stereo()

No, I think freqmod is right. speex_decode_stereo_int does actually use a floating point sqrt() function. See line 163 and 164 of apps/codecs/libspeex/stereo.c. Don’t know why I didn’t see that before. Should probably just disable stereo decoding until that’s made fixed point.


Available keyboard shortcuts


Task Details

Task Editing