Env:blend does not handle symbols for the "curve" parameter #744

Open
vividsnow opened this Issue Feb 27, 2013 · 4 comments

Comments

Projects
None yet
4 participants
Contributor

vividsnow commented Feb 27, 2013

hello
got strange behavior (i'm on 3.6 branch)

error:

{|dur = 1, atk=0.01, blend = 0.5, curve=3|
    SinOsc.ar(
        200,
        mul:EnvGen.kr(Env.perc(atk, dur-atk, 1, curve).blend(Env.sine(dur), blend), doneAction:2);
    )
}.play
// Message 'rate' not understood.
// RECEIVER: sine

no error (replace 'curve' with a number in Env.perc arguments):

{|dur = 1, atk=0.01, blend = 0.5, curve=3|
    SinOsc.ar(
        200,
        mul:EnvGen.kr(Env.perc(atk, dur-atk, 1, 3).blend(Env.sine(dur), blend), doneAction:2);
    )
}.play
Contributor

timblechmann commented Mar 2, 2013

Env.blend seems to be broken if some of the elements are controls instead of numbers

Contributor

vividsnow commented Mar 12, 2013

some more examples:
works:

(
{|dur = 1, atk=0.01, blend = 0.5, curve=3|
    SinOsc.ar(
        200,
        mul:EnvGen.kr(Env.perc(atk, dur-atk, 1, curve).blend(Env.perc(atk, dur, curve:3), blend), doneAction:2);
    )
}.play
)

doesnt work (replace number -> "\lin" in second envelope) :

(
{|dur = 1, atk=0.01, blend = 0.5, curve=3|
    SinOsc.ar(
        200,
        mul:EnvGen.kr(Env.perc(atk, dur-atk, 1, curve).blend(Env.perc(atk, dur, curve:\lin), blend), doneAction:2);
    )
}.play
)

@snappizz snappizz added the bug label Sep 29, 2016

Owner

brianlheim commented Jan 17, 2017

Tested, still an issue. However, the error message is different:

ERROR: LinXFade2 arg: 'inB' has bad input: lin

PROTECTED CALL STACK:
	SynthDef:checkInputs	0x116a63ac0
		arg this = SynthDef:temp__5
		var firstErr = LinXFade2 arg: 'inB' has bad input: lin
	SynthDef:finishBuild	0x116a5e200
		arg this = SynthDef:temp__5
	a FunctionDef	0x116a52040
		sourceCode = "<an open Function>"
	Function:prTry	0x115446f00
		arg this = a Function
		var result = nil
		var thread = a Thread
		var next = nil
		var wasInProtectedFunc = false
	
CALL STACK:
	Exception:reportError   0x11d20f798
		arg this = <instance of Error>
	Nil:handleError   0x11d20eee8
		arg this = nil
		arg error = <instance of Error>
	Thread:handleError   0x11d20fa88
		arg this = <instance of Thread>
		arg error = <instance of Error>
	Object:throw   0x11d20f3b8
		arg this = <instance of Error>
	Function:protect   0x11d76ba98
		arg this = <instance of Function>
		arg handler = <instance of Function>
		var result = <instance of Error>
	SynthDef:build   0x114d18948
		arg this = <instance of SynthDef>
		arg ugenGraphFunc = <instance of Function>
		arg rates = nil
		arg prependArgs = nil
	Function:play   0x11746d718
		arg this = <instance of Function>
		arg target = <instance of Group>
		arg outbus = 0
		arg fadeTime = 0.02
		arg addAction = 'addToHead'
		arg args = nil
		var def = nil
		var synth = nil
		var server = <instance of Server>
		var bytes = nil
		var synthMsg = nil
	Interpreter:interpretPrintCmdLine   0x117718ba8
		arg this = <instance of Interpreter>
		var res = nil
		var func = <instance of Function>
		var code = "(
{|dur = 1, atk=0.01, blend..."
		var doc = nil
		var ideClass = <instance of Meta_ScIDE>
	Process:interpretPrintCmdLine   0x11d76c7a8
		arg this = <instance of Main>
^^ The preceding error dump is for ERROR: LinXFade2 arg: 'inB' has bad input: lin
Member

snappizz commented Jan 17, 2017

It's because Env:blend also blends the curves array. Fine if the curve values are numbers, but how do you blend \exponential with \hold?

The appropriate thing to do is to throw an error if the curve values can't be reconciled. Blending is possible in the following situations:

  • Both curves are numbers.
  • Both curves are symbols which are either identical (\lin vs \lin) or aliases of each other (\sine vs. \sin).
  • One curve is \lin or \linear and the other is a number.

This is low priority, so I don't advise working on it right now.

@snappizz snappizz changed the title from strange error in latest 3.6.3 to Env:blend does not handle symbols for the "curve" parameter Jan 17, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment