Skip to content

03. Setting up MetaSound

Eito Murakami edited this page Nov 28, 2023 · 4 revisions

Chunreal MetaSound Overview

ChuckMain node

Chunreal plugin utilizes the existing digital signal processing (DSP) graph in UE5 called MetaSounds. From the content browser, open Chunreal/ExampleMetaSound/Chunreal_Simple_MetaSound.

This is an example implementation of the ChuckMain node that embeds a ChucK virtual machine. You can have multiple instances of this node inside a MetaSound source or in your level. Below is the list of inputs & outputs.

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

Chaining ChuckMain nodes

Open Chunreal/ExampleMetaSound/Chunreal_ChainedDSPExample_MetaSound to see an example of how you can chain multiple ChuckMain nodes along with other existing MetaSound nodes to perform modular-synthesis style DSP.

image

ChuckSub + ChuckParent nodes

Instead of instantiating ChuckMain nodes, you can use ChuckSub nodes that share a single ChucK virtual machine. This allows you to share global variables between multiple ChucK code. The audio output of each ChuckSub node is routed to a ChuckParent node, which means that you must have a single ChuckParent node in your level if you choose to use ChuckSub nodes.

Open Chunreal/ExampleMetaSound/Chunreal_Sub_MetaSound to see an example implementation of the ChuckSub node.

image

Open Chunreal/ExampleMetaSound/Chunreal_Parent_MetaSound to see an example implementation of the ChuckParent node.

image

Creating your own MetaSound source

For the rest of the tutorial, you can either use one of the example MetaSound sources that we have opened above, or create your own. To create a new MetaSound source, right click anywhere on the content browser and go to the Audio section.

Screenshot 2023-11-28 082904

You can add inputs to the source by clicking on the + button in the inputs section. You can follow the template from above to route inputs to ChucK nodes such that you can control them from an actor component. Feel free to rename the input variables according to your preference!

Screenshot 2023-11-28 084545