Is there a troubleshooting list what to do when a patch runs fine on my laptop, but makes Bela crash?
This happens without error report, the IDE just freezes.
Changing block size doesn't help.

it's happening on this well sounding vocoder patch by Tom Erbe
patch:
https://files.cargocollective.com/c962099/_main.pd

picture of original patch:
https://tre.ucsd.edu/wordpress/wp-content/uploads/2017/05/Screen-Shot-2019-05-16-at-11.46.12-AM.png

error:
CPU time limit exceeded
make: *** [runide] Error 152

    Floris CPU time limit exceeded

    this means it's taking a lot of time to process an audio block. The most straightforward solution unfortunately is to reduce the amount of audio processing you are doing.

    thanks for the reply.
    Here's what is happening at different block sizes:
    block size 16: distorted sound and crash. "Bela has disconnected. Any changes you make will not be saved. Check your USB connection and reboot Bela."
    What's best practice here? Refreshing the IDE page or unplugging, power cycling and typing "192.168.7.2" in the browser don't help.

    block size 256: "CPU time limit exceeded make: *** [runide] Error 152"
    IDE keeps on working with new patch.

    When anybody else tries this patch, do we all get the same results?

      Floris What's best practice here? Refreshing the IDE page or tyoig "192.168.7.2" in the browser don't help. Shall I unplug?

      press the button on the Bela cape to stop the running program, wait a few seconds and the IDE should come back to life. Try go down to one or two vocoder bands and see what CPU usage you get there, from which you should subtract about 15% as the baseline usage of a Pd patch at 16 samples per block.

      Happy to have soldered a reset button next to my Pepper module.

      Block size 16 and half of the filters, the patch works on Pepper. (Sounds only half as good though)
      Block size 16 and 3/4 of the filters, sounds distort and it crashes again after a few seconds.

      Block size 256 and 3/4 of the filters sounds are fine and crashes after like 6 seconds.
      Same results with the highest block size.

      Then it just tells me "Bela has disconnected. Any changes you make will not be saved. Check your USB connection and reboot Bela."

      Any idea how to best balance block size or other parameters and amount of filters?

      Don't use block size larger than 128 unless you have expensive, infrequent computations as they will only add to the cpu load without any real benefit.
      Try 128 samples.

      Do you get the same error message when it crashes at 16 samples?

      at blocksize 128 and 18 filters CPU is 84%
      at blocksize 128 and 15 filters CPU is 72%

      at blocksize 64 and 15 filters CPU is 74%
      at blocksize 32 and 15 filters CPU is 78%

      I landed at at blocksize 128 and 16 filters with CPU around 78%.
      The patch keeps on running fine but vocoded result is of course less recognisable.
      I'll probably erase some more bands as I need outgoing CV for this patch too.

      Maybe somehow this patch can be made much lighter?

      Or will there ever be a Bela shield for a board with more processing power?
      For example do the same processing in stereo and use mire heavier audio processing.

        Floris Or will there ever be a Bela shield for a board with more processing power?

        Hopefully soon!

        Floris he patch keeps on running fine but vocoded result is of course less recognisable.

        16 bands is more than most analog vocoders had! :-)

        Floris Maybe somehow this patch can be made much lighter?

        You could add the command-line option --high-performance-mode which gives you some more CPU time, at the expense of the IDE becoming completely unaccessible while running with high CPU (but if you are already stopping with a button, that won't be a problem for you).

        Also, I see that apart from the file loading [readsf~], the patch would compile with hvcc (aka "heavy"), so that's a possible huge source of CPU saving. I will try and build it with hvcc tomorrow.

          For my patch, I use [adc~] in stead of [readsf~] for input.

          I'll have multiple Pd patches to play different pieces in next concerts.
          In a live situation, between two pieces, the reset button I soldered is used to switch between Pd patches.

          And more general,what's the best practice to optimize a Pd patch?
          Apart from heavy compiling, deleting number boxes, and slowing down metro objects.

            Using hvcc you get about 55% CPU usage with the full 28 voices. For some unknown (to me) reason, it only works well at blocksize 64 or 128.

            Floris And more general,what's the best practice to optimize a Pd patch?

            Well in this case there is not much that can be done, as it's essentially just many [bp~] and [env~] objects. Maybe (and I say maybe) using [pack f f] instead of [$1 23( to go into the [line~] object could also help.

            I have two patches ready for an upcoming concert series, both run nicely in the IDE is connected, but fail when tried in to play on booth as loop.

            How low on CPU should I go for not getting stuck in reboot loop?

            Can anybody help compiling these? I'll upload my Pd patches here: https://www.florisvanhoof.com/bela
            I tried an online Pd to C + + compiler, but there's errors on both patches.
            This is what I get from the vocoder patch for example.
            Patch Compilation Failed
            StdoutStderr
            1) [91mError[0m pd2hv: trill in "main.pd/trill" @ (x:20, y:2): Don't know how to parse object "list". Is it an object supported by Heavy? Is it an abstraction? Have the search paths been correctly configured?
            2) [91mError[0m pd2hv: trill in "
            main.pd/trill" @ (x:20, y:2): There was an error while connecting two objects. Have all objects been correctly instantiated? Have all inlets and outlets been declared?
            3) [91mError[0m pd2hv: [comment text] in "main.pd/trill" @ (x:0, y:0): Connection made to non-existent inlet at [comment {u'text': 'null object placeholder (list)'}]:0.
            1) [93mWarning[0m pd2hv: [msg remote local] in "
            main.pd/2 vocoder" @ (x:209, y:-37): Message boxes don't yet support remote messages. These messages will be ignored.

              Floris 1) [91mError[0m pd2hv: trill in "main.pd/trill" @ (x:20, y:2): Don't know how to parse object "list". Is it an object supported by Heavy? Is it an abstraction? Have the search paths been correctly configured?
              2) [91mError[0m pd2hv: trill in "main.pd/trill" @ (x:20, y:2): There was an error while connecting two objects. Have all objects been correctly instantiated? Have all inlets and outlets been declared?
              3) [91mError[0m pd2hv: [comment text] in "main.pd/trill" @ (x:0, y:0): Connection made to non-existent inlet at [comment {u'text': 'null object placeholder (list)'}]:0.

              these are because you have the [list] object in your patch, which is unsupported by hvcc.

              alt text

              You can simply remove those objects as they are not doing anything there.

              The other patch has some more issues:

              • it uses that same [list] which you can similarly delete
              • it uses [vline~] and [expr~ $v1 > $v2]. These can be replaced by heavylib's [hv.vline] and [hv.gt], respectively.

              The recommended workflow to build a program with heavy/hvcc is:

              • install this version of hvcc on your computer https://github.com/giuliomoro/hvcc/ (requires git, python 3.7 and pip3). From a terminal run:
                git clone https://github.com/giuliomoro/hvcc.git
                cd hvcc/
                pip3 install -e .
              • then get a copy of the Bela repository (dev branch) on your computer and update the code on Bela:
                git clone https://github.com/BelaPlatform/Bela.git
                cd Bela
                git checkout dev
                ./scripts/update_board -y
              • once the above is done you can run the following script to build Pd patches into a Bela project. From within the Bela folder, run:
                scripts/build_pd_hvcc.sh  path/to/your/vocoder_main.pd -c "-p64" -p PROJECTNAME

              Update instructions: in case you already have done the above but want to update to the latest hvcc and Bela support for hvcc:

              • get into your local hvcc folder and do:
                git fetch
                git reset --hard origin/master-Bela
                pip3 install -e .
              • get into your local Bela folder and do:
                git pull
                ./scripts/update_board -y

              NOTE: after updating the Bela core code (as done above when running update_board), the next time you build any project may take a long time.
              ANOTHER NOTE: the first time you build a project created with hvcc, it will take a long time to build. Successive builds will be faster, but still take around 30-40 seconds.

              However, currently there is no Trill support on Bela+hvcc. Let me add it right now and get back to you.

              Hi! thanks for the help. The last script gets this error :

              1) Error hvcc: Unknown input path /Users/Floris/hvcc/Bela/desktop/_main.pd
              MacBook-Pro-van-Floris:Bela Floris$

              is the path correct? The "desktop" in there is suspicious...

              What does

              ls /Users/Floris/hvcc/Bela/desktop/_main.pd

              return?

              ls: /Users/Floris/hvcc/Bela/desktop/_main.pd: No such file or directory
              MacBook-Pro-van-Floris:~ Floris$

              yup, then the path is wrong. Where is the file located? If it is on your desktop, then path would be something like: /Users/Floris/Desktop/_main.pd

              no idea what I'm doing wrong:

              MacBook-Pro-van-Floris:~ Floris$ scripts/build_pd_hvcc.sh /Users/Floris/Desktop/_main.pd -c "-p64" -p PROJECTNAME
              -bash: scripts/build_pd_hvcc.sh: No such file or directory
              MacBook-Pro-van-Floris:~ Floris$

              Thanks for the help, I would love to learn compiling, but as I leave for the first conczrt tomorrow, I'd better go practice my music with a simplified Pd patch (just a few vocoder bands to get the CPU% down)

              But now, after the terminal stuff, when I try to load a simple patch into the Bela IDE, it takes ages. (still not ready)
              Here's a part of the report. What's happening?
              Building Mmap.cpp...
              ...done
              Building RTAudio.cpp...
              ...done
              Building pru/pru_rtaudio.p...
              ...done
              Building pru/pru_rtaudio_irq.p...
              ...done
              Building PruBinary.cpp...
              ...done
              Building RTAudioCommandLine.cpp...
              ...done
              Building Mcasp.cpp...
              ...done
              Building AuxTaskNonRT.cpp...
              ...done
              Building JSONValue.cpp...
              ...done
              Building board_detect.cpp...
              ...done
              Building WSServer.cpp...
              ...done
              Building AuxiliaryTasks.cpp...
              ...done

                I made the Pd patches simpler, between 60 and 70% CPU usage, to run uncompiled.
                Still the patches won't start when the IDE is disconnected.
                here's the error:
                Makefile:612: recipe for target 'runonly' failed
                Aug 09 20:54:03 bela stdbuf[242]: make: *** [runonly] Error 127
                Aug 09 20:54:03 bela stdbuf[242]: make: Leaving directory '/root/Bela'

                After making the patches even lighter, they work in loop : )

                Floris -bash: scripts/build_pd_hvcc.sh: No such file or directory

                you need to run this from within the Bela folder on your computer.

                Floris Here's a part of the report. What's happening?

                It is rebuilding the Bela core code after the update. This is expected and it's a one-off event after the update. Successive builds will go back to the regular build times.

                Still the patches won't start when the IDE is disconnected.

                OK that's weird.

                here's the error:
                Makefile:612: recipe for target 'runonly' failed
                Aug 09 20:54:03 bela stdbuf[242]: make: *** [runonly] Error 127
                Aug 09 20:54:03 bela stdbuf[242]: make: Leaving directory '/root/Bela'

                Is there anything above those lines? These don't all us much.

                OK, I added support for Trill when building Pd patches with hvcc following the workflow above. I also amended the instructions above to explain how to update your current copies of the repos in order to use my latest changes.

                Now, building your patches should require the changes mentioned above and in addition you need to change

                [s bela_setTrill]

                to

                [s bela_setTrill @hv_param] 

                When building a patch that requires heavylib (as your grain patch does with the changes listed above), you further need to clone heavylib and pass it as the first option to build_pd_hvcc.sh. E.g.:

                ./scripts/build_pd_hvcc.sh -p path/to/heavylib path/to/file.pd -c "-p64" -p PROJECTNAME