Skip to content

️🛠 - Add operator overloading for declarative syntax #19

Description

@maxwellmattryan

Description

It would be really cool to write DSP chaining code like the following:

Oscillator osc1;
Oscillator osc2;
Filter filter;
LFO lfo;

int main(void) {
    float sample = (osc1 * lfo) + osc2 >> filter;
    buffer.writeSample(sample);
}

As an explanation of the syntax:

  • osc1 * lfo - module an oscillator by "multiplying" an LFO
  • (...) + osc2 - sum the signals from the two oscillators together
  • (...) >> filter - pipe the summation output into the filter's input

This may not be worth it; might be somewhat of a dead-end but if the syntax works and is practical in the environments I'm targeting then I don't see why it couldn't be added, especially if the more verbose way is still kept.

Requirements

TBD

Checklist

  • I have linked the correct milestone and/or project(s)
  • I have added the appropriate labels
  • I have assigned this task to the correct people

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions