Psychtoolbox Demos / Tutorials

Hi all.

A while back I wrote a bunch of demos for PTB. These seemed to prove useful to folk, but thanks to Adobe I was for a long time not able to update my website. I also got a lectureship, so my time for doing coding (or anything fun) vanished. This meant the PTB demos kind of went into hibernation.

I have finally found time to re-do the website (without Adobe). The PTB demos can be found here (at the same URL as before):

All links to code should work, but currently the demo images and movies are not linked. I will be working to reinstate these.

The new site is https, but if you use the previous http links, it should auto-direct you to the https version. A known issue is that the site doesn’t render great on smartphones in portrait orientation. Again I am working on this.

The site structure is different - no longer a single page per demo. Rather, a single page for the demos with links to code (and when I fix it, movies and images). Apologies if anyone bookmarked specific demos pages: those links will not work. The “breaking” change was due to the website becoming unmanageable to update with so many individual pages (even with css).

I am hoping to finally get around to making some more demos. As such, I would like to get some community feedback as to what would be useful. Or, similarly, if adding anything is not worth the effort.

Please post to this thread if you have any suggestions.




Hi Peter,

I am glad you are picking this up again, making the demos available again–I think you are reaching a lot of people with them! The only demos i could think of are one or two showing how to play videos, with and without sound. You have covered all the bases very well already.

Thanks for the effort!
All the best,


Thanks Dee. It has been on the radar for a long time, but I simply did not have any free time to allocate to it. Video is a good point. From my perspective I think the largest gaps are in the areas which I do not do research. Video (as you say) & sound.

I also plan to make the resources I have for a MSc Matlab course I teach available (screencast, slides, code), and will be teaching a new Python course in the spring. So hopefully the material will grow further. Thats the plan anyhow.

It would be great to get some more community feedback. Else, I will just add some more with educational guesses.

Hope all goes well for you. It would be great to catch up at some point.



I also think playing video would be a great addition. There are a couple of tricks to playing video flexibly:

  1. Using with other animated stimuli – by default video playback at a framerate other than the fps of the display causes PTB to wait for the next frame. So if you also want to animate anything else at the fps of the display that is a problem. One solution is to buffer each frame, if the next frame is not ready than use the previous one.
  2. Transparent video – it is nice if the video can blend with the background, and that is possible using this trick: Playing Transparent Videos via PTB

I would be happy to contribute a demo demonstrating these two tweaks if it would help. Your demos are so useful to many new PTB users, thank you for all your work on this! :star_struck:

Sure. That would be great. There is a section for contributed code. I pretty much never use video, so do not know many of the tricks.


Hi Peter,

Did you manage to work on your material? I’d be happy to review etc.

Hope all is well and we see each other around some time (not planning to go to VSS tho).


@pscarfe Thank you for doing this. I am new to psychtoolbox and am trying to figure out how to learn to use it. I clicked on the link to your website but it does not work. Do you know of anyway around this?

Hi everyone,

I’m a baby beginner in Psychtoolbox and I’m writting a script for my Ph.D experiment.
I was using very usefull tutorials on but unfortunally this link don’t work anymore.
I wanted to make a CountDown Screen display during resting between 2 recorded trials.
Is there some new link about same tutorials or is somebody have idea about a countdown tutorials on psychtoolbox ?

Really thanks for your work and your answers.


A somewhat older (I think?) but fully complete version can be found here:


Wow, this is perfect !
Thank you.
Have a nice day.

It should be fixed now.


Hi Dee,

Sorry for the late reply, I do not regularly check this forum.

I will DM you via email.