Borrar filtros
Borrar filtros

Problem sound-image?

2 visualizaciones (últimos 30 días)
LuS
LuS el 19 de Oct. de 2015
Comentada: LuS el 19 de Oct. de 2015
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 comentario
Walter Roberson
Walter Roberson el 19 de Oct. de 2015
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.

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 19 de Oct. de 2015
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 comentario
LuS
LuS el 19 de Oct. de 2015
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.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by