Hello everyone!

Usually when I write subpatches in Sc, I use this format:

~path = (PathName(thisProcess.nowExecutingPath)).pathOnly;
~ndefs1 = this.compileFile(~path ++ "Scene1Senseq.scd");
~ndefs1.value;

I would love to know how could I apply this idea on Bela. Is it somehow possible to install files on the SD card and be able to run it?

Thanks in advance for your help!
Rafaele

Does that code work currently? I don't think we have done anything to purposely disable it!

If it does work, are you looking for some sort of globally accessible folder where all your subpatches can be stored, so that you can access them from any projects?

    giuliomoro

    This code works in supercollider.

    Yes! The intention is to make my patch more organized, without 20 synths directed connected.

    Thanks for your help! 🙂

      giuliomoro

      Not in Bela :/ I get this message below*.
      I tried also without the "~path": (~ndefs1 = this.compileFile( "Scene1Senseq.scd"). It looks that the compile is not understandable:


      ERROR: binary operator '+' failed.
      RECEIVER:
      nil
      ARGS:
      Instance of NumOutputBuses { (0x1b5b830, gc=94, fmt=00, flg=00, set=03)
      instance variables [8]
      synthDef : instance of ProxySynthDef (0x1d104d0, size=20, set=5)
      inputs : instance of Array (0xb684de20, size=0, set=0)
      rate : Symbol 'scalar'
      synthIndex : Integer 0
      specialIndex : Integer 0
      antecedents : nil
      descendants : nil
      widthFirstAntecedents : nil
      }
      nil
      PATH: /root/Bela/projects/Synth__Button_SC/main.scd
      PROTECTED CALL STACK:
      Meta_MethodError:new 0x1022be0
      arg this = BinaryOpFailureError
      arg what = nil
      arg receiver = nil
      Meta_DoesNotUnderstandError:new 0x1023da0
      arg this = BinaryOpFailureError
      arg receiver = nil
      arg selector = +
      arg args = [ a NumOutputBuses, nil ]
      Object:performBinaryOpOnSomething 0xde2b20
      arg this = nil
      arg aSelector = +
      arg thing = a NumOutputBuses
      arg adverb = nil
      UGen:composeBinaryOp 0x11d3520
      arg this = a NumOutputBuses
      arg aSelector = +
      arg anInput = nil
      Meta_SoundIn:ar 0xfa8a20
      arg this = SoundIn
      arg bus = nil
      arg mul = 1.0
      arg add = 0.0
      var chanOffset = a NumOutputBuses
      a FunctionDef 0x1c05370
      sourceCode = "{
      Greyhole.ar(
      SoundIn.ar(~inCh),
      \dtime.kr(0.1),
      \damp.kr(0.1),
      \size.kr(1),
      \diff.kr(0.7),
      \fb.kr(0.9),
      \modDepth.kr(0.9),
      \modFreq.kr([20,8000])
      )
      0.1;
      }"
      SynthDef:buildUgenGraph 0x18b1be0
      arg this = a ProxySynthDef
      arg func = a Function
      arg rates = nil
      arg prependArgs = [ ]
      var result = nil
      var saveControlNames = nil
      a FunctionDef 0x189ee20
      sourceCode = ""
      var out = nil
      var outCtl = nil
      SynthDef:buildUgenGraph 0x18b1be0
      arg this = a ProxySynthDef
      arg func = a Function
      arg rates = nil
      arg prependArgs = [ ]
      var result = nil
      var saveControlNames = nil
      a FunctionDef 0x18b0ca0
      sourceCode = ""
      Function:prTry 0x10bf920
      arg this = a Function
      var result = nil
      var thread = a Routine
      var next = nil
      var wasInProtectedFunc = true

      CALL STACK:
      DoesNotUnderstandError:reportError
      arg this =
      < closed FunctionDef >
      arg error =
      Integer:forBy
      arg this = 0
      arg endval = 0
      arg stepval = 2
      arg function =
      var i = 0
      var j = 0
      SequenceableCollection:pairsDo
      arg this = [*2]
      arg function =
      Scheduler:seconds_
      arg this =
      arg newSeconds = 15.296301966
      Meta_AppClock:tick
      arg this =
      var saveClock =
      Process:tick
      arg this =
      The preceding error dump is for ERROR: binary operator '+' failed.
      RECEIVER: nil

      Is this a new feature of Sc? On the board I think we have 3.9, while upstream is 3.10 or even 3.11 .

      It should work, but there's a small typo in your code, ++ should be +/+:

      ~path = (PathName(thisProcess.nowExecutingPath)).pathOnly;
      ~ndefs1 = this.compileFile(~path +/+ "Scene1Senseq.scd");
      ~ndefs1.value;

      But I can't really figure out the error message, so there might be something else going on as well...

      RafaeleAndrade Yes, in principle it should work - i have Bela projects that load external files in a similar way. Are you sure Scene1Senseq.scd is in the same folder as main.scd?

      Maybe it would be possible to figure out what goes wrong if you try the following. It does pretty much the same thing as your three lines of code, loading the file with a path relative to nowExecutingPath:

      "Scene1Senseq.scd".loadRelative;

      It should post warnings if that file is not found - take a look in the log (before the error posted above) to see if you have any of those.

      14 days later