function [out,Fs_out] = IECnoise(time,Fs,buff,playRec)
%NOISE Summary of this function goes here
%   Detailed explanation goes here
if ~exist("playRec","var")
    playRec = false;
end
if ~exist("buff","var")
    buff = 1024;
end

[s, Fsi] = audioread('CONT.wav');% file containing noise
if (Fsi == Fs)
    signal = s(1:Fs*time);
    
else
    s_u = resample(s,192000,48000); %upsampling
    s_r = resample(s,Fs,192000); %downsampling
    signal = s_r(1:Fs*time);
end
signal = cat(1,signal,zeros(buff,1));
if (playRec == false)
out = signal;
else
for j = 1:round(((length(signal)-buff)/buff)-1)
        start = (buff*(j-1))+1;
        stop = buff*j;
        if(j==1)
            rec = playRec(signal(1:stop)); %first buff
        else
            temp=playRec(signal(start:stop)); %all next buffs
            rec = cat(1,rec,temp);
        end

end
out = rec; %whole matrix
end
Fs_out = Fs;

