Creating circular thumbnails in the terminal

Circular pictures (like the one to the right) has become increasingly popular on the web. We have, for example, included circular pictures in RITMO’s annual report, and we therefore also wanted to use circular pictures in a presentation at our upcoming LARGO conference. The question, then, is how to create such circular pictures?

The circular pictures in the annual report are made through a CSS overlay. So if you try to right-click and save one of those, you will get the original rectangular version. It is, of course, possible to add circular thumbnails in the presentation software, using the circular crop function in PowerPoint or add mask function in Keynote. The challenge with these, however, is that you may get into trouble if you move your presentation from one program to another. I often prefer to make presentations in Google Presentation, and there is no such feature there.

The most bullot-proof solution is therefore to create new circular images. This can be done in photo editing programs, such as the circle image function in GIMP. But for a centre of the size of RITMO (50+ people), and with many people coming and leaving all the time, I would rather prefer an automatic solution. I therefore decided to figure out how to do this in the terminal.

It turns out that Imagemagick comes to the rescue once again. Here is a one-liner for creating a circular PNG image from a JPG file:

convert alexander.jpg \( +clone -threshold -1 -negate -fill white -draw "circle 100,100 100,0" \) -alpha off -compose copy_opacity -composite alexander_circle.png

This will take a regular image like this:

and make it into a circular image like this:

Since the original was a 200x200px image, I used the code “circle 100,100 100,0” in the script to ensure that the circle would be in the centre of the image.

The next step was to extend the script to read all the JPG files in a folder and convert them into circular images. This can be done like this (at least on Ubuntu):

#!/bin/bash

for i in *.jpg;
do
  name=`echo $i | cut -d'.' -f1`;
  convert "$i" \
  \( +clone -threshold -1 -negate -fill white -draw "circle 100,100 100,0" \) \
  -alpha off -compose copy_opacity -composite $name.png;
done

Save the script as circle_image.sh (or whatever else you prefer), make it runable (chmod u+x circle_image.sh), and run it (sh circle_image.sh), and you get a bunch of circular images that you can be used in any program around. Scripting is fun!

Carpentries Train the Trainer

I have spent the two last days at a “Train the Trainers” workshop organized by the Carpentries project. Here I will summarize some thoughts on the workshop, and things that I will take with me for my own teaching practice.

The Carpentries

The Carpentries project comprises the Software Carpentry, Data Carpentry, and Library Carpentry communities, with a shared mission to teach foundational computational and data science skills to researchers. I have taken several Carpentries lessons over the last years, organized by volunteers here at the University of Oslo.

One of the best things about the Carpentry workshops, is that they are very practical. The idea is that you learn some concrete skills, in a hands-on manner. I also like that the workshops are very inclusive. Everyone can participate and in my experience you always find a mix of students, support staff, postdocs and faculty members. It is very rewarding to get acquainted to people outside your regular “bubble”, and it definitely creates a different learning environment than the normal student-oriented semester-long courses. I also think it is healthy for everyone to see professors struggle with the same things as everyone else.

Another great thing about the Carpentries is the focus on short, intensive workshops with a clear focus. This is an example of what I like to call micro-education, as opposed to our regular focus on semester-long courses and year-long degrees. In an ever-changing world, everyone needs to learn new things all the time. I don’t think universities (in general) do enough to meet this need.

Own practice

Inspired by some of the Carpentries courses I had participated in, I decided to develop a carpentry-inspired course myself: Quantitative Video analysis for Qualitative Research. This short workshop is intended as a tutorial for the Musical Gestures Toolbox for Matlab, and was developed with the Carpentries template.

The course material template is but one thing of the Carpentries. There is also a teaching philosophy that I wanted to learn more about. So when I was challenged (and inspired) to become a certified instructor myself, I decided to sign up for the instructor training.

Online instructor training

I am more than averagely interested in new learning methods, so I was curious to see how the Carpentries instructor training was carried out. For the training we were around 20 learners from around the world and two instructors. One of the instructors, Lex Nederbragt, is working at UiO, and he had secured that the six of us that were taken the training from Oslo where gathered in one room on campus. Such a mix of on-campus and off-campus learners is an interesting challenge in itself. Having a sizeable minority of learners being physically co-located creates a different group dynamic than if everyone had been sitting separately.

The video communication was run on Zoom, a platform I have become very acquainted with through the MCT master’s programme. As opposed to Skype, Hangouts, and similar, Zoom consistently works reliably on all platforms (including Ubuntu), and it has great support for handling changing hardware. I have been adding/removing sound cards, headsets, cameras, etc. during Zoom sessions without any issues. Most other solutions would crash or require restarts to make this work.

Another nice thing about Zoom is that allows for creating breakout rooms, which means that a larger group can be split into sub-groups for local discussion. The instructors used this very effectively during the training, splitting us up in smaller groups for exercises throughout the days. The only challenge here was for the six of us sitting physically together. We had to also split up and move into different rooms for these exercises. It worked fine, but it is interesting to reflect on the different experience the Oslo group had from the online participants. Personally I connected primarily with the local Oslo people, and did not interact at all with any of the online participants. I think it might have worked better for the whole group if everyone had been sitting separately. That way we could all have collaborated more easily.

Take-aways

Some of the most interesting things I picked up during the training:

Mental models: It is important to identify the different mental models that learners may use for any given task. These can be used as the starting point for developing better formative assessment, such as creating good wrong answers to multiple choice tests. Rather than just making randomly wrong answers, they should be based on different mental models that one may assume that the learners may have.

Developing skill: Carpentries embrace the Dreyfus model of skill acquisition and the need to move upwards through Bloom’s taxonomy. While I generally agree with this, I often like to start on top of the Bloom pyramid. In my experience, having people feel that they “master” a tool quickly often help in making them interested in learning more about the underlying concepts. Not everyone wants to become software engineers, most people just want to learn enough to solve their problem.

Concept maps: This is a tool to help develop a complete lesson through drawing a picture of someone’s mental model of a domain: facts are bubbles, and connections are labelled arcs. It is particularly important to explain what the relationship is. Planning how different parts of a course is interconnected is very important, but is something that many of us don’t spend enough time on, I think.

Teach as a learner: This is related to using the mindset of a learner when teaching. Acknowledging your faults as a teacher may be a good strategy for helping students learn more themselves.

Never teach alone: I fully agree with this one. Teaching together helps identify learners that struggle with something, and it is a good way to develop better teaching practice with a colleague. The challenge, of course, is that we usually don’t have the resources available for two teachers for most university courses.

Teach slowly: the live coding strategy employed at Carpentries is an effective way of slowing down the teacher, and makes it easier to follow along.

Make and solve errors: live coding also means that errors will have to be handled on the fly by the instructor. There is a lot of learning involved in seeing someone else troubleshoot code, so this should be embraced. I have been live coding as a teacher for more than a decade now, so I am very used to it. But I still remember how challenging it was to get started with all the realtime, public error-handling in the beginning.

Code of conduct: The Carpentries are very conserned about being an inclusive community. Thus the code of conduct is easily available on the web pages, and it is also explicitly mentioned at the beginning of lectures. I think this is something that should be embraced more generally in teaching.

Feedback strategies: There is a very structured approach to feedback in Carpentries:

  • Feedback is delivered in the form of pre-workshop and post-workshop questionnaires. This is useful to learn about the learners’ skills before the course, but also to follow their progression from beginning to end.
  • Minute cards are used before lunch with the focus on writing down one positive thing and something that could be improved.
  • 1up-1down evaluations are used to receive oral feedback from each of the learners.

Stick-it notes: We didn’t use it during the instructor training, but the use of stick-it notes is another “feature” of Carpentries. When carrying out tasks, learners put a yellow stick-it on their laptop when they are done, and put a read if they have questions. This is an efficient way of ensuring that people are on track or have problems.

Summing up

All in all it was very interesting to take part in the instructor training. I have been doing many different types of teacher training over the years, but this one was by far the most practical and hands-on. As such, it fits nicely into the Carpentry philosophy: provide hands-on tools for real-world problems.

I am looking forwards to developing and running my own Carpentry-courses in the coming years, and I am also quite sure that I will use several of these methods in other teaching as well.

NIME publication and performance: Vrengt

My PhD student Cagri Erdem developed a performance together with dancer Katja Henriksen Schia. The piece was first performed together with Qichao Lan and myself during the RITMO opening and also during MusicLab vol. 3. See here for a teaser of the performance:

This week Cagri, Katja and myself performed a version of the piece Vrengt at NIME in Porto Alegre.

We also presented a paper describing the development of the instrument/piece:

Erdem, Cagri, Katja Henriksen Schia, and Alexander Refsum Jensenius. “Vrengt: A Shared Body-Machine Instrument for Music-Dance Performance.” In Proceedings of the International C Onference on New Interfaces for Musical Expression. Porto Alegre, 2019.

Abstract:

This paper describes the process of developing a shared instrument for music–dance performance, with a particular focus on exploring the boundaries between standstill vs motion, and silence vs sound. The piece Vrengt grew from the idea of enabling a true partnership between a musician and a dancer, developing an instrument that would allow for active co-performance. Using a participatory design approach, we worked with sonification as a tool for systematically exploring the dancer’s bodily expressions. The exploration used a “spatiotemporal matrix,” with a particular focus on sonic microinteraction. In the final performance, two Myo armbands were used for capturing muscle activity of the arm and leg of the dancer, together with a wireless headset microphone capturing the sound of breathing. In the paper we reflect on multi-user instrument paradigms, discuss our approach to creating a shared instrument using sonification as a tool for the sound design, and reflect on the performers’ subjective evaluation of the instrument.

NIME publication: “NIME Prototyping in Teams: A Participatory Approach to Teaching Physical Computing”

The MCT master’s programme has been running for a year now, and everyone involved has learned a lot. In parallel to the development of the programme, and teaching it, we are also running the research project SALTO. Here the idea is to systematically reflect on our educational practice, which again will feed back into better development of the MCT programme.

One outcome of the SALTO project, is a paper that we presented at the NIME conference in Porto Alegre this week:

Xambó, Anna, Sigurd Saue, Alexander Refsum Jensenius, Robin Støckert, and Øyvind Brandtsegg. “NIME Prototyping in Teams: A Participatory Approach to Teaching Physical Computing.” In Proceedings of the International Conference on New Interfaces for Musical Expression. Porto Alegre, 2019.

MCT at NIME
Anna Xambó presents the paper “NIME Prototyping in Teams: A Participatory Approach to Teaching Physical Computing” at NIME 2019.

Abstract:

In this paper, we present a workshop of physical computing applied to NIME design based on science, technology, engineering, arts, and mathematics (STEAM) education. The workshop is designed for master students with multidisciplinary backgrounds. They are encouraged to work in teams from two university campuses remotely connected through a portal space. The components of the workshop are prototyping, music improvisation and reflective practice. We report the results of this course, which show a positive impact on the students on their intention to continue in STEM fields. We also present the challenges and lessons learned on how to improve the teaching and delivery of hybrid technologies in an interdisciplinary context across two locations, with the aim of satisfying both beginners and experts. We conclude with a broader discussion on how these new pedagogical perspectives can improve NIME-related courses.

RaveForce: A Deep Reinforcement Learning Environment for Music Generation

My PhD student Qichao Lan is at SMC in Malaga this week, presenting the paper:

Lan, Qichao, Jim Tørresen, and Alexander Refsum Jensenius. “RaveForce: A Deep Reinforcement Learning Environment for Music Generation.” Proceedings of the Sound and Music Computing Conference. Malaga, 2019.

The framework that Qichao has developed runs nicely with a bridge between Jupyter Notebook and SuperCollider. This opens for lots of interesting experiments in the years to come.

Abstract:

RaveForce is a programming framework designed for a computational music generation method that involves audio sample level evaluation in symbolic music representation generation. It comprises a Python module and a SuperCollider quark. When connected with deep learning frameworks in Python, RaveForce can send the symbolic music representation generated by the neural network as Open Sound Control messages to the SuperCollider for non-realtime synthesis. SuperCollider can convert the symbolic representation into an audio file which will be sent back to the Python as the input of the neural network. With this iterative training, the neural network can be improved with deep reinforcement learning algorithms, taking the quantitative evaluation of the audio file as the reward. In this paper, we find that the proposed method can be used to search new synthesis parameters for a specific timbre of an electronic music note or loop.