HydrogenAudio

Lossy Audio Compression => Speech Codecs => Topic started by: aebrahim on 2003-05-07 09:20:20

Title: Speex: Bad quality output
Post by: aebrahim on 2003-05-07 09:20:20
Hi everyone,

I'd appreciate some help getting some input as to why the Speex encodings I've created have so much background noise. Before I begin, let me just give you a bit of background as to how my system is setup, so that you may be able to point out flaws.

I'm using Windows XP, and to encode Speex files I'm using speexdrop V0.0.7 by John Edwards, based on LibSpeex 1.0. The options I'm using are:
Enable VBR: On
Complexity: 10
Frames/packet: 1
No downmixing or resampling.

The source file is: tuek-mono-32khz.flac (http://media.mumineen.org/incoming/aliebrahim/tuek-mono-32khz.flac) (16MB), which is a 32KHz wave, mono, 16-bit, PCM file. The file I've linked to is a FLAC (http://flac.sf.net) compressed wave, so that the download is smaller. The source file is a vocal, religious hymn, without any musical instruments.

I've created three Speex files from this using the above options:
tuek-mono-32khz-speex-q6.spx (http://media.mumineen.org/incoming/aliebrahim/tuek-mono-32khz-speex-q6.spx) (1.2MB - encoded at Quality 6)
tuek-mono-32khz-speex-q8.spx (http://media.mumineen.org/incoming/aliebrahim/tuek-mono-32khz-speex-q8.spx) (1.7MB - encoded at Quality 8)
tuek-mono-32khz-speex-q10.spx (http://media.mumineen.org/incoming/aliebrahim/tuek-mono-32khz-speex-q10.spx) (2.0MB - encoded at Quality 10)

All of these files have a very large amount of background noise, and don't sound good at all (so I didn't bother creating any at lower quality levels). When I encode them to Vorbis or MP3 they sound fine.

Here is some info as to how I arrived at the tuek-mono-32khz.flac (http://media.mumineen.org/incoming/aliebrahim/tuek-mono-32khz.flac) file I mentioned above. Originally I began with the wave equivalent of tuek-stereo-44khz.flac (http://media.mumineen.org/incoming/aliebrahim/tuek-stereo-44khz.flac), which is a 44KHz, stereo, 16-bit PCM wave file. First, I downmixed this to mono using sox (http://sox.sourceforge.net/), with the command sox input.wav -c 1 output.wav. Then I downsampled the mono wave from 44KHz to 32KHz using the Shibatch ssrc (http://shibatch.sourceforge.net/) sample rate conversion tool. I ran the command ssrc --rate 32000 input.wav output.wav. I then fed this into speexdrop to get the resultant files.

For what its worth, here is a Vorbis file created at q-1 from a 22KHz mono wave file (downmixed and resampled in a similar way as above), that was created using odddropXD:
tuek-mono-22khz-vorbis-q(-1).ogg (http://media.mumineen.org/incoming/aliebrahim/tuek-mono-22khz-vorbis-q(-1).ogg) (1.1MB)

I'd appreciate it if someone has any ideas if I'm doing anything wrong, or if this is a limitation of the codec itself.

Thanks for your help.
Title: Speex: Bad quality output
Post by: john33 on 2003-05-07 10:40:05
Well, I've encoded as you did, with the same results (no surprise there!!). This is probably a limitation in the codec since it is optimised for the spoken word rather than for chanting/singing. I also encoded your flac file, without resampling, at 'quality -1' in oggdropXPd which produced a file of 1.5Mb and a level of quality that I couldn't readily distinguish from the original!!

Unless you have a good reason to want to use speex, I would use oggvorbis in this instance.
Title: Speex: Bad quality output
Post by: Garf on 2003-05-07 10:54:20
I would agree with John, but it makes little sense to me that even in the silent sections the distortion is so large!
Title: Speex: Bad quality output
Post by: jmvalin on 2003-05-07 16:20:26
Actually, it seems like what you found is mostly a limitation of the ultra-wideband mode. Just try encoding at 16 kHz and the noise will go away (or listen you current .spx with speexdec --force-wb).
Title: Speex: Bad quality output
Post by: aebrahim on 2003-05-07 18:08:32
Thanks guys.

I tried jmvalin's suggestion to decode with the --force-wb switch, and the noise did indeed go away. It sounds fine. FYI, I've encoded some files at 16KHz, all of which sound pretty good:

Source: tuek-mono-16khz.flac (http://media.mumineen.org/incoming/aliebrahim/tuek-mono-16khz.flac) (8.7MB)

Output:
tuek-mono-16khz-speex-q3.spx (http://media.mumineen.org/incoming/aliebrahim/tuek-mono-16khz-speex-q3.spx) (655KB - Q3)
tuek-mono-16khz-speex-q6.spx (http://media.mumineen.org/incoming/aliebrahim/tuek-mono-16khz-speex-q6.spx) (1.1MB - Q6)
tuek-mono-16khz-speex-q8.spx (http://media.mumineen.org/incoming/aliebrahim/tuek-mono-16khz-speex-q8.spx) (1.5MB - Q8)
tuek-mono-16khz-speex-q10.spx (http://media.mumineen.org/incoming/aliebrahim/tuek-mono-16khz-speex-q10.spx) (1.9MB - Q10)
(all done using the same setup as before)

I'll just stay away from using uwb for these type of files, and stick to wb.

Thanks again.
Title: Speex: Bad quality output
Post by: aebrahim on 2003-05-07 23:24:09
Is this ultrawideband limitation/bug likely to go away in future releases of Speex, or is this going to be more or less of a permanent problem now that the Speex bit-stream is frozen?
Title: Speex: Bad quality output
Post by: jmvalin on 2003-05-08 05:10:50
Quote
Is this ultrawideband limitation/bug likely to go away in future releases of Speex, or is this going to be more or less of a permanent problem now that the Speex bit-stream is frozen?

Well, consider ultra-wideband as some patch over wideband (that's the reason it only adds 1.8 kbps). I don't think it'll ever work perfectly. However, I think it's possible to improve it (without changing the bit-stream) so that the extreme noise you've seen doesn't happen anymore.