[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] Some 3.3 work



Except you then can't give i or k-rate args.

All this is basically doing is using In.ar ... no? I though the idea would be the ability to simply map audio busses to a Control.


ok, this I must have misunderstood. I thought it would be valuable to be able to map audio rate busses to audio rate controls.


Right now, a Control doesn't care if a value is simply passed in, mapped to a control bus, or updated as needed. If we want to add the ability to map to an audio bus, the Control now needs to be a bit smarter since the number of samples that will be read has to be flexible depending on an audio rate or control rate input. Since the Bus IDs are simply indexes into pointer (inside the UGen), the only way I can think to set up this differentiation is to differentiate based on ID range.

ok, I see what you mean.


And this is where the 0-127 for audio / 128 - 4095 example comes from ... at startup, the Server Options would know that 0-127 (or however many audio rate busses are allocated) are audio rate, and Control.ar would act like In.ar. For >127, Control.ar would take the new sample, and linearly interpolate to it from the last sample (the way most UGens treat a k-rate value). The output of Control.ar would be blockSize samples... but it's input could be a single sample, or a full ar signal. With the current bus structure, I can't think of a way for a UGen to differentiate between an index of 0 that is audio rate and an index of 0 that is Control rate.

yes, this seems to be a good solution for switching functions in Control ugen.

so all that is to do is:

(1) offset the ControlBusAllocator by num_audiobusses.
(2) write a macro in plugins that checks if a bus is in either of these ranges
(3) write methods Control_next_ak, Control_next_ka

caveat: this does not work with manually allocated control bus numbers, and can break code.




Best,

Josh

On Dec 17, 2008, at 2:56 PM, Julian Rohrhuber wrote:


well it would solve it like this:


//
SynthDef(\test, { arg out = 0, mul = 0.1;
var freq = q.audioControl(\freq, 2); // you have to know in advance that this is audio rate.
	Out.ar(out, SinOsc.ar(freq, 0, mul))
	}).send(s);
SynthDef(\ctl, { arg out = 0, freq=30, mul=200, add=300;
	Out.ar(out, LFSaw.ar(freq, 0, mul))
	}).send(s);

a = Synth.new(\test, [\freq, 440]);

b = Synth.new(\ctl, [\freq, 10, \mul, 440 * 4, \out, 10]);

// set the freq input to the audio bus 10
// this is a made up syntax, just to illustrate what I though the idea was
q.mapAudio(a, \freq, 10);



all that is needed is a reinterpretation of \map as \set, and a different UGen (In.ar). We don't need to change the bus system, I think. All we need is an ar type control that maps onto an In.ar (possible FeddbackIn.ar) and a different map message.

// a sketch

Node {

	mapAr { |key, bus, pairs... |
		this.set(key, bus, *pairs)
	}
}

Control {
	*ar { |values|
		var ctl = this.kr(1);
		In.ar(ctl, values.size) // here we miss the default values.
	}
}



Hmm... except, this doesn't really solve the problem (at least in my mind). What I thought of in relation to this when we talked about it sometime ago was that something like this would work:

SynthDef(\test, {arg out = 0, freq, mul = 0.1;
	Out.ar(out, SinOsc.ar(freq, 0, mul))
	}).send(s);

a = Synth.new(\test, [\freq, 440]);

b = Synth.new(\test, [\freq, 200, \mul, 440 * 4, \out, 10]);

// set the freq input to the audio bus 10
// this is a made up syntax, just to illustrate what I though the idea was
a.mapToAudio(\freq, 10);

Is this what you meant Andrea? I started thinking about how to do this some time ago, and came up with a few ideas...

1) make all Busses part of the same structure (no audio or control per se).
2) Make the first portion (let's say, busses 0 -127) audio, therefore arrays (pointers) of s.options.blockSize 3) make the rest (let's say 128 - 4096) single values (just like the current control busses)
... here is where I don't know how to solve the problem ...
4) Make Control a UGen that outputs its rate (based on bus number) and either the audio signal OR a scaler. 5) 4 (above) causes problems - another possible idea is to make Control always output blockSize samples, either as its audio output, or as linearly interpolated control data (doing the work that the input UGen would be doing otherwise - other UGens then see all Control UGens as audio data - which is a problem as well). Control.names gets iffy. 6) Maybe make all args to a SynthDef a special kind of Control (.ar?) that behaves as above, but you can still create Control.names.kr UGens in the SynthDef by hand? 7) OR - make the default control be as it is now, but the user can specify a rate in the rates part of the SynthDef, making the above:

SynthDef(\test, {arg out = 0, freq, mul = 0.1;
	Out.ar(out, SinOsc.ar(freq, 0, mul))
	}, [nil, \ar, nil]).send(s);

Now - freq is a Control that takes care of things as described in option 5 above, while the others are just the normal Controls that a SynthDef wraps all args in.

I believe changes in Bus would prevent code breakage with the renumbered bus approach. The only code I can really see breaking is hard coded control and audio bus ids (since there would no longer be things like control bus '0')... or maybe that step isn't necessary? Though I don't see any other way for the Control.ar method to know whether a bus is audio or control (other then doing a < check on the id).

Ideas?

Josh

On Dec 17, 2008, at 10:03 AM, Julian Rohrhuber wrote:

Just to know and to bring some ideas from a user pov:

- What about mapping audio buses as synth controls for 3.3?
<http://sourceforge.net/tracker/index.php?func=detail&aid=1991641&group_id=54622&atid=474251>http://sourceforge.net/tracker/index.php?func=detail&aid=1991641&group_id=54622&atid=474251




here is a solution, a bit of a hack, but works as long as there is no change in the synthDef format.

(
q = ();
q.audioBusses = Bus.control(s, s.options.numAudioBusChannels);
q.audioBusses.setn((0..s.options.numAudioBusChannels-1));
q.mapAudio = { |q, node, key, bus|
	node.set(key, bus);
};
q.audioControl = { |q, key, numChannels|
	In.ar(Control.names(key).kr(0), numChannels)
};
)

(
a = {
	SinOsc.ar(q.audioControl(\freq, 2)) * 0.1

}.play;

b = { Out.ar(62, LFNoise2.ar(1.dup).exprange(800, 1700)) }.play;
);


q.mapAudio(a, \freq, 62);


I'll see if I can implement it in JITLib, so that it can be used easily.
--





.

_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/

******************************************
/* Joshua D. Parmenter
http://www.realizedsound.net/josh/

"Every composer - at all times and in all cases - gives his own interpretation of how modern society is structured: whether actively or passively, consciously or unconsciously, he makes choices in this regard. He may be conservative or he may subject himself to continual renewal; or he may strive for a revolutionary, historical or social palingenesis." - Luigi Nono
*/


_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/


--





.

_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/

******************************************
/* Joshua D. Parmenter
http://www.realizedsound.net/josh/

"Every composer - at all times and in all cases - gives his own interpretation of how modern society is structured: whether actively or passively, consciously or unconsciously, he makes choices in this regard. He may be conservative or he may subject himself to continual renewal; or he may strive for a revolutionary, historical or social palingenesis." - Luigi Nono
*/


_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/


--





.

_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/