How can I play a movie and a set of sounds AT THE SAME TIME?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Laura Colomar
el 12 de Dic. de 2020
Comentada: Laura Colomar
el 13 de Dic. de 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 comentarios
Respuesta aceptada
Walter Roberson
el 12 de Dic. de 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.
1 comentario
Más respuestas (0)
Ver también
Categorías
Más información sobre Timing and presenting 2D and 3D stimuli en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!