Render a function as an audio file

Hi,
I used to render a function as a soundfile with the method renderlike this:

{}.render(path, duration: 10, fadeTime: 0.02, sampleRate: 44100, headerFormat: "AIFF", sampleFormat: "int24")

Using the extension from the quark wslib:
[/…/…/Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Lang/Shortcuts/extFunction-render.sc]

But now I cannot get it to work. I am in OSX HighSierra. It seems to be related to the non writable /tmp/ folder mac OS

The Error is

ERROR: Failed to write OSC score file: Could not open temp_oscscore1006 for writing

The search took me to this
pull request
though it is closed I don’t get it if I have to do something in my system or if it can be fixed from supercollider.
Thank you for the help!

The problem is line 51 in extFunction-render.sc:

		oscFilePath = "temp_oscscore" ++ UniqueID.next;

It’s better practice, when writing a file, to specify the full path. But here, the path is just SC’s current working directory, which is not guaranteed to be writable.

Try changing this line:

		oscFilePath = PathName.tmp +/+ "temp_oscscore" ++ UniqueID.next;

The pull request that you referenced changes the default PathName.tmp in OSX to something that is supposed to be OK for score rendering. (The problem here is that wslib was not using the “official” temp directory, so it didn’t benefit from the PR fix.)

hjh

Thank you James. That was the culprit. It is a very useful method for sampling.

Alejandro