Most if not all of these issues are introduced by the frameworks on which "r128gain" is based. Fortunately we can expect them to disappear as time evolves.
I was able to reproduce the hanging issue outside r128gain by running:
sox -V -S -r 48000 -b 24 -n -n synth 3:10:00 pinknoise rate 96000 rate 192000
So I dove into the SoX source code and located the problem in the rate effect. They are improperly casting
size_t to an int which fails at the 2^31 boundary for integers. To fix the issue I created a patch file.
sox-14.4.0.patch:
diff -cr sox-14.4.0/src/rate.c sox-14.4.0/src-update/rate.c
*** sox-14.4.0/src/rate.c Tue Dec 27 22:15:32 2011
--- sox-14.4.0/src-update/rate.c Tue Dec 4 11:04:47 2012
***************
*** 397,403 ****
size_t remaining = samples_out - p->samples_out;
sample_t * buff = calloc(1024, sizeof(*buff));
! if ((int)remaining > 0) {
while ((size_t)fifo_occupancy(fifo) < remaining) {
rate_input(p, buff, (size_t) 1024);
rate_process(p);
--- 397,403 ----
size_t remaining = samples_out - p->samples_out;
sample_t * buff = calloc(1024, sizeof(*buff));
! if (samples_out > p->samples_out) {
while ((size_t)fifo_occupancy(fifo) < remaining) {
rate_input(p, buff, (size_t) 1024);
rate_process(p);
and added it to r128gain's Makefile:
.PRECIOUS: unpack/$(SOX)/configure
unpack/$(SOX)/configure: $(DOWNLOAD)/$(SOX).tar.bz2
mkdir -p unpack
tar xfvj $< -C unpack
cd unpack; patch -p0 -i $(SRC)/patch/$(SOX).patch <---- added
touch $@
I also submitted a bug report to the SoX sourceforge team. In the meantime you are welcome to use this patch file
if you wish. Thanks again for r128gain, it is a great tool.