Changing the input file content for sclang

I’m trying to make supercollider run onto my Raspberry PI.
I followed a step-by-step guide to install it from source (supercollider/ at develop · supercollider/supercollider · GitHub)

So, now I can go with sclang /path/to/my/file/file.scd, and I can hear the audio.
I was wondering if it’s possible to somehow change the content for file.scd and let sclang get the changes and reproduce it? I tried by entering nano and changing it but it does not seems to work.



What your are trying to do is not possible as you try.

The simplest thing you can do is to plug sclang to a fifo and bind it’s input to a file you’re editing.
Not sure of the syntax, but in bash it’s definitely possible

Thanks for reply! Do you have any example on how to create this fifo on bash? Maybe I can investigate from that command.


Ola David,

so you want to change the content of the file while SC is running and load it again?

If so, as an alternative to the pipe, you could have a routine running inside sclang that periodically reloads the file and executes its contents, see

Let us know if you need help with that.

Thanks! I see there’s a method that read a file, so it’s possible to make something like

while(true) {
 previous = current;
 current = readFile(fname);

  execute the file content;

Inside of the file I’m passing to sclang?


Except you don’t have to separate reading and executing, unless you have a reason to – "..".load will do both for you.

If you only want to do this when the file has changed, you can use File.mtime to compare the modification time with the last time you loaded

PS: either way, you should definitely have your while loop in a routine and wait a bit each iteration. Otherwise your system will be fully occupied with checking the file thousands of times per second : )

OK, its just memory, and I don’t have any bash near me
For the fifo, you create it with mkfifo nameOfYourFIFO

in one terminal:

while true; do sclang < nameOfYourFIFO ; done

and in another terminal

cat aFile > nameOfYourFIFO


echo "().play" > nameOfYourFIFO