Automate the reading of a generative composition every day

Hi there,

I’m working on an generative installation that will be shown in the public space. The piece unfolds over 13 hours, from morning to night. I wander how to automate the starting of the generative composition, everyday at the same time (the installation will be shown for one month in june).

Thanks a lot :slight_smile:


The mechanics will depend on the operating system… Windows? Mac? Linux?


The computer at the exhibition space is Windows !
But I work with MacOs

Actually most of it is the same:

  1. Get the code so that you can load the whole piece by executing one file. (This file may load other files – see “path-to-file.scd”.load.) You should not have to run several blocks – just one block, complete contents of the main file.

  2. Then try it from the command line with sclang main-file.scd. In Windows you might need to cd to the SC directory in Program Files first. Mac would be sclang main-file.scd; Windows, sclang.exe main-file.scd. You might need a full path to the scd script.

  3. Then, make a script (Mac) or batch (Win) file so that you just run this file to launch sclang with your code.

  4. Then, add the script as a system startup item.

The devil is in the details, but that’s the outline.


In terms of running a command at a specific time of day…

I’m not a windows user. But see if any of this is useful to you: How to add a cron job or scheduled task on Windows

On a Mac, use cron jobs: Schedule jobs with crontab on macOS | Ole Michelsen

Hope this is helpful.

Though, if you would rather do this entirely in sclang, you can… just make sure your code is executed whenever the system boots up:

// this will run your code at 7am:
var hour = 07;
var minute = 00;
// set this to false if you don't want your code to run if you execute
// sometime in the day after your scheduled start time:
var armed = true; 
fork {
  loop {
    var d = Date.getDate;
    var fired = false;
    if ((d.hour < hour) or: ((d.hour == hour) and: (d.minute < minute))) {
      armed = true;
    if ((d.hour == hour) and: (d.minute == minute)) {
      fired = true;
      armed = false;
    if (armed) {
      if ((d.hour > hour) or: ((d.hour == hour) and: (d.minute > minute))) {
        fired = true;
        armed = false;
    if (fired) {
      ("This function will execute once a day at " ++ hour ++ ":" ++ minute).postln;
1 Like

You may want the DayTimer Class:

1 Like

It appears that this quark implements the skipjack class… which would have been my next suggestion.

After creating your daytimer instance, you can run .skip on your day-timer object in order to gain access to any of the methods defined by the implementing class… along with those defined explicitly in the extension.

SkipJack is simply a convenience class, for creating threads that survive cmd-period.


use a rpi with patchbox running

Install the module from dormirj

“program” a simple plug-in timer