Evaluating a complete .scd file

evaluating a complete .scd file

hello!

Is there a method, to run a complete .scd file by e.g. doubleclick?

I have a SC patch, that runs with a single evaluation operation from increasing server memory, starting the server across adding the SynthDefs and starting the Pbinds.

Is there a method, that allows to run the entire process from launching Sc across loading the file to playing it with only a double click on the .scd file?

I am working on a Mac system, but the method should work cross plattform.

thanks for any suggestions!

best

Rainer

On Emacs, there are 4 or 5 functions, one of which evaluates the current document (text buffer). (Also, you can reassign shortcuts/keybindings at any time)

EDIT: And, of course, you can write your function from those if you need something very specific, and bind it to a key (mouse buttons are possible, I believe).

That sounds like what the Standalone version of SC would enable.
I know there was some work done towards creating a universal Standalone of SC, but I’m not sure how far that progressed.
Maybe one of the developers knows? It would be a wonderful thing to have.
Best,
Paul

thank you!
what do you mean by „(text buffer)“ and a related function on iMacs?
the SC patch has been created on a Mac using Sequoia and SC 13.3, but not an iMac.
it should run on any computer with any operating system, SC is available for.
best
Rainer

I can’t seem to find a way to load an .scd file and have its contents
evaluated without user interaction:

Loading scide from the command line with a .scd as argument will open
that file but not evaluate its contents.

Executing sclang on the command line with an .scd as argument seems to
either not evaluate its contents or at least not post the results of
it (a simple 5.rand) back to the shell.

The only way seems to evaluate code from within startup.scd which has
quite a few drawbacks.

Is there really no Class to evaluate code blocks upon opening documents
(read: loadbang)?

Thanks,
best, Peter

Rainer,

the reply you are referring to mentioned a text editor spelled e m a c s
Some People use is as alternative to scide as it is a complex and powerful
editor with a long history on Unix systems. I guess your question
applies to the normal graphical Super Collider Integrated Development
Environment “scide” though.

best, P

Replying to my last post:

Executing sclang on the command line with an .scd as argument seems to
either not evaluate its contents or at least not post the results of
it (a simple 5.rand) back to the shell.
I just found out that I have to explicitly make it post via
5.rand.postln
to see the results on the shell. So yes, sclang is so far the only way
to load a .scd and have its contents evaluated without user interaction.

Still looking for a way that works for scide though.

best, P

It is evaluating, but command line isn’t the IDE so the posting behavior is different.

The IDE evaluates code blocks using interpretPrintCmdLine. “Print” is folded into this method, so, even if your code doesn’t explicitly .post or .postln, something will always be printed.

Command-line sclang does not use interpretPrintCmdLine, so there is no automatic posting. The only way to post is to write the post explicitly into the script. Additionally, at the command line there is no concept of returning an arbitrary value back to the shell. A process can return an exit code back to the shell; a nonzero exit code indicates that the operation failed, so it’s not really a good idea to use this for arbitrary data.

Maybe try a script like this. (In command-line usage, you’re responsible for exiting explicitly.)

5.rand.postln;
0.exit

At the command shell,

echo '5.rand.postln; 0.exit' >test.scd

sclang test.scd

It should print the startup log, then the random number, then exit.

hjh

1 Like

Thanks James,

yes it posts and exits, great! Now I am still wondering about automatic evaluation
within scide upon opening a .scd document.

best, P

See the Document.autoRun flag.

hjh

Thanks James,
and please excuse me not having looked it up myself there.
best, P

It’s an almost universal feature of software documentation that you need the documentation to know what the feature is called, but you need to know what it’s called in order to find the documentation :laughing: so no worries, it’s a good question. (I’m in the same position with, say, LilyPond for notation… “what is that called again?”)

hjh

Hi, Rainer,

Am I correct that you are Blind and using SC with AppleVoiceOver? I seem to remember an earlier post of yours about the inaccessibility of Discourse (the platform of this webforum).

I teach SC at a music school with lots of Blind and Low Vision (BLV) students, have taught computer science to BLV students, and am interested in increasing the accessibility of SC for BLV musicians.

What text editor are you using? Atom had a great SC package which, to my memory, was relatively functional for screen readers. Sadly, since Atom is deprecated I’m not sure what the best option currently is, but am curious.

I’ve heard from BLV coders that TextMate is the best text editor for use with AppleVoiceOver these days, but am, again, curious to hear what you’re using.

Best wishes from Boston,

Rachel

1 Like

dear James, dear Peter, dear Paul!
thanks alot for your suggestions!
the current solution looks as follows, and works at least on my Macbook Pro 14 M1 with Sequoia latest and SC 3.13:

  • a shell script „start.sh“ in the same directory as the .scd code file (which could be evaluated within the IDE by only 1 double click)
  • script: "/Applications/SuperCollider\ 3.13/SuperCollider\ 3.13.app/Contents/MacOS/sclang my_file.scd“.
    after running the script, the contained Pbind starts to play the contained SynthDef with no error messages.

best
Rainer
)

hi Rachel!
you are correct, I am blind.
I use SC since late 2020, and for a long time with no navigation issues in the IDE. I have not been aware of more convenient solutions.
Since some Mac Os updates, the situation in the IDE is different to theese times and rather inconvenient, and the most problems seem to be according to my experience lacking consistency within navigation in the IDE: sometimes it works quite well, sometimes it seems to me unpredictable where the cursor and focus land. Sometimes it gets better with a restart, sometimes not. And for me the most issue consists in the fact, that I still was not able to disable the autocomplete function: to my mind, it is off, as it is turned off, but it is still disturbing my typing. :slight_smile:
As I am currently studying ElectroAcoustic and Experimental Music at University of Music and Performing Arts Vienna, teachers made me aware of alternative text editors and Terminal solutions.
Currently I am testing „TextMate“ and „Cot Editor“, which are free, and I would like to test „Sublime Text“ as well.
As far as I can tell now, theese apps have no SC implementation by default, but I am still very new to them.
As a alternative Terminal app, I chose iTerm, but I have only little experience with it so far.
I also did install Visual Studio Code in order to work with Python, but we will have to figure out, what takes more efford - operating Python within this environment or within the Terminal.
I started working with all theese apps only about a month ago, so it will take some time and patience to get through, but I would be aprecheated to tell you about my experiences.
If you like, you could contact me off the forum for theese purpouse via rainer.kremser@icloud.com, as I am very interested in your experiences as well.
best from Austria
Rainer