Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set lag of NamedControl or SynthDef.wrapped argument in NodeProxy externally #5709

Open
madskjeldgaard opened this issue Jan 30, 2022 · 7 comments
Labels
comp: help schelp documentation comp: JITlib

Comments

@madskjeldgaard
Copy link
Contributor

Environment

  • SuperCollider version: 3.12.2
  • Operating system: Arch
  • Other details (Qt version, audio driver, etc.): Running in SCNVIM

Steps to reproduce

(Example from PitchTrebler at https://scsynth.org/t/live-streaming-with-mads/5259/2)

This works:

Ndef.clear;
Ndef(\a, {|freq = 200, amp = 0.2| Saw.ar(freq, amp!2)}).lag(\freq, 5, \amp, 2).play;
Ndef(\a).set(\freq, 100, \amp, 0.05);

With namedcontrols it does not:

Ndef.clear;
Ndef(\a, {Saw.ar(\freq.kr(200), \amp.kr(0.2)!2)}).lag(\freq, 5, \amp, 2).play;
Ndef(\a).set(\freq, 100, \amp, 0.05);

Expected vs. actual behavior

I would expect to be able to set the lag on a NamedControl in the same way as other parameters in a NodeProxy.

PS. I could not find an issue on this topic even though it seems like a widely known thing? See for example https://scsynth.org/t/live-streaming-with-mads/5259/3?u=madskjeldgaard

@madskjeldgaard madskjeldgaard added bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: JITlib labels Jan 30, 2022
@madskjeldgaard
Copy link
Contributor Author

Not sure if this is perhaps related #2127

@telephon
Copy link
Member

telephon commented Jan 31, 2022

Yes, it is one of those things that are almost deprecated (see below). I had always tried to expose all things in the underlying objects, like SynthDef here. But because NamedControls is a bit orthogonal to the SynthDef rates, this doesn't work in the second case. There is no dedicated control name for it either, so to would at least be a bit of trickery.

setRates { |args|
		//this.deprecated(thisMethod); // maybe deprecate later
		rates = rates ?? { IdentityDictionary.new };
		rates.putPairs(args);
	}

@telephon telephon added comp: help schelp documentation and removed bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. labels Jan 31, 2022
@madskjeldgaard
Copy link
Contributor Author

It also affects SynthDef.wrap it seems:

f = {|freq=110| SinOsc.ar(freq)}
Ndef(\nolag, { SynthDef.wrap(f) }).play;
Ndef(\nolag).lag(\freq, 10);
Ndef(\nolag).set(\freq, 220)

@madskjeldgaard madskjeldgaard changed the title Cannot set lag of NamedControl in NodeProxy externally Cannot set lag of NamedControl or SynthDef.wrapped argument in NodeProxy externally Jan 31, 2022
@madskjeldgaard
Copy link
Contributor Author

Yes, it is one of those things that are almost deprecated (see below). I had always tried to expose all things in the underlying objects, like SynthDef here. But because NamedControls is a bit orthogonal to the SynthDef rates, this doesn't work in the second case. There is no dedicated control name for it either, so to would at least be a bit of trickery.

setRates { |args|
		//this.deprecated(thisMethod); // maybe deprecate later
		rates = rates ?? { IdentityDictionary.new };
		rates.putPairs(args);
	}

Thanks for the response Julian! Not sure I understand - is NamedControl deprecated?

@telephon
Copy link
Member

telephon commented Jan 31, 2022

No, not at all! NamedControl came later and only partially replaced some features that are built into SynthDef creation.

The setRates code comes from NodeProxy, it is called by lag. My intuition was at some stage that nobody uses that. Well, you never know ;-)

@jamshark70
Copy link
Contributor

I think this stems from the fact that SynthDef initially had no standardized way to query or manipulate the details of control names. Now we are finding use cases where it's helpful or necessary to standardize and unify the representation.

So I think this should probably be discussed in an RFC: Design a data structure and interface that meets the requirements first.

My opinion remains that SynthDef is the right place for this. But there was some work on another issue where control names were being collected under the banner of NamedControl. I still disagree with that but perhaps the ship already sailed.

@telephon
Copy link
Member

telephon commented Feb 4, 2022

I still disagree with that but perhaps the ship already sailed.

I agree that all that should be in SynthDef. In terms of implementation, it could be moved there easily (I suggested this recently). But yes, the whole thing needs a unified treatment, that would be good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: help schelp documentation comp: JITlib
Projects
None yet
Development

No branches or pull requests

3 participants