"\set" in an NRT score

Hello -

I am attempting to write an NRT score. I would like to take a synth and set different arguments over a period of time. Adding and removing the Synth is straightforward from the Help documentation on Non-Realtime Synthesis.

a = Score.new;
a = a.add([1.0, (x = Synth.basicNew(\m, s)).newMsg(args: [freq: 900])]);
a = a.add([12.0, x.releaseMsg]);

I am unclear about two things here, though.
First and most importantly, how would I go about using an OSC Cmd to set the frequency of the currently playing Synth?
Secondly, this is written differently than it would be in the Score helpfile. In the latter case, it would include a node ID number. Does this distinction matter? Which way of writing is formally more accurate?

Thank you for the clarifications

The focus of the Score help file is on usage of the methods. Examples should be kept as lightweight as possible, and avoid introducing too many concepts that are not directly related to the methods.

The NRT Synthesis document is a Guide, which is about broader usage patterns and best practices… kind of like, the Score help file is for basics; the Guide is for better ways to do real work with it.

If you want to work directly with node IDs, this is your choice. My personal opinion is that this is too fiddly and makes you responsible for low-level details that the computer should handle. We have a node ID allocator; why not use it?

As for set… you might have noticed that the methods in the NRT guide example tend to follow some of the real-time method names:

Realtime NRT
Synth.new() Synth.basicNew().new()
x.release x.releaseMsg
Buffer.read Buffer.new().allocReadMsg()

So you might expect setsetMsg.

a.add([3.0, x.setMsg(\arg, value, ...)]);

It’s a good idea to double check the documentation for other methods, but this is a general pattern in the class library: the real-time method only sends the message; it gets the message from a corresponding somethingMsg method. The somethingMsg methods can be used for NRT.


1 Like