Hi, I want to play two different tones at a same time, but one of the tone on left channel of headphone and another one on right channel. The whole period of tone is 2 minutes and the inter-stimulus-interval is 2s. After that save as WAV file. The Matlab code as shown below. Any help will be appreciated.
fs=10000; % sampling frequency
tone_dur=100e-3; % tone duration, 100ms
t=0:1/fs:100e-3; f1=1000; % tone frequency 1 = 1000Hz
f2=1500; % tone frequency 2 = 1500Hz
MymonoL=sin(2*pi*f1*t)'; MymonoR=sin(2*pi*f2*t)';Mysound = [MymonoL MymonoR];n=100e-3*fs+1; %no of sample per tone
%%Generate a 2 minutes (120s) vector
total_time = 120;total_time_sample = total_time*fs; % total no of time sample in 120s
sequence=zeros(total_time_sample,2); temp = 0; % temporary total number of samples
while(temp < total_time_sample)% Inter-stilulus-interval (ISI)= 2s
ISI_interval = 2*fs; % number of sample per ISI
temp = temp+ISI_interval;sequence(temp+(1:n)) = Mysound;if temp+ISI_interval > total_time_samplebreak;end endwavwrite(sequence,fs,32,'tonesLR');
Best Answer