flucoma / flucoma-sc

Fluid Corpus Manipulation plugins for Supercollider
BSD 3-Clause "New" or "Revised" License
70 stars 16 forks source link

FluidBufStats.sc Message 'asBag' not understood. #126

Closed g-roma closed 2 years ago

g-roma commented 2 years ago

Currently I get this in SC 3.12.1 when running the code in the help file for FluidBufStats (musical example)

ERROR: Message 'asBag' not understood. Perhaps you misspelled 'asBus', or meant to call 'asBag' on another receiver? RECEIVER: Integer 1 ARGS: PATH: /path/toFluidBufStats.sc CALL STACK: DoesNotUnderstandError:reportError arg this = Nil:handleError arg this = nil arg error = Thread:handleError arg this = arg error = Thread:handleError arg this = arg error = Object:throw arg this = Object:doesNotUnderstand arg this = 1 arg selector = 'asBag' arg args = [*0] Meta_FluidBufStats:prProcessSelect arg this = arg a = 1 var bits = nil Meta_FluidBufStats:processBlocking arg this = arg server = arg source = arg startFrame = 0 arg numFrames = 60 arg startChan = 0 arg numChans = 1 arg stats = arg select = 1 arg numDerivs = 0 arg low = 0 arg middle = 50 arg high = 100 arg outliersCutoff = -1 arg weights = nil arg freeWhenDone = true arg action = var selectbits = nil < FunctionDef in closed FunctionDef > arg start = 0.0 arg end = 29184.0 Integer:do arg this = 9 arg function = var i = 0 SequenceableCollection:doAdjacentPairs arg this = arg function = Routine:prStart arg this = arg inval = 441.776373167 ^^ ERROR: Message 'asBag' not understood. Perhaps you misspelled 'asBus', or meant to call 'asBag' on another receiver? RECEIVER: 1

tremblap commented 2 years ago

Are you on the v1.0.1 release candidate? I thought I fixed that. @tedmoore and @jamesb93 are on the SC review now so I'll ping them here (while I finish Pd :)

tremblap commented 2 years ago

you seem to be on an old build since that section doesn't exist anymore. Check on the latest version (v1.0.1 pre-release) and let us know if that happens again.

g-roma commented 2 years ago

This was on main, and also seems to happen with the 1.0.1 binaries

g-roma commented 2 years ago

OK, I think I was testing with 1.0.1 but I still had the old help file cached, so the issue is that the interface has changed and the help file was not updated.

tremblap commented 2 years ago

yes this is messy as SC caches helpfiles. It happenned to me way too many times...

heretogo commented 1 year ago

@weefuzzy @tremblap I am getting this with FluidLoudness on 1.0.4 and the latest nightly. Was there a regression? Can you please check it?

tedmoore commented 1 year ago

If you could post some code here that'd be super. So we can make sure we're looking under the right stones.

heretogo commented 1 year ago

Running latest release (1.0.4). Here is the detailed error message:

ERROR: Message 'asBag' not understood.
Perhaps you misspelled 'asBus', or meant to call 'asBag' on another receiver?
RECEIVER:
   Integer 1
ARGS:
PATH: /Users/jamesa/Repos/github.com/heretogo/pakled/Startup/startup-osx.scd

PROTECTED CALL STACK:
    Meta_MethodError:new    0x7f8a1c0af9c0
        arg this = DoesNotUnderstandError
        arg what = nil
        arg receiver = 1
    Meta_DoesNotUnderstandError:new 0x7f8a1c0b1c80
        arg this = DoesNotUnderstandError
        arg receiver = 1
        arg selector = asBag
        arg args = [  ]
    Object:doesNotUnderstand    0x7f8a181f2f80
        arg this = 1
        arg selector = asBag
        arg args = nil
    Meta_FluidLoudness:prProcessSelect  0x7f8a18a588c0
        arg this = FluidLoudness
        arg a = 1
        var bits = nil
    Meta_FluidLoudness:kr   0x7f8a18a5a2c0
        arg this = FluidLoudness
        arg in = an OutputProxy
        arg select = 1
        arg kWeighting = 0
        arg truePeak = 1
        arg windowSize = 1024
        arg hopSize = 64
        arg maxWindowSize = 16384
        var selectbits = nil
    a FunctionDef   0x7f8a1c18dc40
        sourceCode = "<an open Function>"
        arg gate = an OutputProxy
        arg y_buf = an OutputProxy
        arg rel = an OutputProxy
        arg amp = an OutputProxy
        arg sendamp = an OutputProxy
        arg out = an OutputProxy
        arg send = an OutputProxy
        var val = [ an OutputProxy, an OutputProxy, an OutputProxy, an OutputProxy, an OutputProxy, an OutputProxy, an OutputProxy, an OutputProxy, an OutputProxy, an OutputProxy ]
        var osc1 = nil
        var osc2 = nil
        var feed1 = an OutputProxy
        var feed2 = an OutputProxy
        var base1 = 69
        var base2 = 69
        var base3 = 130
        var env = an EnvGen
        var sig = nil
    SynthDef:buildUgenGraph 0x7f8a197e8680
        arg this = a SynthDef
        arg func = a Function
        arg rates = nil
        arg prependArgs = [  ]
        var result = nil
        var saveControlNames = nil
    a FunctionDef   0x7f8a197e6cc0
        sourceCode = "<an open Function>"
    Function:prTry  0x7f8a1c3f7e00
        arg this = a Function
        var result = nil
        var thread = a Routine
        var next = nil
        var wasInProtectedFunc = true

CALL STACK:
    DoesNotUnderstandError:reportError
        arg this = <instance of DoesNotUnderstandError>
    < closed FunctionDef >
        arg error = <instance of DoesNotUnderstandError>
    Integer:forBy
        arg this = 0
        arg endval = 0
        arg stepval = 2
        arg function = <instance of Function>
        var i = 0
        var j = 0
    SequenceableCollection:pairsDo
        arg this = [*2]
        arg function = <instance of Function>
    Scheduler:seconds_
        arg this = <instance of Scheduler>
        arg newSeconds = 28.498316375
    Meta_AppClock:tick
        arg this = <instance of Meta_AppClock>
        var saveClock = <instance of Meta_SystemClock>
    Process:tick
        arg this = <instance of Main>
^^ ERROR: Message 'asBag' not understood.
Perhaps you misspelled 'asBus', or meant to call 'asBag' on another receiver?
RECEIVER: 1
heretogo commented 1 year ago

Here is the code which is calling FluidLoudness:

MLPChaos : MLPSynth {

  *new { |s,main,n,name|
    ^super.newCopyArgs(s ? Server.default,main,10,"chaosSynth").init
  }

  makeSynth {
    fork({
      SynthDef(\chaosSynth, { |gate=0,y_buf,rel=0.3,amp=0,sendamp=0,out,send|
        var val=FluidBufToKr.kr(y_buf,numFrames:n), osc1, osc2, feed1, feed2, base1=69, base2=69, base3=130, env, sig;
        env = EnvGen.kr(Env.asr(attackTime: 0.3, sustainLevel: 1.0, releaseTime: rel), gate: gate, doneAction: Done.none);
        #feed2,feed1 = LocalIn.ar(2);
        osc1 = MoogFF.ar(SinOsc.ar((((feed1 * val[0]) +  val[1]) * base1).midicps,mul: (val[2] * 50).dbamp).atan,(base3 - (val[3] * (FluidLoudness.kr(feed2, 1, 0, hopSize: 64)[0].clip(-120,0) + 120))).lag(128/44100).midicps, val[4] * 3.5);
        osc2 = MoogFF.ar(SinOsc.ar((((feed2 * val[5]) +  val[6]) * base2).midicps,mul: (val[7] * 50).dbamp).atan,(base3 - (val[8] * (FluidLoudness.kr(feed1, 1, 0, hopSize: 64)[0].clip(-120,0) + 120))).lag(128/44100).midicps, val[9] * 3.5);
        LocalOut.ar([osc1,osc2]);
        sig = LeakDC.ar([osc1,osc2]) * env;
        sig = Limiter.ar(sig, 0.98);
        [Out.ar(out,sig*amp.lag(0.3)), Out.ar(send,sig*sendamp.lag(0.3))];
      }).add; s.sync;
      synth = Synth.newPaused(\chaosSynth, [
          \y_buf, y_buf,
          \amp, main.gui.synths[\pinktrem].amp.value,
          \sendamp, main.gui.synths[\pinktrem].send.value,
          \out, defaultOut,
          \send, defaultSend,
        ], main.synthGroup);
    }, AppClock);
  }

}
tedmoore commented 1 year ago

Ah yes, the arguments order for FluidLoudness has changed, so that code will throw this error. Check the arguments list and put in keywords for the arguments you want and it should be good.

tedmoore commented 1 year ago

There's a version of that synth that will work here (the code is also reformatted some): https://learn.flucoma.org/examples/regressor-video-complete-server.scd

heretogo commented 1 year ago

Works now! No problem. Note to future Googlers that I added a select: [\loudness] arg and removed the [0] at the end of the .kr (because it is no longer necessary).

Thanks @tedmoore .