Hello Jean-Marc, thank you for your answer!> I'll look into this. There's basically no overflow prevention for now. > I'll think about how to add that without affecting performance too much > (on CPUs that don't have hardware saturation). I'm open to suggestions :-)I'm not sure if I can really help, but I did a few more tests. Reducing the volume of the input signal by 6 dB and increasing it again afterwards with saturation seems to avoid the overflow even with heavy clipping. So using 14 fractional bits internally instead of 15 and doing the saturation right before converting to the 16 bit output sample value could help. But certainly there are more sophisticated solutions to this problem. :-) During the tests I encountered another problem. While upsampling a continuous ?6 dB sine from 8000 Hz to 11025 Hz I heard that the resampler produces a click every 5 seconds. After changing the output sample rate to 11000 Hz the clicking disappeared. Daniel
Daniel Schmidt a ?crit :> Hello Jean-Marc, > > thank you for your answer! > >> I'll look into this. There's basically no overflow prevention for now. >> I'll think about how to add that without affecting performance too much >> (on CPUs that don't have hardware saturation). I'm open to >> suggestions :-) > > I'm not sure if I can really help, but I did a few more tests. > Reducing the volume of the input signal by 6 dB and increasing it > again afterwards with saturation seems to avoid the overflow even with > heavy clipping. So using 14 fractional bits internally instead of 15 > and doing the saturation right before converting to the 16 bit output > sample value could help. But certainly there are more sophisticated > solutions to this problem. :-)I'm not too keen on doing that because Q15 is already at the limit of what I can tolerate in terms of noise.> During the tests I encountered another problem. While upsampling a > continuous ?6 dB sine from 8000 Hz to 11025 Hz I heard that the > resampler produces a click every 5 seconds. After changing the output > sample rate to 11000 Hz the clicking disappeared.Hmm, interesting. Do you have the sample? Is that only in fixed-point or in floating-point as well? Jean-Marc
Hello Jean-Marc> > During the tests I encountered another problem. While upsampling a > > continuous ?6 dB sine from 8000 Hz to 11025 Hz I heard that the > > resampler produces a click every 5 seconds. After changing the output > > sample rate to 11000 Hz the clicking disappeared. > > Hmm, interesting. Do you have the sample? Is that only in fixed-point or > in floating-point as well?It was my fault, I'm really sorry! I use the resampler to fill fixed size output buffers and occasionally there is only 1 sample missing, so speex_resampler_process_int is called with out_len 1 and in this condition it sometimes doesn't use any input, resulting in in_len set to 0 on return. This triggered a bug in my code. Interestingly this didn't happen with the floating-point version or with 11000 Hz output sample rate instead of 11025. Sorry for the confusion. Daniel