How can I play a movie and a set of sounds AT THE SAME TIME?
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Laura Colomar
le 12 Déc 2020
Commenté : Laura Colomar
le 13 Déc 2020
Hello,
I am trying to code the following cognitive task: 4 tones (300ms duration) played 100 times each, in random order, WHILE playing a movie. For the tones, everything works fine: I created a loop that, for each trial, picks randomly a tone and an intentrial interval, and plays it with the 'soundsc' function. I want now to add a silent movie so the participant can be watching it while listening to the sounds but I don't know how to do it.
I tried to do it using Psychtoolbox and the video demos they provide. However, I only manage to play the movie and, ONCE THE MOVIE ENDS, keep running the code and so, play the sounds. I also tried to generate an array with the 400 together, and then play it using 'soundsc'. Once the sounds are playing, I can play the movie so the two stimuli run in parallel. However, I am afraid that by doing this I won't be able to send a marker to the EEG recording for every trial (i.e. tone).
Any idea would be highly appreciate!
Laura
0 commentaires
Réponse acceptée
Walter Roberson
le 12 Déc 2020
You appear to be doing a psychophysical experiment.
Unless you use Psychtoolbox, you are unlikely to be able to do what you want to the precision that is normally required for those kinds of tasks.
I see what you said about Psychtoolbox, and it looks to me as if you did not use the right parts of it. For example you would not use a Mathworks video player for it: you would queue a number of frames and use the screen swap facilities that the toolbox offers.
But to answer your question within MATLAB:
You can use audioplayer, and configure the TimerFcn callback in it. Each time the callback fires, set the CData property of an image() object to the content of the next video frame.
There are also approaches using videoplayer and using audio system toolbox audio output facilities and system objects.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Using audio files 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!