[Stk] voicer->tick() returns clipped audio

Patrick J. Collins patrick at collinatorstudios.com
Sat Aug 22 11:07:36 PDT 2015


Another problem I have found is that the voicer is not doing anything to
stop the mixing of multiple instruments' audio from clipping.

For example, if I output a whole bunch of random noteOn events, I see
voicer->tick() will actually return values greater than 1.0f or less
than -1.0f...

In order to prevent clipping in my app, I am having to do:

        float sample = voicer->tick();
        if (sample > 0.99f) {
            sample = 0.99f;
        } else if (sample < -0.99f) {
            sample = -0.99f;
        }
        buffer[i] = sample * (1 << 15);

I would think the voicer should be taking care of this internally and
never return anything that would potentially be distored.  Is there any
reason for this?

Patrick J. Collins
http://collinatorstudios.com



More information about the Stk mailing list