removing vocal from audio file I want to create a program in matlab that could act like karaoke software. At this moment i have following lines of code:

clear all;

[y1, fs1] = audioread('miszmasz.wav');
[y2, fs2] = audioread('voice.wav');

%checking if there is an audio file
if y1 == 0
    return
elseif y2 == 0
    return
end

%spliting into left and righ 
leftSignal = y1(:,1);
rightSignal = y1(:,2);
voiceSignal = y2(:,1);

leftSignalLength = length(leftSignal);
rightSignalLength = length(rightSignal);
voiceSignalLength = length(voiceSignal);

%furier transform of left, right canal and voice sample
NFFT = 2^nextpow2(voiceSignalLength);
leftSignalFFT = fft(leftSignal, NFFT)/voiceSignalLength;
rightSignalFFT = fft(rightSignal, NFFT)/voiceSignalLength;
voiceSignalFFT = fft(voiceSignal, NFFT)/voiceSignalLength;

for i1 = 1:leftSignalLength
    leftSignalFFT(i1) = leftSignalFFT(i1) - voiceSignalFFT(i1);
end

for i2 = 1:rightSignalLength
    rightSignalFFT(i2) = rightSignalFFT(i2) - voiceSignalFFT(i2);
end

leftOutput = ifft(leftSignalFFT);
rightOutput = ifft(rightSignalFFT);
finalOutput(:,1) = leftOutput;
finalOutput(:,2) = rightOutput;

%wavwrite(y_Out, fs1, 'output.wav');
audiowrite('miszmasz_output.wav', finalOutput, fs1);


unfortunately, it does not work. Any tips?
If my guess is right, your code show you trying remove the vocal from  second audio, the first audio must be the original vocal and the second is some mix (vocal + music)...

So if my guess is true start trying a simple approach to test, here my simple test.

I get just 4096 points of some audio voice and mix with a sine 4096 points in 200hz sampled in 1600hz, all mono.

Plot 4096 voice points:



Now plot a sine in 200 Hz:



Now the Mix (sine + voice):



Now to get the original sine without the voice you need do:

real((ifft(fft(mix) - fft(voice_Signal))))


The final plot after the step above:



course is a very simple test, and in this case we're telling you to have the original clean audio voice before being mixed ...