Info

此问题已关闭。 请重新打开它进行编辑或回答。

Matlab coder error from conversion to C++.

1 次查看(过去 30 天)
멋진남자
멋진남자 2023-12-6
关闭: 멋진남자 2024-2-5
I want to conversion matlab wsolaTSM.m and pitchShiftViaTSM.m to C++ code.
So I success these but little bit problem.
When I converion to C++ in matlab coder error message below.
[error message]
The left-hand side has been constrained to be non-complex, but the right-hand side is complex. To correct this problem, make the right-hand side real using the function REAL, or change the initial assignment to the left-hand side variable to be a complex value using the COMPLEX function.
[matlab code]
%%%%%%%%%%%%%%
stft.m
%%%%%%%%%%%%%%
% spectrogram calculation
%%%%%%%%%%%%%%
spec = zeros(winLenHalf+1,numOfFrames);
for i = 1 : numOfFrames
xi = xPadded(winPos(i):winPos(i) + winLen - 1) .* w;
if parameter.fftShift == 1
xi = fftshift(xi);
end
Xi = fft(xi);
spec(:,i) = Xi(1:winLenHalf+1); %-> error occured code
end
%%%%%%%%%%%%%%
So I modified code like this.
spec(:,i) = real(Xi(1:winLenHalf+1));
but
The sound of the converted wave file is low.
The sound quality is poor.
[Question]
Is there a way to convert it to C++ code without changing the sound quality?
The code is as follows and is a complex code made up of several functions.
Thank you for reading to my question.

回答(0 个)

此问题已关闭。

产品


版本

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by