Git Product home page Git Product logo

chunreal's Introduction

Chunreal

ChucK - Strongly-timed Music Programming Language - in Unreal Engine 5

Chunreal is a plugin for Unreal Engine 5 that allows users to compile ChucK code at runtime. Multiple ChuckMain nodes can be chained in a MetaSound graph using stereo input & output to perform modular synthesis style digital signal processing.

Developed by Eito Murakami and Ge Wang with the help of Max Jardetzky at CCRMA | Stanford University.

Wiki Tutorial!

The Wiki page contains a step-by-step tutorial that demonstrates how to set up the Chunreal plugin in your Unreal Engine project.

https://github.com/ccrma/chunreal/wiki

Template Project

This git repository hosts a template Unreal Engine 5.3 project that includes example scenes, Blueprints, MetaSound sources, and materials. Clone or fork the repository and generate Visual Studio project files. If this is your first time compiling a Unreal Engine project, set up your IDE by following these tutorials:

https://docs.unrealengine.com/5.3/en-US/setting-up-visual-studio-development-environment-for-cplusplus-projects-in-unreal-engine/

https://docs.unrealengine.com/5.3/en-US/how-to-generate-unreal-engine-project-files-for-your-ide/

Try Example Scenes!

Try opening the following example levels and playing in the editor viewport!

  • Chunreal_SetGlobals_ExampleLevel
  • Chunreal_ChainedDSP_ExampleLevel
  • Chunreal_1Source_ExampleLevel
  • Chunreal_ManySources_ExampleLevel
  • Chunreal_Physics_ExampleLevel
  • Chunreal_Mic_ExampleLevel
  • Chunreal_GlobalEvent_ExampleLevel
  • Chunreal_PitchChange_ExampleLevel

How To Use Chunreal

Setting Up ChuckMain Node

Chunreal_Simple_MetaSound asset contains an example of ChuckMain node implementation in a MetaSound source.

Input

  • Run Code: A trigger input for compiling ChucK code.
  • Code: A string input for ChucK code to be compiled.
  • ID: A string input for assigning a unique ID to a ChuckMain node. This is used to get and set global variables for a specific ChucK instance.
  • Audio Input Left: Audio input left channel. Can be accessed by adc.left inside a ChucK code.
  • Audio Input Right: Audio input right channel. Can be accessed by adc.right inside a ChucK code.
  • Volume Multiplier: A float input for applying a volume multiplier to both output channels.

Output

  • Audio Output Left: Audio output left channel. Can be accessed by dac.left inside a ChucK code.
  • Audio Output Right: Audio output right channel. Can be accessed by dac.right inside a ChucK code.
image

Set Parameters From A Blueprint Actor

Create a Blueprint actor, attach an audio component, and assign your MetaSound source that contains a ChuckMain node(s) as the sound parameter. Optionally, enable Allow Spatialization and apply Attenuation Settings. We prepared an example Binaural_SA sound attenuation asset.

Chunreal_Simple_BP asset provides a template.

image

A ChucK code can be written as a string and can be passed to the Audio Component that uses the MetaSound source as follows:

image

Alternatively, we prepared a ReadFile Blueprint function for loading a .ck file using an absolute path.

image

Getting & Setting ChucK Global Variables Using ID

A specific ChucK instance can be accessed using its assigned unique ID. Global event, int, float, and string variables can be accessed using the following Blueprint functions. To learn how to use each function, open each Blueprint Actor in ExampleBlueprints folder.

image

Connecting Multiple ChuckMain Nodes

Multiple ChuckMain nodes can be chained in a MetaSound source and can interact with other existing MetaSound nodes!

Chunreal_ChainedDSPExample_MetaSound and Chunreal_ChainedDSPExample_BP provide a template.

image

ChucK Community

Join us!! ChucK Community Discord | ChucK-users Mailing list

chunreal's People

Contributors

eitomurakami avatar gewang avatar

Stargazers

Rogier Barendregt avatar Tim Brown avatar Nicolai Ivanov avatar Obiwan Medeiros avatar Dylan Dumesnil avatar Hector Centeno avatar Henning Sprang avatar Ivan Afanasev avatar Corentin Demougeot avatar vasya vasin avatar David Su avatar  avatar  avatar SAXELECTRO avatar sean echevarria avatar 华清飞扬-小木子 avatar Takanobu Inafuku avatar Chen Tao avatar  avatar  avatar  avatar  avatar  avatar Grigoriev Mikhail avatar  avatar Matthias Huerbe avatar UglyStupidHonest avatar YUnaa avatar  avatar Kaj Forney avatar patrickhartono avatar  avatar Amy Lo (she/her) avatar Arne Koenig avatar Yuan-Man avatar

Watchers

Spencer Salazar avatar Alexandre Enkerli avatar  avatar Hongchan Choi avatar Romain avatar patrickhartono avatar  avatar Eric Heep avatar Mike Mulshine avatar  avatar Celeste Betancur avatar Andrew Zhu Aday avatar  avatar Krzysztof Gawlas avatar  avatar

chunreal's Issues

Sample rate hard-coded at 44100Hz

The sample rate of ChuckMain node is hard-coded at 44100Hz. The frequency would be inaccurate if the project setting is using sample rate other than 44100Hz.

Log from ChucK is disabled

#define PRINT_CHUCK_LOG in Chunreal.h is set to false for now since
theChuck->setStdoutCallback(FChunrealModule::printThisFromChuck);
from multiple ChucKMainNode.cpp causes a crash.

multiple ChucK VMs in Unreal is unstable

instancing multiple ChucK (VM/main) instances in Chunreal is unstable. It appears capable of running with audio, but will crash. Possibilities:

  1. bug with certain global variables shared across VMS (something that Jack and I didn't catch in numchucks; or something added since)
  2. there is still occasionally a bad memory dealloc upon ChucK VM cleanup it is possible when any VM is deleted, it may be corrupting memory. Need to investigate ChucK deallocation starting with ChucK::~ChucK() with logging enabled etc.
  3. a bug we may have introduced during #chureal refactor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.