Problem sound-image?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Walter Roberson
le 19 Oct 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.
Réponses (1)
Image Analyst
le 19 Oct 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.
Voir également
Catégories
En savoir plus sur Audio and Video Data dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!