elemaudio / elemaudio/elementary

Add a Native Renderer Implementation for Better Language Binding Support

Open
#84 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
513
Forks
46
PR merge metrics
No merged PRs in 30d

Description

# Problem
Currently, if you want to create a language binding for a language other than JavaScript for Elementary, you have to re-implement the Renderer and structural hashing/graph reconciliation algorithm.

# Background
Elementary is optimized for a JS environment by placing the Renderer and structural hashing/graph reconciliation algorithm in the JS layer, which minimizes the size of messages passed from JS to C++ which requires JSON serialization and deserialization. For example, if you have a large audio graph representation, and you change a single keyed leaf node, then it is far more efficient to send a single `updateProperty` instruction than to serialize and deserialize the entire audio graph.

# Proposed Solution
In compiled languages capable of interfacing more directly with the C++ runtime, there is no limitation for interacting with the Runtime. A native Renderer implementation could be included alongside the Runtime such that any C++ compatible language that wants a binding could create a thin wrapper around `Renderer`, `NodeRepr`, and the `stdlib` node functions, such that it could build the audio graph representation in its native language and then pass that over to be rendered by the C++ Renderer + Runtime.

Not only is this super efficient computationally, but more importantly it facilitates the creation of new language bindings without re-implementing the Renderer and structural hashing/graph reconciliation algorithm for each one.

This wouldn't even increase the binary sizes for the JS use case because it's a header-only library and it won't be included unless explicitly pulled in by the user.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the existing JavaScript Renderer, NodeRepr, structural hashing and graph reconciliation logic, and the stdlib node functions. Define the scope of a header-only native C++ Renderer alongside the Runtime, then verify that new language bindings can wrap it without reimplementing reconciliation and that the JavaScript use case remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, javascript
Domain
audio-video-rtc
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.