Adding a beep cue before a specific location
Show older comments
Hi all, I have generated 5 different sounds in each block/trial I now need a pure tone cue to be generated in each block before the 5th sound is generated. How can i do that ? Please help.
{function out = makeTrain(in)
%in would be a list eg: [1 2 3 4 5;3 4 5 1 2; 2 3 4 1 5;...]
wavdir = 'C:\sounds';
out = [];
% isi = 500ms
isi = 500/1000 * 44100;
isi = zeros(isi,1);
cueTone = mktone(2500, 300,10,1000/44.1,1);
% this function generates a pure tone of f=2500 Hz, t=300 ms,
fs=44100 Hz
cueTone = cueTone/max(cueTone);
for idx = 1:length(in)
switch in(idx)
case 1
wavfile = [wavdir 'ka.wav'];
case 2
wavfile = [wavdir 'pa.wav'];
case 3
wavfile = [wavdir 'ga.wav'];
case 4
wavfile = [wavdir 'ba.wav'];
case 5
wavfile = [wavdir 'da.wav'];
end
snd = wavread(wavfile);
if idx == 1
out = snd;
else
out = [out;isi;snd];
end
end
out = [??]
end
}
Accepted Answer
More Answers (0)
Categories
Find more on Audio I/O and Waveform Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!