# How to Concatenate white noise signal and applying bandpass filter matlab

I created a white noise signal. I am trying to use the array I have created with the white noise to play in 2 channels. When the left channel I was trying to have 5000 samples and the right will have 0 and when in the right channel it will have 5000 samples and the left will be 0(which means no sound from this channel). I keep getting an error when trying to concatenate the sounds and I think I messed up with the loop because every time it loops it will do 5000 samples and I only need 5000 total with a 10000 sample pause in between the 2 sounds. I also had trouble writing the band-pass filter into the code but it worked when using the FDAToool. Any help would be appreciated.

fs = 44.1; %Sample Frequency khz
L=5000; %Sample length for the random signal
P=10000; %Sample Pause Gap
mu=0;
sigma=2;

Left_signal = [sigma*randn(L,1)+mu 0];
Right_signal = [0 sigma*randn(L,1)+mu];

%Loop thru all samples
for num = 2:L,
%Time
%t = num *(1/Fs);
Left_signal = [Left_signal; sigma*randn(L,1)+mu 0];
end

Pause = zeros(P,2);

for num2 = 2:L,
%time
%t = num2 * (1/Fs);
Right_signal = [Right_signal; 0 sigma*randn(L,1)+mu];
end

Long_signal = [Left_signal; Pause; Right_signal];

• I'm quite confused by your question. My interpretation of what you want: sound from left channel only (5000 samples), 10.000 samples pause, sound from right channel only (5000 samples). Is that it? Commented May 26, 2014 at 7:23
• Yes @Matt L. But I need the opposite channel to be silent so while the left would have 5000 active sounds the right will be silent with 5000 zeros Commented May 26, 2014 at 12:09
• I understand. Please check my answer below. Commented May 26, 2014 at 12:17

L = 5000;