chuck-max: a Max/MSP external with an embedded chuck engine

Shakeeb Alireza's icon

chuck-max is a project to embed the chuck engine in a Max/MSP external.

It currently has one external (chuck~) with the following features:

- Generate and process audio via an embedded chuck engine by running chuck files with `global` parameters adjusted and controlled in realtime via Max messages.

- Layer sounds by running multiple chuck files concurrently.

- Add and remove audio and audio processes on the fly via Max messages.

- Includes most of the standard ccrma chugins

The project's repo is: https://github.com/shakfu/chuck-max

While this is not a release yet of the external itself, the repo contains all of the external's dependencies and is very straightforward to compile using the standard Max SDK build system.

PS: this is project is inspired by Professor Brad Garton's original chuck~ external for Max 5. The chuck and Max apis have changed considerably since then, so a minimal rewrite was necessary with a view to incorporating some of the original external's features eventually.

Enjoy!

S

Iain Duncan's icon

Fantastic! This is really great work you are doing. This may actually get learning chuck to buble up high enough on my list! :-)

Reminds me I need to do an M1 version of the Csound6 object.....

Shakeeb Alireza's icon

Thanks, Iain. It's nice to work on audio externals for a change (-:

Lukas Haas's icon

hi shakeeb, thanks for your work on this external! i am trying to get it running for a project and i can follow all your github instructions perfectly (great documentation!), but once i open it in max i get the "chuck~: could not load due to incorrect architecture" error.

is that a Mac M1 problem? can you point me in any direction to fix it? thanks in advance already :)

Shakeeb Alireza's icon

Hi Lukas,

Can you please provide some more information so I can help. What machine did you try to run it on? Did you compile the external yourself? It can currently only run on macOS x86_64 or arm64 since I'm not so well versed on windows dev.

If you are on a Mac it should be architecture independent if you build it yourself... here's the relevant part of the CMakeLists.txt file:

if (APPLE)
    if (${CMAKE_GENERATOR} MATCHES "Xcode")
            if (${XCODE_VERSION} VERSION_LESS 10)
                message(STATUS "Xcode 10 or higher is required. Please install from the Mac App Store.")
                return ()
            endif ()
    endif ()

    if (NOT CMAKE_OSX_ARCHITECTURES)
        if(C74_BUILD_FAT)
            set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "macOS architecture" FORCE)
        else()
            set(CMAKE_OSX_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR} CACHE STRING "macOS architecture" FORCE)
        endif()
        message("CMAKE_OSX_ARCHITECTURES set to ${CMAKE_OSX_ARCHITECTURES}")
    endif()
endif()

This means that it defaults to a native architecture of the Mac that it's compiled on. It also means that if it's built on a different Mac with a different architecture than the one you try to run it on, it will give you an 'incorrect architecture' error.

This may be the problem you have... Note that you can build the external for both macOS architectures ("universal") by setting the cmake C74_BUILD_FAT option as follows:

mkdir -p build && cd build && cmake -GXcode -DC74_BUILD_FAT=ON .. && cmake --build . --config 'Release'

Or just

make universal (I just added this option to the main branch)

Let me know how it goes.. Also note that it may be better to post your issue to the project issue-tracker: https://github.com/shakfu/chuck-max/issues

Lukas Haas's icon

Hi Shakeeb,

super nice of you to get back to me so quickly and with such detail! I'll follow your hint and post my issue to github.

Thanks,

Lukas

Shakeeb Alireza's icon

A quick update on chuck-max: a max/msp external which embeds the chuck engine (currently only for macOs arm64 and x86_64):

  • Support for core chuck vm messages to manage shreds or concurrent chuck audio processes: add, replace, remove, clear vm, clear globals, status, etc..

  • Support for most of the base ccrma chugins now includes the Faust and WarpBuf chugins which can all be built automatically with the chuck-max source using make full.

  • The Fauck or 'Faust' chugin is a full blown llvm-based faust dsp engine embedded in a chuck plugin: "FaucK allows programmers to evaluate Faust code on-the-fly inside ChucK and control Faust signal processors using ChucK’s sample-precise timing and concurrency mechanisms."

  • The WarpBuf chugin, built on librubberband and libsamplerate, make it easy to time-stretch and independently transpose the pitch of an audio file or Ableton live clip.

  • Incorporated latest chuck examples which have significantly increased in number and scope.

  • New Max-related tests and demo patchers.

  • Mamy other small usability improvements.

Shakeeb Alireza's icon

Just released chuck-max v0.1.2, a package containing chuck~, Max/MSP external which embeds the ChucK engine, many compiled chuck plugins, including an llvm-based faust plugin, and tons of code and patcher examples.

Notarized arm64, x86_64 and universal binary builds are available for all flavors of Mac.

Iain Duncan's icon

Fantastic, congrats! :-)

Shakeeb Alireza's icon

Thanks very much, Iain (-: