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

Re: [sc-dev] SynthDef variant support for patterns



have you tested efficiency? This is important, because we use events in granular synthesis.

Sorry to be so bold: What are the variants good or if you have events anyway? I don't see the utility. I would rather find it interesting to dynamically combine ugen graphs and store their synthdefs implicitly than just support another layer of parameterisation.


So far, patterns could not be used with synthdef variants for a few reasons: the variant name interferes with synthdesc lookup, and the msgFunc would overwrite the argument defaults given in the variants.

I've got rudimentary variant support working. It needs these changes:

1. The replacement msgFunc I proposed some weeks ago, which differs from the original in that it adds a control name and value to the argument array only if the value actually exists in the event. I've been using this alternate for weeks now with no ill effect -- it's broken exactly nothing in my pieces.

2. A synthdesc flag, hasVariants, populated while reading the synthdef's binary stream.

3. A 'match' method for SynthDescLib that strips the variant name (if present) and looks only for the main synthdef name. In the current incarnation, defname.variant matches only if defname has variants, but the variant name is not verified. I don't think it would be hard to add that check. If the synthdef has no variants, the entire instrument name from the pattern is used for the lookup (because somebody might have a synthdef whose name has a '.').

4. Event prototypes should use ~synthLib.match(instrumentName) instead of the current .at lookup.

With the attached patch, the following patterns produce quite different sonic results as one would expect.

SynthDef("vartest", {|out=0, freq=440, amp=0.2, a = 0.01, r = 1|
// the EnvGen with doneAction: 2 frees the synth automatically when done Out.ar(out, SinOsc.ar(freq, 0, EnvGen.kr(Env.perc(a, r, amp), doneAction: 2))); }, variants: (alpha: [a: 0.5, r: 0.5], beta: [a: 3, r: 0.01], gamma: [a: 0.01, r: 4])
).memStore;

p = Pbind(
	\instrument, 'vartest',
	\freq, Pexprand(200, 800, inf),
	\delta, 0.25
).play;

p.stop;

p = Pbind(
	\instrument, 'vartest.alpha',
	\freq, Pexprand(200, 800, inf),
	\delta, 0.25
).play;

p.stop;

Comments or concerns? Currently I'm not actually reading the variant values into the synthdesc, but that won't be difficult. That would also make it easy to check whether the variant name is valid.

hjh

?

: H. James Harkins
: jamshark70@xxxxxxxxxxxxxxxxx
: http://www.dewdrop-world.net
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman


So far, patterns could not be used with synthdef variants for a few reasons: the variant name interferes with synthdesc lookup, and the msgFunc would overwrite the argument defaults given in the variants.

I've got rudimentary variant support working. It needs these changes:

1. The replacement msgFunc I proposed some weeks ago, which differs from the original in that it adds a control name and value to the argument array only if the value actually exists in the event. I've been using this alternate for weeks now with no ill effect -- it's broken exactly nothing in my pieces.

2. A synthdesc flag, hasVariants, populated while reading the synthdef's binary stream.

3. A 'match' method for SynthDescLib that strips the variant name (if present) and looks only for the main synthdef name. In the current incarnation, defname.variant matches only if defname has variants, but the variant name is not verified. I don't think it would be hard to add that check. If the synthdef has no variants, the entire instrument name from the pattern is used for the lookup (because somebody might have a synthdef whose name has a '.').

4. Event prototypes should use ~synthLib.match(instrumentName) instead of the current .at lookup.

With the attached patch, the following patterns produce quite different sonic results as one would expect.

SynthDef("vartest", {|out=0, freq=440, amp=0.2, a = 0.01, r = 1|
// the EnvGen with doneAction: 2 frees the synth automatically when done Out.ar(out, SinOsc.ar(freq, 0, EnvGen.kr(Env.perc(a, r, amp), doneAction: 2))); }, variants: (alpha: [a: 0.5, r: 0.5], beta: [a: 3, r: 0.01], gamma: [a: 0.01, r: 4])
).memStore;

p = Pbind(
	\instrument, 'vartest',
	\freq, Pexprand(200, 800, inf),
	\delta, 0.25
).play;

p.stop;

p = Pbind(
	\instrument, 'vartest.alpha',
	\freq, Pexprand(200, 800, inf),
	\delta, 0.25
).play;

p.stop;

Comments or concerns? Currently I'm not actually reading the variant values into the synthdesc, but that won't be difficult. That would also make it easy to check whether the variant name is valid.

hjh


Attachment converted: data:synth-variant.diff (    /    ) (0008767E)


: H. James Harkins
: <mailto:jamshark70@xxxxxxxxxxxxxxxxx>jamshark70@xxxxxxxxxxxxxxxxx
: <http://www.dewdrop-world.net>http://www.dewdrop-world.net
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman


--





.

_______________________________________________
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/