Does Lipshitz noise shaping always produce noise even if no signal is applied anymore?

69 Views Asked by At

Does noise shaping always generate a constant noise?

I’m currently implementing a downsampling of audio data to 8 bit PCM audio. To eliminate quantization noise I added additional TPDF noise to the input signal. The results are quite good and now I’m trying to use noise shaping to decrease the perceptiveness of the noise in the target signal.

I implemented an FIR example noise shaping design as presented in „Minimally Audible Noise Shaping“ by Lipshitz from 1991.

The problem that I have now is that once an audio signal is applied a constant noise is generated, even when the signal is removed again and the input signal is a constant zero. Is this by design and once a signal is applied the loop generates continuous strong noise or just an implementation error by me?

Because by just using TPDF the noise disappears once the signal is silent again.

I tried to look at the implementation of Ardour as a reference and I might be wrong there but I think I might have found a bug in their implementation:

    /* Run FIR and add white noise */
    ss->buffer[ss->phase] = gdither_noise () * 0.5f;
    tmp += ss->buffer[ss->phase] * shaped_bs[0]
       + ss->buffer[(ss->phase - 1) & GDITHER_SH_BUF_MASK]
         * shaped_bs[1]
       + ss->buffer[(ss->phase - 2) & GDITHER_SH_BUF_MASK]
         * shaped_bs[2]
       + ss->buffer[(ss->phase - 3) & GDITHER_SH_BUF_MASK]
         * shaped_bs[3]
       + ss->buffer[(ss->phase - 4) & GDITHER_SH_BUF_MASK]
         * shaped_bs[4];

    /* Roll buffer and store last error */
    ss->phase = (ss->phase + 1) & GDITHER_SH_BUF_MASK;
    ss->buffer[ss->phase] = (float)lrintf(tmp) - ideal;

https://github.com/Ardour/ardour/blob/dd9f9ef19dfa6cd44be17ed4eb6a3d2c65bed6a0/libs/audiographer/private/gdither/gdither.cc

The calculated error in the last step seems to get overridden again by new noise in the first step without further usage.

0

There are 0 best solutions below