Created attachment 652003 [details] Proposed patch Description of problem: When using mcompand with many bands (I tried with 3 bands), it's possible to get clipping due to integer sum wrapping. The clipping isn't reported by sox. I wrote a patch that seems to solve the problem. Version-Release number of selected component (if applicable): sox-14.3.2-3.fc17.x86_64 How reproducible: Always with same audio and same sox parameters Use sox mcompand with many bands, use gain to get some clipping, reduce gain till sox reports no clipping Steps to Reproduce: 1. Use sox mcompand with many bands, use gain to get some clipping 2. Reduce gain till sox reports no clipping. 3. Some clipping occurs. Actual results: Some clipping occurs, samples are wrapped from positive to negative and/or viceversa Expected results: If clipping occurs, sox reports it and sample are at their max positive or min negative values Additional info: This is my proposed patch, the problem is interger overflow before being converted to double. I also sent this upstream. Sorry, but English is not my language! diff --git a/src/mcompand.c b/src/mcompand.c index ce5dc0b..8add94b 100644 --- a/src/mcompand.c +++ b/src/mcompand.c @@ -390,7 +390,7 @@ static int flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obu (void)sox_mcompand_flow_1(effp, c,l,bbuf,abuf,len, (size_t)effp->out_signal.channels); for (i=0;i<len;++i) { - out = obuf[i] + abuf[i]; + out = (double)obuf[i] + (double)abuf[i]; SOX_SAMPLE_CLIP_COUNT(out, effp->clips); obuf[i] = out; }
sox-14.4.0-3.fc18 has been submitted as an update for Fedora 18. https://admin.fedoraproject.org/updates/sox-14.4.0-3.fc18
sox-14.3.2-4.fc17 has been submitted as an update for Fedora 17. https://admin.fedoraproject.org/updates/sox-14.3.2-4.fc17
Package sox-14.4.0-3.fc18: * should fix your issue, * was pushed to the Fedora 18 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing sox-14.4.0-3.fc18' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2013-2506/sox-14.4.0-3.fc18 then log in and leave karma (feedback).
This message is a reminder that Fedora 17 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 17. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '17'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 17's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 17 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior to Fedora 17's end of life. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. Thank you for reporting this bug and we are sorry it could not be fixed.
sox-14.4.0-3.fc18 has been pushed to the Fedora 18 stable repository. If problems still persist, please make note of it in this bug report.