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):

https://www.peterscarfe.com/ptbtutorials.html

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.

Thanks

Peter

7 Likes

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,
Dee

3 Likes

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.

P

2 Likes

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:

1 Like

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.

P

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).

Cheers,
Dee

@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 https://peterscarfe.com/ptbtutorials.html 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.

Gaby

A somewhat older (I think?) but fully complete version can be found here:
https://web.archive.org/web/20150312224413/https://peterscarfe.com/ptbtutorials.html

Cheers,
Dee

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

It should be fixed now.

P

Hi Dee,

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

I will DM you via email.

P

Hi all,

I have finally started to work on the PTB tutorials again. The site will now be updated with separate pages for each of the tutorials with embedded text, code, images and movies (as it was previously). In the process of doing this I will be updating all of the code and also adding additional tutorials.

https://www.peterscarfe.com/ptbtutorials.htm

I am also in the process of writing a paper that will introduce the tutorials and be something that you can cite if you have used them as the basis of your experimental code. This is pretty much the thing that has most been requested of me since doing the tutorials years back.

Additionally, I will be (over a longer time frame) providing a Youtube series of videos for learning Matlab and PTB. This will be based upon a course that I have run for many years, but with some improvements and additions.

I aim to get the all of the website done by the end of October 2022. The Youtube videos will be up in a basic “complete” form in the spring of 2023.

I am not sure when the paper will appear, I have only just started working on it. So watch this space.

As always, I am very open to suggestions of additions and improvements. I have very much just focused on what I think would be useful for people to know from my own experience.

Peter

Dear all,

As promised I have been working though all the PTB demos/tutorials, adding new webpages and updating the code and adding new content as I go. The demos can be found at the standard link. I am about 3/4 through updating things.

To aid some issues with ensuring the html works in real life, I am updating the site live as I go. To access the old page please see the link at the top of the webpage link above. Once I am done updating I will remove the old page as it will be massively outdated.

As always, I would love to have community input into features that they would like to see. I have had ~2 peoples input from previous pleas, and would love more so that the content reflects what the community would like to see. Just post a reply to this thread with any suggestions.

Peter

Dear all,

After a huge amount of work in my spare time, the new webpages for all of the demos/tutorials are pretty much complete. I have expanded things as I have gone along, so there are now over 85 tutorials. I will be deleting the legacy webpage which was in place whilst I was updating everything.

I have flagged demos which are “in the works” and “coming soon”. These will appear as and when I have time.

Here is the link: Scarfe Lab: PTB

The future…

(1) I finally, after many requests, will be publishing a paper on the demos. This has probably been the most requested thing. I hope to get a preprint up sometime over the summer and will share the link.

(2) I will be launching an online questionnaire sometime over the summer to find out how much and in what way the tutorials are used. I know that a number of folk at universities across the world use them in their teaching and I get the occasional email from users, but I would like to get something more concrete.

Why?.. I do these all in my spare time. My employer does not provide me any time or money to do these and my time is limited. Therefore, I would ideally like to make a case to my employer that (a) these are educationally useful, and if (a) is true, (b) they might want to provide some kind of support to me. For that I will need watertight evidence and some kind of unique planetary alignment. But it is worth a shot, so watch this space…

As always, please contact me if there are errors in the code or if you have any suggestions. I very much just make what I think might be useful. Despite many requests I have been given very few suggestions, so I just assume what I have been adding is ok.

Peter

1 Like

Hi Peter,
Thank you for your demos. I am new to PTB and your work has helped me a lot with my PhD. Looking forward to your paper.
Congratulations for your work!

Maria

1 Like

Hi,

I really like your first idea of buffering frames for video playing. Could you share an example?

We are planning a study with a lot of video stimuli. Though video is played at 30 fps, we wish to interact with an eye-tracker at a much higher frequency. Your suggested solution would be very helpful to us.

Thanks,
Gabriel