필터 지우기
필터 지우기

Problem sound-image?

조회 수: 2 (최근 30일)
LuS
LuS 2015년 10월 19일
댓글: LuS 2015년 10월 19일
Hi All,
I am struggling a bit with a script that I would like to create for my experiment:
a sound is played and 1 sec after the end of the sound an image is displayed on the screen for 3 secs.
Does anybody have the solution to my problem?
Please :)
Many thanks!!
%Open the screen
[wPtr,rect]=Screen('OpenWindow',max(Screen('Screens')),[], [0 0 900 900]);
xCenter=rect(3)/2;
yCenter=rect(4)/2;
%Create textures
srcFiles = dir('c:/Users/LuS/Desktop/Project1/Images/*.jpg'); % the folder in which the images exists
for i = 1 : length(srcFiles)
Images = strcat('c:/Users/LuS/Desktop/Project1/Images/*.jpg',srcFiles(i).name);
I = imread(Images);
figure, imshow(I);
Screen('DrawTexture',wPtr,[], Images);
Screen('Flip',wPtr,[], Images);
[imageHeight, imageWidth,colorChannels]=size(Images);
gap=100; %distance of pics from center
leftRect=[xCenter-gap-imageWidth, yCenter-imageHeight/2, xCenter+imageHeight/2];
rightRect=[xCenter+gap, yCenter-imageHeight/2, xCenter+gap+imageWidth, yCenter+imageHeight/2];
textures=[filelist];
textureNames={filelist};
end
%Read sounds
filelist=dir('c:/Users/LuS/Desktop/Project1/Sounds/*.wav'); % the folder in which the sounds exists
for K=1:numel(filelist)
[data,Fs]=wavread(filelist(i).name);
result(i)=your_action(data,Fs);
end
  댓글 수: 1
Walter Roberson
Walter Roberson 2015년 10월 19일
You appear to be using the third party psychometric toolbox. The methods for displaying images in it are beyond our scope. Someone might happen to know, but it might take a while before anyone who knows happens to read the question.
My understanding is that the third party toolbox has an active mailing list.

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2015년 10월 19일
Are you asking how to clip your sounds to a maximum of 1 second? And how to play them with sound() or soundsc()?
And I'd guess that you'd need to put your sound playing code inside your loop over all images (rather than a separate loop after it), along with a pause(3) after you've displayed the image.
  댓글 수: 1
LuS
LuS 2015년 10월 19일
Hi,
Thank you for your reply. I would like to play the sound while the screen is grey and 1 second after the end of the sound, an image appears on the screen for 3 seconds.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by