Problem with SynthDef

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problem with SynthDef

pvanhorn


I was making this synth (following instruction from the supercollider book) and it worked fine by itself but when I set it up as a synthdef it gives me the lengthy error message at the bottom of the post. Can anyone explain to me what this error even means and how I could go about fixing it, please?:

SynthDef( "thing",{
        arg a;
        var rate = 4, carrier, modRatio; // declare variables
        carrier = LFNoise0.kr(rate) * 500 + 700;
        modRatio = MouseX.kr(1, 2.0);
        // modulator expressed as ratio, therefore timbre
        PMOsc.ar(carrier, carrier*modRatio, 12)*0.3}
).play


a = {Synth("thing", 2)}.play


ERROR: should not use a Synth inside a SynthDef

PROTECTED CALL STACK:
        Node:asUGenInput 0x10c5ec940
                arg this = Synth("thing" : 1006)
        a FunctionDef 0x10c46b540
                sourceCode = "<an open Function>"
                arg i_out = an OutputProxy
                var result = nil
                var rate = nil
                var env = nil
        SynthDef:buildUgenGraph 0x10ce640c0
                arg this = a SynthDef
                arg func = a Function
                arg rates = nil
                arg prependArgs = [  ]
                var result = nil
                var saveControlNames = nil
        a FunctionDef 0x10cea0300
                sourceCode = "<an open Function>"
        Function:prTry 0x10cd0ff00
                arg this = a Function
                var result = nil
                var thread = a Thread
                var next = nil
                var wasInProtectedFunc = false
       
CALL STACK:
        Exception:reportError   0x118fd0628
                arg this = <instance of Error>
        Nil:handleError   0x1139737f8
                arg this = nil
                arg error = <instance of Error>
        Thread:handleError   0x11b199de8
                arg this = <instance of Thread>
                arg error = <instance of Error>
        Object:throw   0x11505baa8
                arg this = <instance of Error>
        Function:protect   0x113936148
                arg this = <instance of Function>
                arg handler = <instance of Function>
                var result = <instance of Error>
        SynthDef:build   0x11784ac68
                arg this = <instance of SynthDef>
                arg ugenGraphFunc = <instance of Function>
                arg rates = nil
                arg prependArgs = nil
        Function:play   0x114dbd098
                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
        < closed FunctionDef >  (no arguments or variables)
        Interpreter:interpretPrintCmdLine   0x113a6f488
                arg this = <instance of Interpreter>
                var res = nil
                var func = <instance of Function>
                var code = "a = {Synth("thing", 2)}.play"
                var doc = nil
                var ideClass = <instance of Meta_ScIDE>
        Process:interpretPrintCmdLine   0x114f873b8
                arg this = <instance of Main>
^^ The preceding error dump is for ERROR: should not use a Synth inside a SynthDef