VST Code generation issues with element-wise multiplication
3 views (last 30 days)
Show older comments
The following code produces audible discontinuities when compiled to a VST:
gains = [0.5, 0.725];
out = in .* gains;
But this works fine
gains = [0.5, 0.725];
out = [in(:,1) * gains(1), in(:,2) * gains(2)];
Is this a known issue with code generation?
0 Comments
Answers (1)
VBBV
on 11 Nov 2022
gains = [0.5, 0.725];
in = rand(8)
out = [in(:,1) * gains(1), in(:,2) * gains(2)]
out = in .* gains % check the matrix multiplication rule
3 Comments
Jimmy Lapierre
on 11 Nov 2022
I was able to reproduce the issue. I will investigate further.
>> p=loadAudioPlugin('GainTest.dll')
p =
VST plugin 'GainTest' 2 in, 2 out
>> process(p,ones(4,2))
ans =
0.5000 0.7250
1.0000 1.0000
1.0000 1.0000
1.0000 1.0000
Please use the workaround in the meantime.
p.s. modifying the input in-place is allowed, so it could look like this:
function x = process(~,x)
gains = [0.5, 0.725];
x(:,1) = gains(1)*x(:,1);
x(:,2) = gains(2)*x(:,2);
end
See Also
Categories
Find more on Audio Plugin Creation and Hosting in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!