GNOME Bugzilla – Bug 338718
[patch] [audioconvert] correctly clip float samples > 1.0
Last modified: 2006-05-06 08:46:49 UTC
Please describe the problem: With some ogg/vorbis-files the vorbisdec creates float samples that are slightly bigger than 1.0000. This particularly causes audioconvert to wrongly convert to integer samples, resulting in a very annoying noise. Steps to reproduce: gst-launch-0.10 audiotestsrc volume=1.0 ! audioconvert ! vorbisenc ! vorbisdec ! audioconvert ! alsasink Actual results: There is a loud noise. Expected results: There should be a loud 440Hz sine tone. Does this happen every time? Yes. Other information: Happens on both my Pentium M and AMD Athlon (32bit) computers.
audioconvert seems to clip correctly, are you sure the noise is not caused by the clipping? As for vorbisdec creating samples outside of the range, this is entirely possible as vorbis does not deal very well with input that is extending the full input range.
(In reply to comment #1) > audioconvert seems to clip correctly, are you sure the noise is not caused by > the clipping? > I now tried the following two pipelines (440.ogg is the sine wave): gst-launch-0.10 filesrc location=440.ogg ! oggdemux ! vorbisdec ! filesink location="440-float.raw" gst-launch-0.10 filesrc location=440.ogg ! oggdemux ! vorbisdec ! audioconvert ! audio/x-raw-int ! filesink location="440-int.raw" and got the attached (audacity) screenshot. The upper wave is the float and the bottom one is the integer one. It seems that someone turns everything bigger than 1.000 into -1.000. By the way, gstreamer-0.8 seems to work fine.
Created attachment 63820 [details] Screenshot of the two waves
audioconvert didn't clip correctly for me either. Attaching a patch that fixes it.
Created attachment 63877 [details] [review] Simple fix for audioconvert
strange, still nothing wrong on my machine, maybe something specific to the compiler or so. does attached patch work as well, it's more closely to the reference vorbis float to int code.
Created attachment 64180 [details] [review] increase precision in float to int conversion
Using "gcc version 3.3.5 (Debian 1:3.3.5-13)" and your patch also fixes this for me.
ok, thank you for verifying.
* gst/audioconvert/audioconvert.c: (float): correctly clip float samples > 1.0. Fixes #338718
*** Bug 340798 has been marked as a duplicate of this bug. ***