Convolution3 - fails... #735

Open
joslloand opened this Issue Feb 26, 2013 · 2 comments

3 participants

@joslloand
joslloand commented Feb 26, 2013 edited

OSX 10.8
SC3 3.6.2

Example failure cases below. Choose matching ~numFrames and ~frameSize pairs.

For 32, there appears to be an overflow.
For 64+, again, there appears to be an overflow, but with audible buzzing distortion.

// -----------------------------------------------
// Test: Convolution3
Server.default = s = Server.local.boot;

// number of frames for buffer (kernel)
~numFrames = 2**5; // 32
~numFrames = 2**6; // 64
~numFrames = 2**7; // 128

// frames size of FFT (NOTE: in the context of direct convolution the name "FFT size" isn't appropriate)
~frameSize = 2**5; // 32
~frameSize = 2**6; // 64
~frameSize = 2**7; // 128


// set up buffer (kernel)
~buffer = Buffer.alloc(s, ~numFrames);
~buffer.zero;

// add an impulse @ gain
~gain = 0.dbamp;
~gain = -9.dbamp;

~sampleIndex = 0;
~sampleIndex = ~numFrames / 2;
~sampleIndex = ~numFrames - 1;

// create impulse at sampleIndex
~buffer.set(~sampleIndex, ~gain);

(
// test!
~synth = {
    Convolution3.ar( // appears to be broken!!
        Saw.ar(110.0, -18.dbamp),
        // PinkNoise.ar(-6.dbamp),
        ~buffer,
        framesize: ~frameSize
    )
}.scope;
)
~synth.free;
~buffer.free;
s.quit;
@scztt scztt added this to the 3.7 milestone Mar 15, 2015
@scztt

I would love to get this fixed for 3.7, but I don't we've got the domain expertise at the moment to dive into it at the moment.... I would gladly help anyone who wants to investigate, but I don't have the bandwidth to ramp up on Convolution3 any time soon. A buffer bounds problem is serious, since an overflow could corrupt adjacent memory.

Stepping through Convolution3_Ctor and Convolution3_next_a in a debugger to validate that buffer sizes are correct would be a good start.

@scztt scztt modified the milestone: future, 3.7 Jun 7, 2015
@vivid-synth

@joslloand would you mind putting the code block in code markdown (between "```"s?) -- some exponentiation ("**") is being interpreted as markdown bolding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment